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