Directory: | ./ |
---|---|
File: | tmp_project/PhoenixFileParser/TESTS/TEST_DICO_VALUE/main.cpp |
Date: | 2025-03-14 12:18:05 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 188 | 188 | 100.0% |
Branches: | 377 | 377 | 100.0% |
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 "phoenix_assert.h" | ||
9 | #include "phoenix_check.h" | ||
10 | #include "DicoValue.h" | ||
11 | |||
12 | ///Save the given DicoValue in the given file | ||
13 | /** @param dv : DicoValue to be saved | ||
14 | * @param fileName : name of the file to be saved | ||
15 | * @return true on success, false otherwise | ||
16 | */ | ||
17 | 7 | bool saveDico(const DicoValue & dv, const PPath & fileName){ | |
18 |
10/10✓ Branch 2 taken 7 times.
✓ Branch 5 taken 7 times.
✓ Branch 8 taken 7 times.
✓ Branch 11 taken 7 times.
✓ Branch 14 taken 7 times.
✓ Branch 17 taken 7 times.
✓ Branch 20 taken 7 times.
✓ Branch 23 taken 7 times.
✓ Branch 26 taken 7 times.
✓ Branch 29 taken 7 times.
|
7 | return dv.save(fileName.replace(".txt", ".dico").replace(CMAKE_CURRENT_TEST_DIR, CMAKE_CURRENT_BUILD_DIR)); |
19 | } | ||
20 | |||
21 | ///Check a const DicoValue | ||
22 | /** @param dico : DicoValue | ||
23 | * @return true on success, false otherwise | ||
24 | */ | ||
25 | 1 | bool checkConstDicoValue(const DicoValue & dico){ | |
26 | 1 | bool b(true); | |
27 |
1/1✓ Branch 2 taken 1 times.
|
1 | b &= dico.getMap("NonExistingmap") == NULL; |
28 | 1 | return b; | |
29 | } | ||
30 | |||
31 | ///Test the DicoValue | ||
32 | /** @param fileName : name of the file to be used | ||
33 | * @return true on success, false otherwise | ||
34 | */ | ||
35 | 2 | bool testDicoValue(const PPath & fileName){ | |
36 |
1/1✓ Branch 1 taken 2 times.
|
2 | DicoValue dv; |
37 |
3/3✓ Branch 1 taken 2 times.
✓ Branch 3 taken 1 times.
✓ Branch 4 taken 1 times.
|
2 | if(!dv.load(fileName)){ |
38 |
4/4✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
✓ Branch 7 taken 1 times.
✓ Branch 10 taken 1 times.
|
1 | std::cerr << "testDicoValue : cannot load file '"<<fileName<<"'" << std::endl; |
39 | 1 | return false; | |
40 | } | ||
41 |
1/1✓ Branch 1 taken 1 times.
|
1 | std::vector<DicoValue> & vecChild = dv.getVecChild(); |
42 | |||
43 |
3/3✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
✓ Branch 7 taken 1 times.
|
1 | DicoValue & value = dv.getMapChild()["key"]; |
44 | 1 | bool b(true); | |
45 |
2/2✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
|
1 | b &= dv.getMap("NonExistingmap") == NULL; |
46 |
1/1✓ Branch 1 taken 1 times.
|
1 | b &= checkConstDicoValue(dv); |
47 |
1/1✓ Branch 1 taken 1 times.
|
1 | DicoValue dico; |
48 |
2/2✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
|
1 | dico.setVecChild(dv.getVecChild()); |
49 |
2/2✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
|
1 | dico.setMapChild(dv.getMapChild()); |
50 | |||
51 |
9/9✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
✓ Branch 7 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
✓ Branch 19 taken 1 times.
✓ Branch 23 taken 1 times.
✓ Branch 26 taken 1 times.
|
1 | std::cout << "testDicoValue : value of key : '" << value.getValue() << "' with key '" << value.getKey() << "', vecChild.size = " << vecChild.size() << std::endl; |
52 |
1/1✓ Branch 1 taken 1 times.
|
1 | b &= value.getValue() == "value"; |
53 |
1/1✓ Branch 1 taken 1 times.
|
1 | b &= saveDico(dv, fileName); |
54 | 1 | return b; | |
55 | 2 | } | |
56 | |||
57 | ///Test the value of the given DicoValue | ||
58 | /** @param dv : DicoValue to be checked | ||
59 | * @param expectedValue : expected value | ||
60 | * @return true on success, false otherwise | ||
61 | */ | ||
62 | 3 | bool testDicoValueKey(const DicoValue & dv, int expectedValue){ | |
63 | // std::cout << "testDicoValueKey : key '" << dv.getKey() << "' with value '" << dv.getValue() << "', hasKey = " << dv.hasKey() << "', hasMap = " << dv.hasMap() << "', hasVec = " << dv.hasVec() << std::endl; | ||
64 |
2/2✓ Branch 3 taken 3 times.
✓ Branch 6 taken 3 times.
|
3 | return phoenix_check("testDicoValueKey", dv.getValue<int>(), expectedValue); |
65 | } | ||
66 | |||
67 | ///Test the DicoValue | ||
68 | /** @param fileName : name of the file to be used | ||
69 | * @return true on success, false otherwise | ||
70 | */ | ||
71 | 2 | bool testDicoValue2(const PPath & fileName){ | |
72 |
1/1✓ Branch 1 taken 2 times.
|
2 | DicoValue dv; |
73 |
3/3✓ Branch 1 taken 2 times.
✓ Branch 3 taken 1 times.
✓ Branch 4 taken 1 times.
|
2 | if(!dv.load(fileName)){ |
74 |
4/4✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
✓ Branch 7 taken 1 times.
✓ Branch 10 taken 1 times.
|
1 | std::cerr << "testDicoValue2 : cannot load file '"<<fileName<<"'" << std::endl; |
75 | 1 | return false; | |
76 | } | ||
77 |
4/4✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
✓ Branch 7 taken 1 times.
✓ Branch 10 taken 1 times.
|
1 | bool b(testDicoValueKey(dv.getMapChild()["key1"], 1)); |
78 |
4/4✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
✓ Branch 7 taken 1 times.
✓ Branch 10 taken 1 times.
|
1 | b &= testDicoValueKey(dv.getMapChild()["key2"], 2); |
79 |
4/4✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
✓ Branch 7 taken 1 times.
✓ Branch 10 taken 1 times.
|
1 | b &= testDicoValueKey(dv.getMapChild()["key3"], 3); |
80 |
2/2✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
|
1 | b &= dv.isKeyExist("key3"); |
81 | |||
82 |
1/1✓ Branch 1 taken 1 times.
|
1 | b &= saveDico(dv, fileName); |
83 | 1 | return b; | |
84 | 2 | } | |
85 | |||
86 | ///Test the value of the given DicoValue | ||
87 | /** @param dv : DicoValue to be checked | ||
88 | * @param expectedValue : expected value | ||
89 | * @return true on success, false otherwise | ||
90 | */ | ||
91 | 4 | bool testDicoValueKeyPtr(const DicoValue * dv, int expectedValue){ | |
92 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 3 times.
|
4 | if(dv == NULL){ |
93 | 1 | std::cerr << "testDicoValueKeyPtr : DicoValue for value "<<expectedValue<<" not found!!!" << std::endl; | |
94 | 1 | return false; | |
95 | } | ||
96 | // std::cout << "testDicoValueKeyPtr : key '" << dv->getKey() << "' with value '" << dv->getValue() << "'" << std::endl; | ||
97 | 3 | return dv->getValue<int>() == expectedValue; | |
98 | } | ||
99 | |||
100 | ///Test the DicoValue | ||
101 | /** @param fileName : name of the file to be used | ||
102 | * @return true on success, false otherwise | ||
103 | */ | ||
104 | 2 | bool testDicoValue3(const PPath & fileName){ | |
105 |
1/1✓ Branch 1 taken 2 times.
|
2 | DicoValue dv; |
106 |
3/3✓ Branch 1 taken 2 times.
✓ Branch 3 taken 1 times.
✓ Branch 4 taken 1 times.
|
2 | if(!dv.load(fileName)){ |
107 |
4/4✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
✓ Branch 7 taken 1 times.
✓ Branch 10 taken 1 times.
|
1 | std::cerr << "testDicoValue3 : cannot load file '"<<fileName<<"'" << std::endl; |
108 | 1 | return false; | |
109 | } | ||
110 |
3/3✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
✓ Branch 7 taken 1 times.
|
1 | bool b(testDicoValueKeyPtr(dv.getMap("key1"), 1)); |
111 |
3/3✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
✓ Branch 7 taken 1 times.
|
1 | b &= testDicoValueKeyPtr(dv.getMap("key2"), 2); |
112 |
3/3✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
✓ Branch 7 taken 1 times.
|
1 | b &= testDicoValueKeyPtr(dv.getMap("key3"), 3); |
113 |
1/1✓ Branch 1 taken 1 times.
|
1 | b &= !testDicoValueKeyPtr(NULL, 0); |
114 |
1/1✓ Branch 1 taken 1 times.
|
1 | b &= saveDico(dv, fileName); |
115 | 1 | return b; | |
116 | 2 | } | |
117 | |||
118 | ///Test the value of the given DicoValue | ||
119 | /** @param dv : DicoValue to be checked | ||
120 | * @param expectedValue : expected value | ||
121 | * @return true on success, false otherwise | ||
122 | */ | ||
123 | 8 | bool testDicoVecValueKeyPtr(const DicoValue * dv, int expectedValue){ | |
124 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 7 times.
|
8 | if(dv == NULL){ |
125 | 1 | std::cerr << "testDicoVecValueKeyPtr : DicoValue for value "<<expectedValue<<" not found!!!" << std::endl; | |
126 | 1 | return false; | |
127 | } | ||
128 | 7 | const VecDicoValue & vecVal = dv->getVecChild(); | |
129 |
2/2✓ Branch 1 taken 1 times.
✓ Branch 2 taken 6 times.
|
7 | if(vecVal.size() != 3lu){ |
130 | 1 | std::cerr << "testDicoVecValueKeyPtr : expect 3 value for first value " << expectedValue << std::endl; | |
131 | 1 | return false; | |
132 | } | ||
133 | 6 | bool b(true); | |
134 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 6 times.
|
24 | for(int i(0); i < 3; ++i){ |
135 | 18 | std::cout << "testDicoVecValueKeyPtr : value["<<i<<"] = " << vecVal[i].getValue<int>() << ", expect = " << (i + expectedValue) << std::endl; | |
136 | 18 | b &= vecVal[i].getValue<int>() == expectedValue + i; | |
137 | } | ||
138 | 6 | return b; | |
139 | } | ||
140 | |||
141 | ///Test the DicoValue | ||
142 | /** @param fileName : name of the file to be used | ||
143 | * @return true on success, false otherwise | ||
144 | */ | ||
145 | 2 | bool testDicoVecValue(const PPath & fileName){ | |
146 |
1/1✓ Branch 1 taken 2 times.
|
2 | DicoValue dv; |
147 |
3/3✓ Branch 1 taken 2 times.
✓ Branch 3 taken 1 times.
✓ Branch 4 taken 1 times.
|
2 | if(!dv.load(fileName)){ |
148 |
4/4✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
✓ Branch 7 taken 1 times.
✓ Branch 10 taken 1 times.
|
1 | std::cerr << "testDicoVecValue : cannot load file '"<<fileName<<"'" << std::endl; |
149 | 1 | return false; | |
150 | } | ||
151 |
3/3✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
✓ Branch 7 taken 1 times.
|
1 | bool b(testDicoVecValueKeyPtr(dv.getMap("key1"), 1)); |
152 |
3/3✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
✓ Branch 7 taken 1 times.
|
1 | b &= testDicoVecValueKeyPtr(dv.getMap("key2"), 2); |
153 |
3/3✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
✓ Branch 7 taken 1 times.
|
1 | b &= testDicoVecValueKeyPtr(dv.getMap("key3"), 3); |
154 |
1/1✓ Branch 1 taken 1 times.
|
1 | b &= saveDico(dv, fileName); |
155 | 1 | return b; | |
156 | 2 | } | |
157 | |||
158 | ///Test the DicoValue | ||
159 | /** @param fileName : name of the file to be used | ||
160 | * @return true on success, false otherwise | ||
161 | */ | ||
162 | 2 | bool testDicoVecString(const PPath & fileName){ | |
163 |
1/1✓ Branch 1 taken 2 times.
|
2 | DicoValue dv; |
164 |
3/3✓ Branch 1 taken 2 times.
✓ Branch 3 taken 1 times.
✓ Branch 4 taken 1 times.
|
2 | if(!dv.load(fileName)){ |
165 |
4/4✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
✓ Branch 7 taken 1 times.
✓ Branch 10 taken 1 times.
|
1 | std::cerr << "testDicoVecString : cannot load file '"<<fileName<<"'" << std::endl; |
166 | 1 | return false; | |
167 | } | ||
168 |
3/3✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
✓ Branch 7 taken 1 times.
|
1 | bool b(testDicoVecValueKeyPtr(dv.getMap("key1"), 1)); |
169 |
3/3✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
✓ Branch 7 taken 1 times.
|
1 | b &= testDicoVecValueKeyPtr(dv.getMap("key2"), 2); |
170 |
3/3✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
✓ Branch 7 taken 1 times.
|
1 | b &= testDicoVecValueKeyPtr(dv.getMap("key3"), 3); |
171 | |||
172 |
1/1✓ Branch 1 taken 1 times.
|
1 | b &= !testDicoVecValueKeyPtr(NULL, 0); |
173 |
1/1✓ Branch 1 taken 1 times.
|
1 | DicoValue val; |
174 |
1/1✓ Branch 1 taken 1 times.
|
1 | b &= !testDicoVecValueKeyPtr(&val, 0); |
175 | |||
176 |
1/1✓ Branch 1 taken 1 times.
|
1 | b &= saveDico(dv, fileName); |
177 | 1 | return b; | |
178 | 2 | } | |
179 | |||
180 | ///Test the value of the given DicoValue | ||
181 | /** @param dv : DicoValue to be checked | ||
182 | * @param expectedValue : expected value | ||
183 | * @return true on success, false otherwise | ||
184 | */ | ||
185 | 18 | bool testDicoValueKey(const DicoValue * dv, int expectedValue){ | |
186 |
2/2✓ Branch 3 taken 18 times.
✓ Branch 6 taken 18 times.
|
18 | return phoenix_check("testDicoValueKey", dv->getValue<int>(), expectedValue); |
187 | } | ||
188 | |||
189 | ///Test the value of the given DicoValue | ||
190 | /** @param dv : DicoValue to be checked | ||
191 | * @param expectedValue : expected value | ||
192 | * @return true on success, false otherwise | ||
193 | */ | ||
194 | 10 | bool testDicoDicoValueKeyPtr(const DicoValue * dv, int expectedValue){ | |
195 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 8 times.
|
10 | if(dv == NULL){ |
196 | 2 | std::cerr << "testDicoDicoValueKeyPtr : DicoValue for value "<<expectedValue<<" not found!!!" << std::endl; | |
197 | 2 | return false; | |
198 | } | ||
199 | 8 | const MapDicoValue & mapVal = dv->getMapChild(); | |
200 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 2 taken 6 times.
|
8 | if(mapVal.size() != 3lu){ |
201 | 2 | std::cerr << "testDicoDicoValueKeyPtr : expect 3 value for first value " << expectedValue << std::endl; | |
202 | 2 | return false; | |
203 | } | ||
204 | 6 | bool b(true); | |
205 |
2/2✓ Branch 2 taken 6 times.
✓ Branch 5 taken 6 times.
|
6 | b &= testDicoValueKey(dv->getMap("val1"), expectedValue); |
206 |
2/2✓ Branch 2 taken 6 times.
✓ Branch 5 taken 6 times.
|
6 | b &= testDicoValueKey(dv->getMap("val2"), 1 + expectedValue); |
207 |
2/2✓ Branch 2 taken 6 times.
✓ Branch 5 taken 6 times.
|
6 | b &= testDicoValueKey(dv->getMap("val3"), 2 + expectedValue); |
208 | 6 | return b; | |
209 | } | ||
210 | |||
211 | ///Test the DicoValue | ||
212 | /** @param fileName : name of the file to be used | ||
213 | * @return true on success, false otherwise | ||
214 | */ | ||
215 | 3 | bool testDicoDicoString(const PPath & fileName){ | |
216 |
1/1✓ Branch 1 taken 3 times.
|
3 | DicoValue dv; |
217 |
3/3✓ Branch 1 taken 3 times.
✓ Branch 3 taken 1 times.
✓ Branch 4 taken 2 times.
|
3 | if(!dv.load(fileName)){ |
218 |
4/4✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
✓ Branch 7 taken 1 times.
✓ Branch 10 taken 1 times.
|
1 | std::cerr << "testDicoDicoString : cannot load file '"<<fileName<<"'" << std::endl; |
219 | 1 | return false; | |
220 | } | ||
221 |
3/3✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
|
2 | bool b(testDicoDicoValueKeyPtr(dv.getMap("key1"), 1)); |
222 |
3/3✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
|
2 | b &= testDicoDicoValueKeyPtr(dv.getMap("key2"), 2); |
223 |
3/3✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
|
2 | b &= testDicoDicoValueKeyPtr(dv.getMap("key3"), 3); |
224 | |||
225 |
1/1✓ Branch 1 taken 2 times.
|
2 | b &= !testDicoDicoValueKeyPtr(NULL, 0); |
226 |
1/1✓ Branch 1 taken 2 times.
|
2 | DicoValue val; |
227 |
1/1✓ Branch 1 taken 2 times.
|
2 | b &= !testDicoDicoValueKeyPtr(&val, 0); |
228 | |||
229 |
1/1✓ Branch 1 taken 2 times.
|
2 | b &= saveDico(dv, fileName); |
230 | 2 | return b; | |
231 | 3 | } | |
232 | |||
233 | ///Check all the good parsing | ||
234 | /** @param fileContent : wrong file content | ||
235 | * @return true on success, false otherwise | ||
236 | */ | ||
237 | 2 | bool testDicoGoodParsing(const PString & fileContent){ | |
238 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | PPath fileName("config.txt"); |
239 | 2 | bool b(true); | |
240 |
1/1✓ Branch 1 taken 2 times.
|
2 | b &= fileName.saveFileContent(fileContent); |
241 |
1/1✓ Branch 1 taken 2 times.
|
2 | DicoValue dico; |
242 |
1/1✓ Branch 1 taken 2 times.
|
2 | b &= dico.load(fileName); |
243 | 2 | return b; | |
244 | 2 | } | |
245 | |||
246 | ///Check all the bad parsing | ||
247 | /** @param fileContent : wrong file content | ||
248 | * @return true on success, false otherwise | ||
249 | */ | ||
250 | 5 | bool testDicoBadParsing(const PString & fileContent){ | |
251 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | PPath fileName("config.txt"); |
252 | 5 | bool b(true); | |
253 |
1/1✓ Branch 1 taken 5 times.
|
5 | b &= fileName.saveFileContent(fileContent); |
254 |
1/1✓ Branch 1 taken 5 times.
|
5 | DicoValue dico; |
255 |
1/1✓ Branch 1 taken 5 times.
|
5 | b &= !dico.load(fileName); |
256 | 5 | return b; | |
257 | 5 | } | |
258 | |||
259 | ///Check all the bad parsing | ||
260 | /** @param fileContent : wrong file content | ||
261 | * @return true on success, false otherwise | ||
262 | */ | ||
263 | 3 | bool testDicoSaveParsing(const PString & fileContent){ | |
264 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
3 | PPath fileName("config_out.txt"); |
265 | 3 | bool b(true); | |
266 |
1/1✓ Branch 1 taken 3 times.
|
3 | DicoValue dico; |
267 |
1/1✓ Branch 1 taken 3 times.
|
3 | dico.setValue(fileContent); |
268 |
4/4✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 7 taken 3 times.
✓ Branch 10 taken 3 times.
|
3 | b &= dico.save(fileName); |
269 | 3 | return b; | |
270 | 3 | } | |
271 | |||
272 | ///Test JSON to JSON convertion | ||
273 | 1 | void testFromJSonToJSon(){ | |
274 |
2/2✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
|
1 | PPath fileName(CMAKE_CURRENT_TEST_DIR "/testInputDicoMapDico.json"); |
275 | |||
276 |
1/1✓ Branch 1 taken 1 times.
|
1 | DicoValue dv; |
277 |
5/5✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
|
1 | phoenix_assert(dv.load(fileName)); |
278 |
9/9✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
✓ Branch 19 taken 1 times.
✓ Branch 22 taken 1 times.
✓ Branch 25 taken 1 times.
✓ Branch 28 taken 1 times.
|
1 | phoenix_assert(dv.save(fileName.getFileName(), "\"")); |
279 | |||
280 |
1/1✓ Branch 1 taken 1 times.
|
1 | DicoValue compact; |
281 |
6/6✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
✓ Branch 19 taken 1 times.
|
1 | phoenix_assert(compact.fromString("{\"key1\": \"1\", \"key2\": \"2\", \"key3\": \"3\" }")); |
282 |
11/11✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 14 taken 1 times.
✓ Branch 17 taken 1 times.
✓ Branch 20 taken 1 times.
✓ Branch 23 taken 1 times.
✓ Branch 26 taken 1 times.
✓ Branch 30 taken 1 times.
✓ Branch 33 taken 1 times.
✓ Branch 36 taken 1 times.
|
1 | phoenix_assert(phoenix_check("Test compact JSON", compact.toString("\"", "", ""), "{\"key1\": \"1\",\"key2\": \"2\",\"key3\": \"3\"}")); |
283 | 1 | } | |
284 | |||
285 | 1 | int main(int argc, char** argv){ | |
286 |
2/2✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
|
1 | PPath fileName0(CMAKE_CURRENT_TEST_DIR "/testInputDico.txt"); |
287 | |||
288 |
5/5✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
|
1 | phoenix_assert(testDicoValue(fileName0)); |
289 |
8/8✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
✓ Branch 19 taken 1 times.
✓ Branch 22 taken 1 times.
✓ Branch 25 taken 1 times.
|
1 | phoenix_assert(!testDicoValue(PString(fileName0 + "whichDoesnotExist"))); |
290 | |||
291 |
2/2✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
|
1 | PPath fileName2(CMAKE_CURRENT_TEST_DIR "/testInputDicoValue.txt"); |
292 |
5/5✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
|
1 | phoenix_assert(testDicoValue2(fileName2)); |
293 |
8/8✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
✓ Branch 19 taken 1 times.
✓ Branch 22 taken 1 times.
✓ Branch 25 taken 1 times.
|
1 | phoenix_assert(!testDicoValue2(PString(fileName2 + "whichDoesnotExist"))); |
294 | |||
295 |
2/2✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
|
1 | PPath fileName3(CMAKE_CURRENT_TEST_DIR "/testInputDicoValue.txt"); |
296 |
5/5✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
|
1 | phoenix_assert(testDicoValue3(fileName3)); |
297 |
8/8✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
✓ Branch 19 taken 1 times.
✓ Branch 22 taken 1 times.
✓ Branch 25 taken 1 times.
|
1 | phoenix_assert(!testDicoValue3(PString(fileName3 + "whichDoesnotExist"))); |
298 | |||
299 |
2/2✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
|
1 | PPath fileNameVec(CMAKE_CURRENT_TEST_DIR "/testInputDicoVecValue.txt"); |
300 |
5/5✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
|
1 | phoenix_assert(testDicoVecValue(fileNameVec)); |
301 |
8/8✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
✓ Branch 19 taken 1 times.
✓ Branch 22 taken 1 times.
✓ Branch 25 taken 1 times.
|
1 | phoenix_assert(!testDicoVecValue(PString(fileNameVec + "whichDoesnotExist"))); |
302 | |||
303 |
2/2✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
|
1 | PPath fileNameVecString(CMAKE_CURRENT_TEST_DIR "/testInputDicoVecString.txt"); |
304 |
5/5✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
|
1 | phoenix_assert(testDicoVecString(fileNameVecString)); |
305 |
8/8✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
✓ Branch 19 taken 1 times.
✓ Branch 22 taken 1 times.
✓ Branch 25 taken 1 times.
|
1 | phoenix_assert(!testDicoVecString(PString(fileNameVecString + "whichDoesnotExist"))); |
306 | |||
307 |
2/2✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
|
1 | PPath fileNameDicoString(CMAKE_CURRENT_TEST_DIR "/testInputDicoMapDico.txt"); |
308 |
5/5✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
|
1 | phoenix_assert(testDicoDicoString(fileNameDicoString)); |
309 |
8/8✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
✓ Branch 19 taken 1 times.
✓ Branch 22 taken 1 times.
✓ Branch 25 taken 1 times.
|
1 | phoenix_assert(!testDicoDicoString(PString(fileNameDicoString + "whichDoesnotExist"))); |
310 | |||
311 | //Test with a JSON | ||
312 |
7/7✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
✓ Branch 19 taken 1 times.
✓ Branch 22 taken 1 times.
|
1 | phoenix_assert(testDicoDicoString(PPath(CMAKE_CURRENT_TEST_DIR "/testInputDicoMapDico.json"))); |
313 | |||
314 |
6/6✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
✓ Branch 19 taken 1 times.
|
1 | phoenix_assert(testDicoBadParsing("")); |
315 |
6/6✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
✓ Branch 19 taken 1 times.
|
1 | phoenix_assert(testDicoGoodParsing("42")); |
316 |
6/6✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
✓ Branch 19 taken 1 times.
|
1 | phoenix_assert(testDicoGoodParsing("key other")); |
317 |
6/6✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
✓ Branch 19 taken 1 times.
|
1 | phoenix_assert(testDicoBadParsing("{ key1 {")); |
318 |
6/6✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
✓ Branch 19 taken 1 times.
|
1 | phoenix_assert(testDicoBadParsing("{ {")); |
319 |
6/6✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
✓ Branch 19 taken 1 times.
|
1 | phoenix_assert(testDicoBadParsing("{ °")); |
320 |
6/6✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
✓ Branch 19 taken 1 times.
|
1 | phoenix_assert(testDicoBadParsing("{ key1: °")); |
321 |
6/6✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
✓ Branch 19 taken 1 times.
|
1 | phoenix_assert(testDicoSaveParsing("Just some text")); |
322 |
6/6✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
✓ Branch 19 taken 1 times.
|
1 | phoenix_assert(testDicoSaveParsing("Just some text\nwith new line")); |
323 |
6/6✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
✓ Branch 19 taken 1 times.
|
1 | phoenix_assert(testDicoSaveParsing("Just some text with spécial char/")); |
324 |
1/1✓ Branch 1 taken 1 times.
|
1 | testFromJSonToJSon(); |
325 | 1 | return 0; | |
326 | 1 | } | |
327 | |||
328 | |||
329 |