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 |
|||
12 |
#include "PString.h" |
||
13 |
|||
14 |
///Check string lower expression |
||
15 |
/** @param testName : name of the test |
||
16 |
* @param strValue : string to be tested |
||
17 |
* @param strReference : reference string |
||
18 |
* @return true is both strings are equal, false otherwise |
||
19 |
*/ |
||
20 |
22 |
bool checkString(const std::string & testName, const std::string & strValue, const std::string & strReference){ |
|
21 |
22 |
return phoenix_check(testName, strValue, strReference); |
|
22 |
} |
||
23 |
|||
24 |
///Test the is lower/upper case |
||
25 |
1 |
void testPString(){ |
|
26 |
✓✓ | 3 |
PString baseStr("baseString"); |
27 |
✓✓✓✓ ✓✓✓ |
1 |
phoenix_assert(checkString("Test constructor", baseStr, "baseString")); |
28 |
✓ | 2 |
PString checkEqual; |
29 |
✓ | 1 |
checkEqual = baseStr; |
30 |
✓✓✓✓ ✓✓✓ |
1 |
phoenix_assert(checkString("Test equal", checkEqual, "baseString")); |
31 |
|||
32 |
✓ | 2 |
PString copyString(baseStr); |
33 |
✓✓✓✓ ✓✓✓ |
1 |
phoenix_assert(checkString("Test copy constructor", copyString, "baseString")); |
34 |
✓ | 2 |
PString equalOperatorStr; |
35 |
✓ | 1 |
equalOperatorStr = baseStr; |
36 |
✓✓✓✓ ✓✓✓ |
1 |
phoenix_assert(checkString("Test equal operator str", equalOperatorStr, "baseString")); |
37 |
|||
38 |
✓ | 2 |
PString equalOperatorFluxStr; |
39 |
✓ | 1 |
equalOperatorFluxStr = baseStr; |
40 |
✓✓✓✓ ✓✓✓ |
1 |
phoenix_assert(checkString("Test << operator str", equalOperatorFluxStr, "baseString")); |
41 |
|||
42 |
✓ | 1 |
baseStr += " end"; |
43 |
✓✓✓✓ ✓✓✓ |
1 |
phoenix_assert(checkString("Test += string", baseStr, "baseString end")); |
44 |
|||
45 |
✓ | 2 |
PString valDouble; |
46 |
✓ | 1 |
valDouble = 42.0; |
47 |
✓✓✓✓ ✓✓✓ |
1 |
phoenix_assert(checkString("Test equal operator double", valDouble, "42")); |
48 |
|||
49 |
✓ | 2 |
PString valFloat; |
50 |
✓ | 1 |
valFloat = 42.0f; |
51 |
✓✓✓✓ ✓✓✓ |
1 |
phoenix_assert(checkString("Test equal operator float", valFloat, "42")); |
52 |
|||
53 |
✓ | 2 |
PString valDoubleFlux; |
54 |
✓ | 1 |
valDoubleFlux << 42.0; |
55 |
✓✓✓✓ ✓✓✓ |
1 |
phoenix_assert(checkString("Test << operator double", valDoubleFlux, "42")); |
56 |
|||
57 |
✓ | 2 |
PString valFloatFlux; |
58 |
✓ | 1 |
valFloatFlux << 42.0f; |
59 |
✓✓✓✓ ✓✓✓ |
1 |
phoenix_assert(checkString("Test << operator float", valFloatFlux, "42")); |
60 |
|||
61 |
✓ | 1 |
valDouble += 3.14; |
62 |
✓✓✓✓ ✓✓✓ |
1 |
phoenix_assert(checkString("Test += operator double", valDouble, "423.14")); |
63 |
|||
64 |
✓ | 1 |
valFloat += 3.14f; |
65 |
✓✓✓✓ ✓✓✓ |
1 |
phoenix_assert(checkString("Test += operator float", valFloat, "423.14")); |
66 |
|||
67 |
✓ | 2 |
PString resAdd = valDouble + valFloat; |
68 |
✓✓✓✓ ✓✓✓ |
1 |
phoenix_assert(checkString("Test + operator PString", resAdd, "423.14423.14")); |
69 |
|||
70 |
✓ | 2 |
PString resAddDouble; |
71 |
✓✓✓✓ |
1 |
resAddDouble = PString("double ") + 3.14; |
72 |
✓✓✓✓ ✓✓✓ |
1 |
phoenix_assert(checkString("Test + operator double", resAddDouble, "double 3.14")); |
73 |
|||
74 |
✓ | 2 |
PString resAddFloat; |
75 |
✓✓✓✓ |
1 |
resAddFloat = PString("float ") + 3.14; |
76 |
✓✓✓✓ ✓✓✓ |
1 |
phoenix_assert(checkString("Test + operator float", resAddFloat, "float 3.14")); |
77 |
|||
78 |
✓✓✓✓ ✓✓ |
4 |
PString strA("str1"), strB("str2"), resResAB, resFluxAB; |
79 |
✓✓ | 1 |
resResAB = strA + strB; |
80 |
✓✓✓✓ ✓✓✓ |
1 |
phoenix_assert(checkString("Test + operator PString", resResAB, "str1str2")); |
81 |
✓✓ | 1 |
resFluxAB << strA << strB; |
82 |
✓✓✓✓ ✓✓✓ |
1 |
phoenix_assert(checkString("Test << operator PString", resFluxAB, "str1str2")); |
83 |
|||
84 |
✓✓ | 3 |
PString strAddStr("Some string"); |
85 |
✓ | 1 |
strAddStr += " other string"; |
86 |
✓✓✓✓ ✓✓✓ |
1 |
phoenix_assert(checkString("Test += operator std::string", strAddStr, "Some string other string")); |
87 |
|||
88 |
✓✓ | 3 |
PString strAddFluxStr("Some string"); |
89 |
✓ | 1 |
strAddFluxStr << " other string"; |
90 |
✓✓✓✓ ✓✓✓ |
1 |
phoenix_assert(checkString("Test << operator std::string", strAddFluxStr, "Some string other string")); |
91 |
|||
92 |
✓ | 2 |
PString strFlux; |
93 |
✓ | 1 |
strFlux << strAddFluxStr; |
94 |
✓✓✓✓ ✓✓✓ |
1 |
phoenix_assert(checkString("Test << operator PString", strFlux, "Some string other string")); |
95 |
|||
96 |
✓✓ | 1 |
strFlux += std::string(" and the end"); |
97 |
✓✓✓✓ ✓✓✓ |
1 |
phoenix_assert(checkString("Test += operator std::string", strFlux, "Some string other string and the end")); |
98 |
|||
99 |
✓✓ | 1 |
strFlux << std::string("."); |
100 |
✓✓✓✓ ✓✓✓ |
1 |
phoenix_assert(checkString("Test += operator std::string", strFlux, "Some string other string and the end.")); |
101 |
|||
102 |
✓✓ | 1 |
strA << (strFlux << strAddFluxStr); |
103 |
1 |
} |
|
104 |
|||
105 |
1 |
int main(int argc, char** argv){ |
|
106 |
1 |
testPString(); |
|
107 |
1 |
return 0; |
|
108 |
} |
||
109 |
|||
110 |
Generated by: GCOVR (Version 4.2) |