Directory: | ./ |
---|---|
File: | tmp_project/PhoenixFileParser/TESTS/TEST_PARSE_GENERIC_STRING/main.cpp |
Date: | 2025-03-14 12:18:05 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 19 | 19 | 100.0% |
Branches: | 51 | 51 | 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 "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 1 taken 5 times.
|
5 | PFileParser parser; |
21 |
1/1✓ Branch 1 taken 5 times.
|
5 | parser.setFileContent(fileContent); |
22 |
1/1✓ Branch 1 taken 5 times.
|
5 | PString foundString; |
23 |
5/5✓ Branch 2 taken 5 times.
✓ Branch 6 taken 5 times.
✓ Branch 10 taken 5 times.
✓ Branch 13 taken 5 times.
✓ Branch 16 taken 5 times.
|
5 | phoenix_assert(parse_generic_string(foundString, parser) == isParsingOk); |
24 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 1 times.
|
5 | if(isParsingOk){ |
25 |
1/1✓ Branch 1 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 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(checkParser("Test simple parsing", "", false, "")); |
34 |
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(checkParser("Test simple parsing", "\"Simple comment\"", true, "\"Simple comment\"")); |
35 |
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(checkParser("Test simple parsing", "'Simple comment'", true, "'Simple comment'")); |
36 |
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(checkParser("Test simple parsing", "\"\"\"Big comment\"\"\"", true, "\"\"\"Big comment\"\"\"")); |
37 |
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(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 |