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 "parse_generic_string.h" | ||
11 | |||
12 | ///Check the generic string parser | ||
13 | /** @param name : name of the test | ||
14 | * @param fileContent : file to be parsed | ||
15 | * @param isParsingOk : true if the parsing is expected to be OK | ||
16 | * @param expectedParsedString : expected string after parsing | ||
17 | * @return true on success, false otherwise | ||
18 | */ | ||
19 | 5 | bool checkParser(const PString & name, const PString & fileContent, bool isParsingOk, const PString & expectedParsedString){ | |
20 |
1/1✓ Branch 0 (2→3) taken 5 times.
|
5 | PFileParser parser; |
21 |
1/1✓ Branch 0 (3→4) taken 5 times.
|
5 | parser.setFileContent(fileContent); |
22 |
1/1✓ Branch 0 (4→5) taken 5 times.
|
5 | PString foundString; |
23 |
5/5✓ Branch 0 (7→8) taken 5 times.
✓ Branch 2 (10→11) taken 5 times.
✓ Branch 4 (13→14) taken 5 times.
✓ Branch 6 (14→15) taken 5 times.
✓ Branch 8 (15→16) taken 5 times.
|
25 | phoenix_assert(parse_generic_string(foundString, parser) == isParsingOk); |
24 |
2/2✓ Branch 0 (22→23) taken 4 times.
✓ Branch 1 (22→25) taken 1 times.
|
5 | if(isParsingOk){ |
25 |
1/1✓ Branch 0 (23→24) taken 4 times.
|
4 | return phoenix_check(name, foundString, expectedParsedString); |
26 | }else{ | ||
27 | 1 | return true; | |
28 | } | ||
29 | 5 | } | |
30 | |||
31 | ///Check the PLocation | ||
32 | 1 | void checkParseGenericString(){ | |
33 |
8/8✓ Branch 0 (4→5) taken 1 times.
✓ Branch 2 (7→8) taken 1 times.
✓ Branch 4 (10→11) taken 1 times.
✓ Branch 6 (11→12) taken 1 times.
✓ Branch 8 (12→13) taken 1 times.
✓ Branch 10 (13→14) taken 1 times.
✓ Branch 12 (14→15) taken 1 times.
✓ Branch 14 (15→16) taken 1 times.
|
6 | phoenix_assert(checkParser("Test simple parsing", "", false, "")); |
34 |
8/8✓ Branch 0 (27→28) taken 1 times.
✓ Branch 2 (30→31) taken 1 times.
✓ Branch 4 (33→34) taken 1 times.
✓ Branch 6 (34→35) taken 1 times.
✓ Branch 8 (35→36) taken 1 times.
✓ Branch 10 (36→37) taken 1 times.
✓ Branch 12 (37→38) taken 1 times.
✓ Branch 14 (38→39) taken 1 times.
|
6 | phoenix_assert(checkParser("Test simple parsing", "\"Simple comment\"", true, "\"Simple comment\"")); |
35 |
8/8✓ Branch 0 (50→51) taken 1 times.
✓ Branch 2 (53→54) taken 1 times.
✓ Branch 4 (56→57) taken 1 times.
✓ Branch 6 (57→58) taken 1 times.
✓ Branch 8 (58→59) taken 1 times.
✓ Branch 10 (59→60) taken 1 times.
✓ Branch 12 (60→61) taken 1 times.
✓ Branch 14 (61→62) taken 1 times.
|
6 | phoenix_assert(checkParser("Test simple parsing", "'Simple comment'", true, "'Simple comment'")); |
36 |
8/8✓ Branch 0 (73→74) taken 1 times.
✓ Branch 2 (76→77) taken 1 times.
✓ Branch 4 (79→80) taken 1 times.
✓ Branch 6 (80→81) taken 1 times.
✓ Branch 8 (81→82) taken 1 times.
✓ Branch 10 (82→83) taken 1 times.
✓ Branch 12 (83→84) taken 1 times.
✓ Branch 14 (84→85) taken 1 times.
|
6 | phoenix_assert(checkParser("Test simple parsing", "\"\"\"Big comment\"\"\"", true, "\"\"\"Big comment\"\"\"")); |
37 |
8/8✓ Branch 0 (96→97) taken 1 times.
✓ Branch 2 (99→100) taken 1 times.
✓ Branch 4 (102→103) taken 1 times.
✓ Branch 6 (103→104) taken 1 times.
✓ Branch 8 (104→105) taken 1 times.
✓ Branch 10 (105→106) taken 1 times.
✓ Branch 12 (106→107) taken 1 times.
✓ Branch 14 (107→108) taken 1 times.
|
5 | phoenix_assert(checkParser("Test simple parsing", "'''Other big comment'''", true, "'''Other big comment'''")); |
38 | 1 | } | |
39 | |||
40 | |||
41 | 1 | int main(int argc, char** argv){ | |
42 | 1 | checkParseGenericString(); | |
43 | 1 | return 0; | |
44 | } | ||
45 | |||
46 | |||
47 |