GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: tmp_project/FileParser/TESTS/TEST_MULTI_FILE_PARSER/main.cpp Lines: 23 23 100.0 %
Date: 2024-09-10 03:06:26 Branches: 64 64 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 <iostream>
9
#include "phoenix_assert.h"
10
#include "phoenix_check.h"
11
#include "ConfigParser.h"
12
13
///Check the openFileStream
14
1
void checkPMultiFileParser(){
15
2
	std::string fileName("configFile.txt");
16

1
	phoenix_assert(saveFileContent(fileName, "//some comment\n///Some documentation\n\n"));
17
18
2
	ConfigParser parser;
19
20

1
	phoenix_assert(!parser.fullParsing());	//Cannot parse because nothing is initialised
21

1
	phoenix_assert(!parser.load(""));
22

1
	phoenix_assert(!parser.load("unexistingFile.txt"));
23
24

1
	phoenix_assert(parser.load(fileName));
25
2
	std::string docString(parser.getDocString());
26
// 	std::cout << "checkPMultiFileParser : docString = '" << docString << "' ('Some documentation' expected)" << std::endl;
27

1
	phoenix_assert(docString == "Some documentation");
28
1
	parser.setFileContent("//some comment\n///Some documentation\n\n");
29
30
2
	ConfigParser parser2;
31
1
	parser2.setFileContent("//some comment\n///Some documentation\n\n");
32

1
	phoenix_assert(parser2.fullParsing());
33
2
	std::string docString2(parser2.getDocString());
34
// 	std::cout << "checkPMultiFileParser : parser2 docString2 = '" << docString2 << "' ('Some documentation' expected)" << std::endl;
35

1
	phoenix_assert(docString2 == "Some documentation");
36
37
1
	std::string fileNameFail("configFileFail.txt");
38

1
	phoenix_assert(saveFileContent(fileNameFail, "\n\nsome unexpected string\n///Some documentation\n\n"));
39

1
	phoenix_assert(!parser.load(fileNameFail));
40
1
}
41
42
43
1
int main(int argc, char** argv){
44
1
	checkPMultiFileParser();
45
1
	return 0;
46
}
47
48