GCC Code Coverage Report | |||||||||||||||||||||
|
|||||||||||||||||||||
Line | Branch | Exec | Source |
1 |
/*************************************** |
||
2 |
Auteur : Pierre Aubert |
||
3 |
Mail : pierre.aubert@lapp.in2p3.fr |
||
4 |
Licence : CeCILL-C |
||
5 |
****************************************/ |
||
6 |
|||
7 |
#include "convertToString.h" |
||
8 |
#include "string_filename.h" |
||
9 |
#include "phoenix_check.h" |
||
10 |
|||
11 |
///Check two string |
||
12 |
/** @param testName : name of the current test |
||
13 |
* @param val : std::string to be checked |
||
14 |
* @param reference : reference std::string |
||
15 |
* @return true if val == reference, false otherwise |
||
16 |
*/ |
||
17 |
158 |
bool phoenix_check(const std::string & testName, const std::string & val, const std::string & reference){ |
|
18 |
158 |
bool b(val == reference); |
|
19 |
✗✓ | 158 |
if(!b){ |
20 |
std::cout << "phoenix_check : " << testName << " => " << phoenix_isOk(b) << std::endl; |
||
21 |
std::cout << "\tval = '"<<val<<"'" << std::endl; |
||
22 |
std::cout << "\treference = '"<<reference<<"'" << std::endl; |
||
23 |
} |
||
24 |
158 |
return b; |
|
25 |
} |
||
26 |
|||
27 |
///Check two vector of string |
||
28 |
/** @param testName : name of the current test |
||
29 |
* @param listVal : list of std::string to be checked |
||
30 |
* @param listRef : list of reference std::string |
||
31 |
* @return true if val == reference, false otherwise |
||
32 |
*/ |
||
33 |
8 |
bool phoenix_check(const std::string & testName, const std::vector<std::string> & listVal, const std::vector<std::string> & listRef){ |
|
34 |
8 |
bool b(true); |
|
35 |
//On this implementation, two vectors of different sizes are not comparable |
||
36 |
✓✓ | 8 |
b &= phoenix_check(testName + " size", listVal.size(), listRef.size()); |
37 |
✓✓✓✓ ✓✓ |
11 |
for(size_t i(0lu); i < listVal.size() && b; ++i){ |
38 |
✓✓✓✓ ✓ |
3 |
b &= phoenix_check(testName + " str("+convertToString(i)+")", listVal[i], listRef[i]); |
39 |
} |
||
40 |
8 |
return b; |
|
41 |
} |
||
42 |
|||
43 |
///Check two list of string |
||
44 |
/** @param testName : name of the current test |
||
45 |
* @param listVal : list of std::string to be checked |
||
46 |
* @param listRef : list of reference std::string |
||
47 |
* @return true if val == reference, false otherwise |
||
48 |
*/ |
||
49 |
9 |
bool phoenix_check(const std::string & testName, const std::list<std::string> & listVal, const std::list<std::string> & listRef){ |
|
50 |
9 |
bool b(true); |
|
51 |
//On this implementation, two list of different sizes are not comparable |
||
52 |
✓✓ | 9 |
b &= phoenix_check(testName + " size", listVal.size(), listRef.size()); |
53 |
9 |
std::list<std::string>::const_iterator itVal(listVal.begin()); |
|
54 |
9 |
std::list<std::string>::const_iterator itRef(listRef.begin()); |
|
55 |
9 |
size_t i(0lu); |
|
56 |
✓✓✓✓ ✓✓✓✓ |
15 |
while(itVal != listVal.end() && itRef != listRef.end() && b){ |
57 |
✓✓✓✓ ✓ |
6 |
b &= phoenix_check(testName + " str("+convertToString(i)+")", *itVal, *itRef); |
58 |
6 |
++itVal; |
|
59 |
6 |
++itRef; |
|
60 |
6 |
++i; |
|
61 |
} |
||
62 |
9 |
return b; |
|
63 |
} |
||
64 |
|||
65 |
///Check the content of a file |
||
66 |
/** @param testName : name of the current test |
||
67 |
* @param fileName : name of the file to be checked |
||
68 |
* @param expectedContent : expected content of the file |
||
69 |
* @return true if the file content is correct, false otherwise |
||
70 |
*/ |
||
71 |
1 |
bool phoenix_check_fileContent(const std::string & testName, const std::string & fileName, const std::string & expectedContent){ |
|
72 |
✓ | 1 |
return phoenix_check(testName, getFileContent(fileName), expectedContent); |
73 |
} |
||
74 |
Generated by: GCOVR (Version 4.2) |