1 |
|
|
|
2 |
|
|
/*************************************** |
3 |
|
|
Auteur : Pierre Aubert |
4 |
|
|
Mail : pierre.aubert@lapp.in2p3.fr |
5 |
|
|
Licence : CeCILL-C |
6 |
|
|
****************************************/ |
7 |
|
|
|
8 |
|
|
#include <iostream> |
9 |
|
|
#include "print_string.h" |
10 |
|
|
|
11 |
|
|
///Test print to string |
12 |
|
|
/** @param prefix : string prefix |
13 |
|
|
* @param suffix : string prefix |
14 |
|
|
* @return true on success, false otherwise |
15 |
|
|
*/ |
16 |
|
2 |
bool testPrintString(const std::string & prefix, const std::string & suffix){ |
17 |
|
4 |
std::list<std::string> listString; |
18 |
|
4 |
std::vector<std::string> vecString; |
19 |
✓ |
2 |
phoenix_print("some string", suffix, prefix); |
20 |
✓ |
2 |
phoenix_print(listString, suffix, prefix); |
21 |
✓ |
2 |
phoenix_print(vecString, suffix, prefix); |
22 |
|
|
|
23 |
✓✓ |
2 |
listString.push_back("Some string"); |
24 |
✓ |
2 |
phoenix_print(listString, suffix, prefix); |
25 |
✓✓ |
2 |
listString.push_back("And other"); |
26 |
✓ |
2 |
phoenix_print(listString, suffix, prefix); |
27 |
✓✓ |
2 |
listString.push_back("And other again"); |
28 |
✓ |
2 |
phoenix_print(listString, suffix, prefix); |
29 |
|
|
|
30 |
✓✓ |
2 |
vecString.push_back("Some string"); |
31 |
✓ |
2 |
phoenix_print(vecString, suffix, prefix); |
32 |
✓✓ |
2 |
vecString.push_back("And other"); |
33 |
✓ |
2 |
phoenix_print(vecString, suffix, prefix); |
34 |
✓✓ |
2 |
vecString.push_back("And other again"); |
35 |
✓ |
2 |
phoenix_print(vecString, suffix, prefix); |
36 |
|
|
|
37 |
|
4 |
std::map<int, int> mapValue; |
38 |
✓ |
2 |
phoenix_print(mapValue, suffix, prefix); |
39 |
✓ |
2 |
mapValue[42] = 23; |
40 |
✓ |
2 |
phoenix_print(mapValue, suffix, prefix); |
41 |
✓ |
2 |
mapValue[12] = 39; |
42 |
✓ |
2 |
phoenix_print(mapValue, suffix, prefix); |
43 |
|
|
|
44 |
|
2 |
std::map<int, std::vector<std::string> > mapVecString; |
45 |
✓ |
2 |
phoenix_print(mapVecString, suffix, prefix); |
46 |
✓✓ |
2 |
mapVecString[42] = vecString; |
47 |
✓ |
2 |
phoenix_print(mapVecString, suffix, prefix); |
48 |
✓✓ |
2 |
mapVecString[12] = vecString; |
49 |
✓ |
2 |
phoenix_print(mapVecString, suffix, prefix); |
50 |
|
|
|
51 |
|
4 |
return true; |
52 |
|
|
} |
53 |
|
|
|
54 |
|
|
|
55 |
|
1 |
int main(int argc, char** argv){ |
56 |
|
1 |
bool b(true); |
57 |
✓✓✓ |
1 |
b &= testPrintString("", ""); |
58 |
✓✓✓ |
1 |
b &= testPrintString("Prefix", "Suffix"); |
59 |
|
|
|
60 |
|
1 |
return b - 1; |
61 |
|
|
} |
62 |
|
|
|
63 |
|
|
|