GCC Code Coverage Report


Directory: ./
File: tmp_project/PhoenixFileParser/TESTS/TEST_MULTI_FILE_PARSER/ConfigParser.cpp
Date: 2025-03-14 11:45:13
Exec Total Coverage
Lines: 29 29 100.0%
Branches: 15 16 93.8%

Line Branch Exec Source
1 /***************************************
2 Auteur : Pierre Aubert
3 Mail : pierre.aubert@lapp.in2p3.fr
4 Licence : CeCILL-C
5 ****************************************/
6
7 #include "ConfigParser.h"
8
9 ///Default constructor of ConfigParser
10
2/2
✓ Branch 2 taken 2 times.
✓ Branch 5 taken 2 times.
2 ConfigParser::ConfigParser(){
11 2 initialisationConfigParser();
12 2 }
13
14 ///Destructor of ConfigParser
15 4 ConfigParser::~ConfigParser(){
16
17 }
18
19 ///Get the last doc string
20 /** @return last doc string
21 */
22 2 const std::string & ConfigParser::getDocString() const{
23 2 return p_lastDocString;
24 }
25
26 ///Parse the input file
27 /** @return true on success, false otherwise
28 */
29 5 bool ConfigParser::parseFile(){
30
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
5 if(!p_run) return false;
31
32 5 p_parser->skipWhiteSpace();
33 //To parse the file we need to read char by char until we get something we know
34
2/2
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 2 times.
5 if(parseDocString()){}
35
4/4
✓ Branch 2 taken 3 times.
✓ Branch 5 taken 2 times.
✓ Branch 6 taken 1 times.
✓ Branch 9 taken 2 times.
3 else if(isMatch("//")){p_parser->getUntilKeyWithoutPatern("\n");} //Skip comment
36 else{
37 1 unexpectedToken();
38 1 pointAtRow();
39 1 return false;
40 }
41 4 p_parser->skipWhiteSpace();
42 4 return true;
43 }
44
45 ///Initialisation to be done just before loading a file
46 3 void ConfigParser::preLoadFile(){
47 //Save the current source
48
1/1
✓ Branch 3 taken 3 times.
3 getCurrentParser()->setWhiteSpace(" \t\n");
49
1/1
✓ Branch 3 taken 3 times.
3 getCurrentParser()->setSeparator(",;{}[]()");
50 3 p_lastDocString = "";
51 3 }
52
53 ///Initialisation to be done just after loading a file
54 2 void ConfigParser::postLoadFile(){
55
56 2 }
57
58 ///Initialisation function of the class ConfigParser
59 2 void ConfigParser::initialisationConfigParser(){
60
61 2 }
62
63 ///Parse a doc string
64 /** @return true on success, false otherwise
65 */
66 5 bool ConfigParser::parseDocString(){
67
3/3
✓ Branch 2 taken 5 times.
✓ Branch 5 taken 3 times.
✓ Branch 6 taken 2 times.
5 if(!isMatch("///")){return false;}
68
1/1
✓ Branch 2 taken 2 times.
2 p_lastDocString = p_parser->getUntilKeyWithoutPatern("\n");
69
70 2 return true;
71 }
72
73
74
75
76