GCC Code Coverage Report


Directory: ./
File: tmp_project/PhoenixYml/TESTS/TEST_PARSER_YML/main.cpp
Date: 2025-03-27 14:50:11
Exec Total Coverage
Lines: 131 131 100.0%
Branches: 304 308 98.7%

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 "parser_yml.h"
10
11 ///Check the value of a DicoValue
12 /** @param mapKey : DicoValue to be checked
13 * @param expectedValue : expected value
14 * @return true if the value matches the expectedValue, false otherwise
15 */
16 14 bool checkKeyMapValue(const DicoValue * mapKey, const std::string & expectedValue){
17
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 13 times.
14 if(mapKey == NULL){
18 1 std::cout << "checkKeyMapValue : map NULL for expectedValue = '"<<expectedValue<<"'" << std::endl;
19 1 return expectedValue == "";
20 }
21 // std::cout << "checkKeyMapValue : map '"<<mapKey->getKey()<<"' => '"<<mapKey->getValue()<<"', expectedValue = '"<<expectedValue<<"'" << std::endl;
22 13 bool b(mapKey->getValue() == expectedValue);
23 // std::cout << "checkKeyMapValue : b = " << b << std::endl;
24 13 return b;
25 }
26
27 ///Check the value of a DicoValue
28 /** @param mapKey : DicoValue to be checked
29 * @param expectedValue : expected value
30 * @return true if the value matches the expectedValue, false otherwise
31 */
32 7 bool checkKeyMapVecValue(const DicoValue * mapKey, const std::vector<std::string> & vecExpectedValue){
33
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 6 times.
7 if(mapKey == NULL){
34
2/2
✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
1 std::cout << "checkKeyMapVecValue : map NULL for vecExpectedValue = " << std::endl;
35 // phoenix_print(vecExpectedValue);
36 1 return vecExpectedValue.size() == 0lu;
37 }
38 // std::cout << "checkKeyMapVecValue : map '"<<mapKey->getKey()<<"' => '"<<mapKey->getValue()<<"', vecExpectedValue = " << std::endl;
39 // phoenix_print(vecExpectedValue);
40 6 bool b(true);
41
1/1
✓ Branch 1 taken 6 times.
6 const VecDicoValue & vecValue = mapKey->getVecChild();
42 6 b &= vecValue.size() == vecExpectedValue.size();
43 // std::cout << "checkKeyMapVecValue : vecValue.size() = " << vecValue.size() << ", vecExpectedValue.size() = "<< vecExpectedValue.size() << ", isOk = " << b << std::endl;
44 6 VecDicoValue::const_iterator it(vecValue.begin());
45 6 std::vector<std::string>::const_iterator itRef(vecExpectedValue.begin());
46
6/8
✓ Branch 0 taken 27 times.
✗ Branch 1 not taken.
✓ Branch 4 taken 21 times.
✓ Branch 5 taken 6 times.
✓ Branch 8 taken 21 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 21 times.
✓ Branch 11 taken 6 times.
27 while(b && it != vecValue.end() && itRef != vecExpectedValue.end()){
47
1/1
✓ Branch 3 taken 21 times.
21 b &= it->getValue() == *itRef;
48 // std::cout << "\tvalue = '" << it->getValue() << "', reference = '"<< *itRef << "', isOk = " << b << std::endl;
49 21 ++it;
50 21 ++itRef;
51 }
52 // std::cout << "checkKeyMapVecValue : b = " << b << std::endl;
53 6 return b;
54 }
55
56 ///Call the check value with NULL pointers
57 1 void testCheckValue(){
58
2/2
✓ Branch 2 taken 1 times.
✓ Branch 5 taken 1 times.
1 checkKeyMapValue(NULL, "");
59 1 std::vector<std::string> vecNoValue;
60
1/1
✓ Branch 1 taken 1 times.
1 checkKeyMapVecValue(NULL, vecNoValue);
61 1 }
62
63 ///Check the YML parser
64 1 void checkParserYml(){
65
1/1
✓ Branch 1 taken 1 times.
1 PString fileContent("key: value\nother_key: \"some string in double quotes\"\n\nthird_key: 'now we use simple quotes'\n\n\nfourth_key: finally we used nothing to fill the value of this key\n\n\n");
66
2/2
✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
1 PPath ymlFile("test.yml");
67
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(ymlFile.saveFileContent(fileContent));
68
69
1/1
✓ Branch 1 taken 1 times.
1 DicoValue dico;
70
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(parser_yml(dico, ymlFile));
71 // std::cout << "checkParserYml : output DicoValue :" << std::endl;
72 // dico.print();
73
74
2/2
✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
1 DicoValue * mapKey = dico.getMap("key");
75 // bool isKeyExist = mapKey != NULL;
76 // std::cout << "checkParserYml : isKeyExist = " << isKeyExist << std::endl;
77
6/6
✓ 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.
1 phoenix_assert(checkKeyMapValue(mapKey, "value"));
78
79
2/2
✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
1 DicoValue * mapOtherKey = dico.getMap("other_key");
80 // bool isOtherKeyExist = mapOtherKey != NULL;
81 // std::cout << "checkParserYml : isOtherKeyExist = " << isOtherKeyExist << std::endl;
82
6/6
✓ 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.
1 phoenix_assert(checkKeyMapValue(mapOtherKey, "\"some string in double quotes\""));
83
84
2/2
✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
1 DicoValue * mapThirdKey = dico.getMap("third_key");
85 // bool isThirdKeyExist = mapThirdKey != NULL;
86 // std::cout << "checkParserYml : isThirdKeyExist = " << isThirdKeyExist << std::endl;
87
6/6
✓ 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.
1 phoenix_assert(checkKeyMapValue(mapThirdKey, "'now we use simple quotes'"));
88
89
2/2
✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
1 DicoValue * mapFourthKey = dico.getMap("fourth_key");
90 // bool isFourthKeyExist = mapFourthKey != NULL;
91 // std::cout << "checkParserYml : isFourthKeyExist = " << isFourthKeyExist << std::endl;
92
6/6
✓ 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.
1 phoenix_assert(checkKeyMapValue(mapFourthKey, "finally we used nothing to fill the value of this key"));
93
94
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 23 taken 1 times.
1 phoenix_assert(phoenix_get_string(dico, "key", "default") == "value");
95
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 23 taken 1 times.
1 phoenix_assert(phoenix_get_string(dico, "unexistingkey", "default") == "default");
96
97
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(phoenix_load_value_from_config<bool>(dico, "key", false) == false);
98
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(phoenix_load_value_from_config<bool>(dico, "unexistingkey", false) == false);
99 1 }
100
101 ///Check the embeded dico
102 1 void checkEmbededDico(){
103
1/1
✓ Branch 1 taken 1 times.
1 PString fileContent("main:\n\tsub_key: VALUE\n\tother_sub_key: \"some string in double quotes\"\n\nnot_in_main_key: VALUE_IN_UPPERCASE\n\n\n");
104
105
2/2
✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
1 PPath ymlFile("test_embeded_dico.yml");
106
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(ymlFile.saveFileContent(fileContent));
107
1/1
✓ Branch 1 taken 1 times.
1 DicoValue dico;
108
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(parser_yml(dico, ymlFile));
109 // std::cout << "checkEmbededDico : output DicoValue :" << std::endl;
110 // dico.print();
111
112 // MapDicoValue & mapChld = dico.getMapChild();
113 // std::cerr << "checkEmbededDico : nb key = " << mapChld.size() << std::endl;
114 // for(MapDicoValue::iterator it(mapChld.begin()); it != mapChld.end(); ++it){
115 // std::cerr << "\tkey '"<<it->first<<"'" << std::endl;
116 // }
117
2/2
✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
1 DicoValue * mapMain = dico.getMap("main");
118 // std::cout << "checkEmbededDico : mapMain = " << mapMain << std::endl;
119
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 if(mapMain != NULL){
120
2/2
✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
1 DicoValue * mapSubKey = mapMain->getMap("sub_key");
121
6/6
✓ 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.
1 phoenix_assert(checkKeyMapValue(mapSubKey, "VALUE"));
122
2/2
✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
1 DicoValue * mapOtherSubKey = mapMain->getMap("other_sub_key");
123
6/6
✓ 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.
1 phoenix_assert(checkKeyMapValue(mapOtherSubKey, "\"some string in double quotes\""));
124 }
125
4/4
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
1 phoenix_assert(mapMain != NULL);
126
127
2/2
✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
1 DicoValue * mapNotInMainKey = dico.getMap("not_in_main_key");
128 // bool isNotInMainKeyExist = mapNotInMainKey != NULL;
129 // std::cout << "checkEmbededDico : isNotInMainKeyExist = " << isNotInMainKeyExist << std::endl;
130
6/6
✓ 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.
1 phoenix_assert(checkKeyMapValue(mapNotInMainKey, "VALUE_IN_UPPERCASE"));
131 1 }
132
133 ///Check the embeded dico
134 1 void checkCompactList(){
135
1/1
✓ Branch 1 taken 1 times.
1 PString fileContent("some_list: [one, two, three]\nother_key: VALUE_IN_UPPERCASE\nother_list: [\"value in double quotes\",'value in simple quote', \"value 2 in double quotes\", 'value 2 in simple quote']\n\n");
136
137
2/2
✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
1 PPath ymlFile("test_compact_list.yml");
138
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(ymlFile.saveFileContent(fileContent));
139
1/1
✓ Branch 1 taken 1 times.
1 DicoValue dico;
140
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(parser_yml(dico, ymlFile));
141 // std::cout << "checkCompactList : output DicoValue :" << std::endl;
142 // dico.print();
143
144
2/2
✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
1 DicoValue * mapSomeListKey = dico.getMap("some_list");
145 // bool isSomeListExist = mapSomeListKey != NULL;
146 // std::cout << "checkCompactList : isSomeListExist = " << isSomeListExist << std::endl;
147
148 1 std::vector<std::string> vecExpectedValue;
149
2/2
✓ Branch 2 taken 1 times.
✓ Branch 5 taken 1 times.
1 vecExpectedValue.push_back("one");
150
2/2
✓ Branch 2 taken 1 times.
✓ Branch 5 taken 1 times.
1 vecExpectedValue.push_back("two");
151
2/2
✓ Branch 2 taken 1 times.
✓ Branch 5 taken 1 times.
1 vecExpectedValue.push_back("three");
152
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(checkKeyMapVecValue(mapSomeListKey, vecExpectedValue));
153
154
2/2
✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
1 DicoValue * mapOtherKey = dico.getMap("other_key");
155 // bool isOtherKeyExist = mapOtherKey != NULL;
156 // std::cout << "checkCompactList : isOtherKeyExist = " << isOtherKeyExist << std::endl;
157
6/6
✓ 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.
1 phoenix_assert(checkKeyMapValue(mapOtherKey, "VALUE_IN_UPPERCASE"));
158
159
2/2
✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
1 DicoValue * mapOtherListKey = dico.getMap("other_list");
160
4/4
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
1 phoenix_assert(mapOtherListKey != NULL);
161
162 1 std::vector<std::string> vecOtherExpectedValue;
163
2/2
✓ Branch 2 taken 1 times.
✓ Branch 5 taken 1 times.
1 vecOtherExpectedValue.push_back("\"value in double quotes\"");
164
2/2
✓ Branch 2 taken 1 times.
✓ Branch 5 taken 1 times.
1 vecOtherExpectedValue.push_back("'value in simple quote'");
165
2/2
✓ Branch 2 taken 1 times.
✓ Branch 5 taken 1 times.
1 vecOtherExpectedValue.push_back("\"value 2 in double quotes\"");
166
2/2
✓ Branch 2 taken 1 times.
✓ Branch 5 taken 1 times.
1 vecOtherExpectedValue.push_back("'value 2 in simple quote'");
167
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(checkKeyMapVecValue(mapOtherListKey, vecOtherExpectedValue));
168 1 }
169
170 ///Check the embeded dico
171 /** @param fileNameYml : file name to be written
172 * @param contentYml : content of the file to be written
173 */
174 2 void checkDashedList(const PPath & fileNameYml, const PString & contentYml){
175
5/5
✓ Branch 2 taken 2 times.
✓ Branch 6 taken 2 times.
✓ Branch 10 taken 2 times.
✓ Branch 13 taken 2 times.
✓ Branch 16 taken 2 times.
2 phoenix_assert(fileNameYml.saveFileContent(contentYml));
176
1/1
✓ Branch 1 taken 2 times.
2 DicoValue dico;
177
5/5
✓ Branch 2 taken 2 times.
✓ Branch 6 taken 2 times.
✓ Branch 10 taken 2 times.
✓ Branch 13 taken 2 times.
✓ Branch 16 taken 2 times.
2 phoenix_assert(parser_yml(dico, fileNameYml));
178 // std::cout << "checkDashedList : output DicoValue :" << std::endl;
179 // dico.print();
180
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 DicoValue * mapSomeListKey = dico.getMap("some_list");
181 // bool isSomeListExist = mapSomeListKey != NULL;
182 // std::cout << "checkDashedList : isSomeListExist = " << isSomeListExist << std::endl;
183
184 2 std::vector<std::string> vecExpectedValue;
185
2/2
✓ Branch 2 taken 2 times.
✓ Branch 5 taken 2 times.
2 vecExpectedValue.push_back("one");
186
2/2
✓ Branch 2 taken 2 times.
✓ Branch 5 taken 2 times.
2 vecExpectedValue.push_back("two");
187
2/2
✓ Branch 2 taken 2 times.
✓ Branch 5 taken 2 times.
2 vecExpectedValue.push_back("three");
188
5/5
✓ Branch 2 taken 2 times.
✓ Branch 6 taken 2 times.
✓ Branch 10 taken 2 times.
✓ Branch 13 taken 2 times.
✓ Branch 16 taken 2 times.
2 phoenix_assert(checkKeyMapVecValue(mapSomeListKey, vecExpectedValue));
189
190
6/6
✓ Branch 2 taken 2 times.
✓ Branch 6 taken 2 times.
✓ Branch 10 taken 2 times.
✓ Branch 13 taken 2 times.
✓ Branch 16 taken 2 times.
✓ Branch 20 taken 2 times.
2 phoenix_assert(phoenix_get_vecstring(dico, "some_unexisting_list").size() == 0lu);
191
6/6
✓ Branch 2 taken 2 times.
✓ Branch 6 taken 2 times.
✓ Branch 10 taken 2 times.
✓ Branch 13 taken 2 times.
✓ Branch 16 taken 2 times.
✓ Branch 20 taken 2 times.
2 phoenix_assert(phoenix_get_vecstring(dico, "some_list").size() == 3lu);
192
6/6
✓ Branch 2 taken 2 times.
✓ Branch 6 taken 2 times.
✓ Branch 10 taken 2 times.
✓ Branch 13 taken 2 times.
✓ Branch 16 taken 2 times.
✓ Branch 20 taken 2 times.
2 phoenix_assert(phoenix_load_vecValue_from_config<std::string>(dico, "some_list").size() == 3lu);
193
194
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 DicoValue * mapOtherKey = dico.getMap("other_key");
195 // bool isOtherKeyExist = mapOtherKey != NULL;
196 // std::cout << "checkDashedList : isOtherKeyExist = " << isOtherKeyExist << std::endl;
197
6/6
✓ Branch 2 taken 2 times.
✓ Branch 6 taken 2 times.
✓ Branch 10 taken 2 times.
✓ Branch 14 taken 2 times.
✓ Branch 17 taken 2 times.
✓ Branch 20 taken 2 times.
2 phoenix_assert(checkKeyMapValue(mapOtherKey, "VALUE_IN_UPPERCASE"));
198
199
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 DicoValue * mapOtherListKey = dico.getMap("other_list");
200 // bool isOtherListExist = mapOtherListKey != NULL;
201 // std::cout << "checkDashedList : isOtherListExist = " << isOtherListExist << std::endl;
202
203 2 std::vector<std::string> vecOtherExpectedValue;
204
2/2
✓ Branch 2 taken 2 times.
✓ Branch 5 taken 2 times.
2 vecOtherExpectedValue.push_back("\"value in double quotes\"");
205
2/2
✓ Branch 2 taken 2 times.
✓ Branch 5 taken 2 times.
2 vecOtherExpectedValue.push_back("'value in simple quote'");
206
2/2
✓ Branch 2 taken 2 times.
✓ Branch 5 taken 2 times.
2 vecOtherExpectedValue.push_back("\"value 2 in double quotes\"");
207
2/2
✓ Branch 2 taken 2 times.
✓ Branch 5 taken 2 times.
2 vecOtherExpectedValue.push_back("'value 2 in simple quote'");
208
5/5
✓ Branch 2 taken 2 times.
✓ Branch 6 taken 2 times.
✓ Branch 10 taken 2 times.
✓ Branch 13 taken 2 times.
✓ Branch 16 taken 2 times.
2 phoenix_assert(checkKeyMapVecValue(mapOtherListKey, vecOtherExpectedValue));
209 2 }
210
211 ///Check the embeded dico
212 1 void checkCompactDico(){
213
1/1
✓ Branch 1 taken 1 times.
1 PString fileContent("main:{\n\tsub_key: VALUE,\n\tother_sub_key: \"some string in double quotes\"\n}\nnot_in_main_key: VALUE_IN_UPPERCASE\n\n\n");
214
215
2/2
✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
1 PPath ymlFile("test_compact_dico.yml");
216
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(ymlFile.saveFileContent(fileContent));
217
1/1
✓ Branch 1 taken 1 times.
1 DicoValue dico;
218
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(parser_yml(dico, ymlFile));
219 // std::cout << "checkCompactDico : output DicoValue :" << std::endl;
220 // dico.print();
221
222 // MapDicoValue & mapChld = dico.getMapChild();
223 // std::cerr << "checkCompphoenix_assertactDico : nb key = " << mapChld.size() << std::endl;
224 // for(MapDicoValue::iterator it(mapChld.begin()); it != mapChld.end(); ++it){
225 // std::cerr << "\tkey '"<<it->first<<"'" << std::endl;
226 // }
227
228
2/2
✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
1 DicoValue * mapMain = dico.getMap("main");
229 // std::cout << "checkCompactDico : mapMain = " << mapMain << std::endl;
230
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 if(mapMain != NULL){
231
2/2
✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
1 DicoValue * mapSubKey = mapMain->getMap("sub_key");
232
6/6
✓ 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.
1 phoenix_assert(checkKeyMapValue(mapSubKey, "VALUE"));
233
2/2
✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
1 DicoValue * mapOtherSubKey = mapMain->getMap("other_sub_key");
234
6/6
✓ 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.
1 phoenix_assert(checkKeyMapValue(mapOtherSubKey, "\"some string in double quotes\""));
235 }
236
4/4
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
1 phoenix_assert(mapMain != NULL);
237
238
2/2
✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
1 DicoValue * mapNotInMainKey = dico.getMap("not_in_main_key");
239 // bool isNotInMainKeyExist = mapNotInMainKey != NULL;
240 // std::cout << "checkCompactDico : isNotInMainKeyExist = " << isNotInMainKeyExist << std::endl;
241
6/6
✓ 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.
1 phoenix_assert(checkKeyMapValue(mapNotInMainKey, "VALUE_IN_UPPERCASE"));
242 1 }
243
244 1 int main(int argc, char** argv){
245 1 testCheckValue();
246 1 checkParserYml();
247 1 checkEmbededDico();
248 1 checkCompactList();
249
3/3
✓ Branch 2 taken 1 times.
✓ Branch 5 taken 1 times.
✓ Branch 8 taken 1 times.
1 checkDashedList(PPath("test_dashed_list.yml"), "some_list:\n\t- one\n\t- two\n\t- three\nother_key: VALUE_IN_UPPERCASE\nother_list:\n\t- \"value in double quotes\"\n\t- 'value in simple quote'\n\t- \"value 2 in double quotes\"\n\t- 'value 2 in simple quote'\n\n");
250
3/3
✓ Branch 2 taken 1 times.
✓ Branch 5 taken 1 times.
✓ Branch 8 taken 1 times.
1 checkDashedList(PPath("test_dashed_list_noIndent.yml"), "some_list:\n- one\n- two\n- three\nother_key: VALUE_IN_UPPERCASE\nother_list:\n\t- \"value in double quotes\"\n\t- 'value in simple quote'\n\t- \"value 2 in double quotes\"\n\t- 'value 2 in simple quote'\n\n");
251 1 checkCompactDico();
252 1 return 0;
253 }
254
255
256