TFCweb  1.0.4 $Rev: 483 $
TFC Primavera 2012: Nucli d'un servidor web
TestRespostaHTTP.cc
Veure la documentació d'aquest fitxer.
1 
11 /*
12  * Copyright (c) 2012 Toni Corvera
13  *
14  * This file is part of TFCWeb.
15  *
16  * TFCWeb is free software: you can redistribute it and/or modify
17  * it under the terms of the GNU General Public License as published by
18  * the Free Software Foundation, either version 3 of the License, or
19  * (at your option) any later version.
20  *
21  * TFCWeb is distributed in the hope that it will be useful,
22  * but WITHOUT ANY WARRANTY; without even the implied warranty of
23  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24  * GNU General Public License for more details.
25  *
26  * You should have received a copy of the GNU General Public License
27  * along with TFCWeb. If not, see <http://www.gnu.org/licenses/>.
28  */
29 
30 #include <iostream>
31 #include <limits>
32 #include <sstream>
33 #include <string>
34 
35 #include <CodisEstatHTTP.h>
36 #include <CapsaleraHTTP.h>
37 #include <Excepcions.h>
38 #include <RespostaHTTP.h>
39 
40 #include "comu.h"
41 
42 using namespace std;
43 using namespace tfc;
44 
45 
46 // TODO: Moure?
47 BOOST_AUTO_TEST_SUITE( FrasesHTTP_TestSuite )
48 
50 {
51  //BOOST_CHECK_THROW(frase_estat(indefinit), ErrorTipusPeticioHTTPDesconeguda);
52 
53  BOOST_CHECK_EQUAL(FrasesEstatHTTP::frase(CODI_200), "OK");
54 }
55 
56 BOOST_AUTO_TEST_SUITE_END()
57 
58 BOOST_AUTO_TEST_SUITE( CodisEstatHTTP_TestSuite )
59 
60 BOOST_AUTO_TEST_CASE( valor_numeric )
61 {
62  BOOST_CHECK_EQUAL( CODI_502, 502 );
63 }
64 
65 BOOST_AUTO_TEST_SUITE_END()
66 
67 // ------------------------------------------------------------------------- //
68 
69 BOOST_AUTO_TEST_SUITE( RespostaHTTP_TestSuite )
70 
72 
74 {
75  BOOST_CHECK( r404 == r404_2 );
76 }
77 
79 {
80  RespostaHTTP c505(r505);
81 // BOOST_CHECK( r505 == c505 );
82  BOOST_CHECK_EQUAL( r505, c505 );
83 }
84 
86 {
87  BOOST_CHECK_EQUAL(r404.codi(), CODI_404);
88  BOOST_CHECK_EQUAL(r404.frase(), FrasesEstatHTTP::frase(CODI_404));
89 }
90 
91 BOOST_AUTO_TEST_CASE( MostraImpressio )
92 {
93  cerr << "Mostra d'impressió de respostes HTTP:" << endl;
95  r.afegeix_capsalera("Server", "Example/1.0");
96  cerr << r << endl;
97 }
98 
99 #if 0
100 BOOST_AUTO_TEST_CASE( setters )
101 {
102 }
103 #endif
104 
105 BOOST_AUTO_TEST_SUITE_END()
106 
107 // vim:set ts=4 et ai: //