GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: tmp_project/FileParser/TESTS/TEST_DICO_REPLACE_VAR_STR/main.cpp Lines: 18 18 100.0 %
Date: 2023-10-11 10:52:07 Branches: 59 59 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_check.h"
9
#include "dico_replace_var.h"
10
#include "parser_yml.h"
11
12
13
///Check the replace of var in str
14
/**	@return true on success, false otherwise
15
*/
16
1
bool checkVarReplaceStr(){
17
1
	bool b(true);
18
19
1
	PMapKnownVar mapKeyVariable;
20
1
	mapKeyVariable["${varA}"] = "someStr";
21
1
	mapKeyVariable["${varB}"] = "otherStr";
22
23

1
	b &= phoenix_check("base empty var begin end", dico_replace_var_str("input", mapKeyVariable, "", ""), "input");
24

1
	b &= phoenix_check("base empty var begin", dico_replace_var_str("input", mapKeyVariable, "", "}"), "input");
25

1
	b &= phoenix_check("base empty var end", dico_replace_var_str("input", mapKeyVariable, "${", ""), "input");
26
27

1
	b &= phoenix_check("base empty no replace", dico_replace_var_str("input", mapKeyVariable, "${", "}"), "input");
28

1
	b &= phoenix_check("base empty replace A", dico_replace_var_str("input ${varA}", mapKeyVariable, "${", "}"), "input someStr");
29

1
	b &= phoenix_check("base empty replace A B", dico_replace_var_str("input ${varA}${varB}", mapKeyVariable, "${", "}"), "input someStrotherStr");
30

1
	b &= phoenix_check("base empty replace unexisting C", dico_replace_var_str("input ${varC}", mapKeyVariable, "${", "}"), "input ${varC}");
31
32
1
	phoenix_functionOk("checkVarReplaceStr", b);
33
2
	return b;
34
}
35
36
37
1
int main(int argc, char** argv){
38
1
	bool b(checkVarReplaceStr());
39
1
	phoenix_functionOk("final", b);
40
1
	return b - 1;
41
}
42
43