GCC Code Coverage Report | |||||||||||||||||||||
|
|||||||||||||||||||||
Line | Branch | Exec | Source |
1 |
|||
2 |
/*************************************** |
||
3 |
Auteur : Pierre Aubert |
||
4 |
Mail : pierre.aubert@lapp.in2p3.fr |
||
5 |
Licence : CeCILL-C |
||
6 |
****************************************/ |
||
7 |
|||
8 |
#include <iostream> |
||
9 |
#include "phoenix_assert.h" |
||
10 |
#include "phoenix_check.h" |
||
11 |
#include "string_function.h" |
||
12 |
|||
13 |
///Check the erase first chars |
||
14 |
/** @param testName : name of the test |
||
15 |
* @param strExpr : string to be parsed to get a MathExpr |
||
16 |
* @param strReference : reference string |
||
17 |
* @return true is both strings are equal, false otherwise |
||
18 |
*/ |
||
19 |
4 |
bool checkEraseFirstChars(const std::string & testName, const std::string & strExpr, const std::string & strReference){ |
|
20 |
✓✓ | 8 |
std::string strErase(eraseFirstCharsInStr(strExpr, " \t\n")); |
21 |
✓✓✓✓ |
8 |
return phoenix_check(testName + "("+strExpr+")", strErase, strReference); |
22 |
} |
||
23 |
|||
24 |
///Check the erase last chars |
||
25 |
/** @param testName : name of the test |
||
26 |
* @param strExpr : string to be parsed to get a MathExpr |
||
27 |
* @param strReference : reference string |
||
28 |
* @return true is both strings are equal, false otherwise |
||
29 |
*/ |
||
30 |
4 |
bool checkEraseLastChars(const std::string & testName, const std::string & strExpr, const std::string & strReference){ |
|
31 |
✓✓ | 8 |
std::string strErase(eraseLastCharsInStr(strExpr, " \t\n")); |
32 |
✓✓✓✓ |
8 |
return phoenix_check(testName + "("+strExpr+")", strErase, strReference); |
33 |
} |
||
34 |
|||
35 |
///Check the erase first last chars |
||
36 |
/** @param testName : name of the test |
||
37 |
* @param strExpr : string to be parsed to get a MathExpr |
||
38 |
* @param strReference : reference string |
||
39 |
* @return true is both strings are equal, false otherwise |
||
40 |
*/ |
||
41 |
4 |
bool checkEraseFirstLastChars(const std::string & testName, const std::string & strExpr, const std::string & strReference){ |
|
42 |
✓✓ | 8 |
std::string strErase(eraseFirstLastChars(strExpr, " \t\n")); |
43 |
✓✓✓✓ |
8 |
return phoenix_check(testName + "("+strExpr+")", strErase, strReference); |
44 |
} |
||
45 |
|||
46 |
///Check the erase first last chars |
||
47 |
/** @param testName : name of the test |
||
48 |
* @param strExpr : string to be parsed to get a MathExpr |
||
49 |
* @param strReference : reference string |
||
50 |
* @return true is both strings are equal, false otherwise |
||
51 |
*/ |
||
52 |
1 |
bool checkEraseFirstLastCharsVector(const std::string & testName, const std::string & strExpr, const std::string & strReference){ |
|
53 |
2 |
std::vector<std::string> vecStrExpr; |
|
54 |
✓ | 1 |
vecStrExpr.push_back(strExpr); |
55 |
✓✓ | 2 |
std::vector<std::string> strErase(eraseFirstLastChars(vecStrExpr, " \t\n")); |
56 |
✓✓✓✓ |
2 |
return phoenix_check(testName + "("+strExpr+")", strErase.front(), strReference); |
57 |
} |
||
58 |
|||
59 |
///Test string erase first chars |
||
60 |
1 |
void testBaseEraseFirstChars(){ |
|
61 |
✓✓✓✓ ✓✓✓✓ |
1 |
phoenix_assert(checkEraseFirstChars("Erase first chars 1", "one thing", "one thing")); |
62 |
✓✓✓✓ ✓✓✓✓ |
1 |
phoenix_assert(checkEraseFirstChars("Erase first chars 2", " one thing", "one thing")); |
63 |
✓✓✓✓ ✓✓✓✓ |
1 |
phoenix_assert(checkEraseFirstChars("Erase first chars 3", "one thing ", "one thing ")); |
64 |
✓✓✓✓ ✓✓✓✓ |
1 |
phoenix_assert(checkEraseFirstChars("Erase first chars 4", " one thing ", "one thing ")); |
65 |
1 |
} |
|
66 |
|||
67 |
///Test string erase last chars |
||
68 |
1 |
void testBaseEraseLastChars(){ |
|
69 |
✓✓✓✓ ✓✓✓✓ |
1 |
phoenix_assert(checkEraseLastChars("Erase last chars 1", "one thing", "one thing")); |
70 |
✓✓✓✓ ✓✓✓✓ |
1 |
phoenix_assert(checkEraseLastChars("Erase last chars 2", " one thing", " one thing")); |
71 |
✓✓✓✓ ✓✓✓✓ |
1 |
phoenix_assert(checkEraseLastChars("Erase last chars 3", "one thing ", "one thing")); |
72 |
✓✓✓✓ ✓✓✓✓ |
1 |
phoenix_assert(checkEraseLastChars("Erase last chars 4", " one thing ", " one thing")); |
73 |
1 |
} |
|
74 |
|||
75 |
///Test string erase first last chars |
||
76 |
1 |
void testBaseEraseFirstLastChars(){ |
|
77 |
✓✓✓✓ ✓✓✓✓ |
1 |
phoenix_assert(checkEraseFirstLastChars("Erase first last chars 1", "one thing", "one thing")); |
78 |
✓✓✓✓ ✓✓✓✓ |
1 |
phoenix_assert(checkEraseFirstLastChars("Erase first last chars 2", " one thing", "one thing")); |
79 |
✓✓✓✓ ✓✓✓✓ |
1 |
phoenix_assert(checkEraseFirstLastChars("Erase first last chars 3", "one thing ", "one thing")); |
80 |
✓✓✓✓ ✓✓✓✓ |
1 |
phoenix_assert(checkEraseFirstLastChars("Erase first last chars 4", " one thing ", "one thing")); |
81 |
✓✓✓✓ ✓✓✓✓ |
1 |
phoenix_assert(checkEraseFirstLastCharsVector("Erase first last chars 4", " one thing ", "one thing")); |
82 |
1 |
} |
|
83 |
|||
84 |
1 |
int main(int argc, char** argv){ |
|
85 |
1 |
testBaseEraseFirstChars(); |
|
86 |
1 |
testBaseEraseLastChars(); |
|
87 |
1 |
testBaseEraseFirstLastChars(); |
|
88 |
1 |
return 0; |
|
89 |
} |
||
90 |
|||
91 |
Generated by: GCOVR (Version 4.2) |