TFCweb  1.0.4 $Rev: 483 $
TFC Primavera 2012: Nucli d'un servidor web
TestTipusMIME.cc
Veure la documentació d'aquest fitxer.
1 #if !defined(_TEST_TIPUS_MIME_H_)
2 #define _TEST_TIPUS_MIME_H_
3 
13 /*
14  * Copyright (c) 2012 Toni Corvera
15  *
16  * This file is part of TFCWeb.
17  *
18  * TFCWeb is free software: you can redistribute it and/or modify
19  * it under the terms of the GNU General Public License as published by
20  * the Free Software Foundation, either version 3 of the License, or
21  * (at your option) any later version.
22  *
23  * TFCWeb is distributed in the hope that it will be useful,
24  * but WITHOUT ANY WARRANTY; without even the implied warranty of
25  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26  * GNU General Public License for more details.
27  *
28  * You should have received a copy of the GNU General Public License
29  * along with TFCWeb. If not, see <http://www.gnu.org/licenses/>.
30  */
31 
32 #include <sstream>
33 
34 #include <TipusMIME.h>
35 
36 #include "comu.h"
37 
38 using namespace std;
39 using namespace tfc;
40 
41 BOOST_AUTO_TEST_SUITE( TipusMIME_TestSuite )
42 
43 BOOST_AUTO_TEST_CASE( no_registrat )
44 {
45  BOOST_CHECK_EQUAL( RegistreTipusMIME::per_extensio("extensió no registrada"), "text/plain" );
46 }
47 
49 {
50  BOOST_CHECK_EQUAL( RegistreTipusMIME::per_extensio("JPG"), "image/jpeg" );
51 }
52 
54 {
55  BOOST_CHECK_EQUAL( RegistreTipusMIME::per_extensio("Jpg"),
57 }
58 
60 {
61  const char * ext = "laMevaExt";
62  const char * tipus = "application/x-test-case";
63  BOOST_CHECK_NO_THROW( RegistreTipusMIME::registra_extensio(ext, tipus) );
64  BOOST_CHECK_EQUAL( RegistreTipusMIME::per_extensio(ext), tipus );
65 }
66 
67 BOOST_AUTO_TEST_SUITE_END()
68 
69 #endif // _TEST_TIPUS_MIME_H_
70 
71 // vim:set ts=4 et ai: //