TFCweb  1.0.4 $Rev: 483 $
TFC Primavera 2012: Nucli d'un servidor web
TestCapsalera.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 <sstream>
31 
32 #include <CapsaleraHTTP.h>
33 
34 #include "comu.h"
35 
36 using namespace std;
37 using namespace tfc;
38 
39 BOOST_AUTO_TEST_SUITE( CapsaleraHTTP_TestSuite )
40 
41 CapsaleraHTTP cnv1("Nom", "Valor"),
42  cnv2("Nom", "Valor"),
43  che("Host", "www.example.com");
44 
46 {
47  BOOST_CHECK( cnv1 == cnv2 );
48  // != no definit
49  //BOOST_CHECK( !(*cnv1 != *cnv2) );
50 
51  BOOST_CHECK( !(cnv1 == che) );
52 }
53 
55 {
56  CapsaleraHTTP c(che);
57  BOOST_CHECK(c == che);
58 
59  //CapsaleraHTTP c2 = che;
60  //BOOST_CHECK(c2 == che);
61 }
62 
64 {
65  BOOST_CHECK( cnv1.nom() == "Nom" );
66  BOOST_CHECK( cnv1.valor() == "Valor" );
67 }
68 
70 {
71  cnv1.set_valor("Nou Valor");
72  BOOST_CHECK( cnv1.valor() == "Nou Valor" );
73  cnv1.set_valor("Valor");
74 }
75 
77 {
78  ostringstream ss;
79  ss << che;
80  BOOST_CHECK( ss.str() == "Host: www.example.com" );
81 }
82 
83 BOOST_AUTO_TEST_SUITE_END()
84 
85 // vim:set ts=4 et ai: //