GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: tmp_project/StringUtils/TESTS/TEST_PRINT_STRING/main.cpp Lines: 35 35 100.0 %
Date: 2024-12-09 15:30:52 Branches: 47 47 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 "print_string.h"
11
12
///Test print to string
13
/**	@param prefix : string prefix
14
 * 	@param suffix : string prefix
15
 * 	@return true on success, false otherwise
16
*/
17
2
bool testPrintString(const std::string & prefix, const std::string & suffix){
18
4
	std::list<std::string> listString;
19
4
	std::vector<std::string> vecString;
20
2
	phoenix_print("some string", suffix, prefix);
21
2
	phoenix_print(listString, suffix, prefix);
22
2
	phoenix_print(vecString, suffix, prefix);
23
24
2
	listString.push_back("Some string");
25
2
	phoenix_print(listString, suffix, prefix);
26
2
	listString.push_back("And other");
27
2
	phoenix_print(listString, suffix, prefix);
28
2
	listString.push_back("And other again");
29
2
	phoenix_print(listString, suffix, prefix);
30
31
2
	vecString.push_back("Some string");
32
2
	phoenix_print(vecString, suffix, prefix);
33
2
	vecString.push_back("And other");
34
2
	phoenix_print(vecString, suffix, prefix);
35
2
	vecString.push_back("And other again");
36
2
	phoenix_print(vecString, suffix, prefix);
37
38
4
	std::map<int, int> mapValue;
39
2
	phoenix_print(mapValue, suffix, prefix);
40
2
	mapValue[42] = 23;
41
2
	phoenix_print(mapValue, suffix, prefix);
42
2
	mapValue[12] = 39;
43
2
	phoenix_print(mapValue, suffix, prefix);
44
45
2
	std::map<int, std::vector<std::string> > mapVecString;
46
2
	phoenix_print(mapVecString, suffix, prefix);
47
2
	mapVecString[42] = vecString;
48
2
	phoenix_print(mapVecString, suffix, prefix);
49
2
	mapVecString[12] = vecString;
50
2
	phoenix_print(mapVecString, suffix, prefix);
51
52
4
	return true;
53
}
54
55
56
1
int main(int argc, char** argv){
57

1
	phoenix_assert(testPrintString("", ""));
58

1
	phoenix_assert(testPrintString("Prefix", "Suffix"));
59
1
	return 0;
60
}
61
62