GCC Code Coverage Report


Directory: ./
File: tmp_project/PhoenixString/TESTS/TEST_PRINT_STRING/main.cpp
Date: 2024-07-27 10:53:27
Exec Total Coverage
Lines: 36 36 100.0%
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 2 std::list<std::string> listString;
19 2 std::vector<std::string> vecString;
20
1/1
✓ Branch 1 taken 2 times.
2 phoenix_print("some string", suffix, prefix);
21
1/1
✓ Branch 1 taken 2 times.
2 phoenix_print(listString, suffix, prefix);
22
1/1
✓ Branch 1 taken 2 times.
2 phoenix_print(vecString, suffix, prefix);
23
24
2/2
✓ Branch 2 taken 2 times.
✓ Branch 5 taken 2 times.
2 listString.push_back("Some string");
25
1/1
✓ Branch 1 taken 2 times.
2 phoenix_print(listString, suffix, prefix);
26
2/2
✓ Branch 2 taken 2 times.
✓ Branch 5 taken 2 times.
2 listString.push_back("And other");
27
1/1
✓ Branch 1 taken 2 times.
2 phoenix_print(listString, suffix, prefix);
28
2/2
✓ Branch 2 taken 2 times.
✓ Branch 5 taken 2 times.
2 listString.push_back("And other again");
29
1/1
✓ Branch 1 taken 2 times.
2 phoenix_print(listString, suffix, prefix);
30
31
2/2
✓ Branch 2 taken 2 times.
✓ Branch 5 taken 2 times.
2 vecString.push_back("Some string");
32
1/1
✓ Branch 1 taken 2 times.
2 phoenix_print(vecString, suffix, prefix);
33
2/2
✓ Branch 2 taken 2 times.
✓ Branch 5 taken 2 times.
2 vecString.push_back("And other");
34
1/1
✓ Branch 1 taken 2 times.
2 phoenix_print(vecString, suffix, prefix);
35
2/2
✓ Branch 2 taken 2 times.
✓ Branch 5 taken 2 times.
2 vecString.push_back("And other again");
36
1/1
✓ Branch 1 taken 2 times.
2 phoenix_print(vecString, suffix, prefix);
37
38 2 std::map<int, int> mapValue;
39
1/1
✓ Branch 1 taken 2 times.
2 phoenix_print(mapValue, suffix, prefix);
40
1/1
✓ Branch 1 taken 2 times.
2 mapValue[42] = 23;
41
1/1
✓ Branch 1 taken 2 times.
2 phoenix_print(mapValue, suffix, prefix);
42
1/1
✓ Branch 1 taken 2 times.
2 mapValue[12] = 39;
43
1/1
✓ Branch 1 taken 2 times.
2 phoenix_print(mapValue, suffix, prefix);
44
45 2 std::map<int, std::vector<std::string> > mapVecString;
46
1/1
✓ Branch 1 taken 2 times.
2 phoenix_print(mapVecString, suffix, prefix);
47
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 mapVecString[42] = vecString;
48
1/1
✓ Branch 1 taken 2 times.
2 phoenix_print(mapVecString, suffix, prefix);
49
2/2
✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
2 mapVecString[12] = vecString;
50
1/1
✓ Branch 1 taken 2 times.
2 phoenix_print(mapVecString, suffix, prefix);
51
52 2 return true;
53 2 }
54
55
56 1 int main(int argc, char** argv){
57
7/7
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 14 taken 1 times.
✓ Branch 18 taken 1 times.
✓ Branch 21 taken 1 times.
✓ Branch 24 taken 1 times.
1 phoenix_assert(testPrintString("", ""));
58
7/7
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 14 taken 1 times.
✓ Branch 18 taken 1 times.
✓ Branch 21 taken 1 times.
✓ Branch 24 taken 1 times.
1 phoenix_assert(testPrintString("Prefix", "Suffix"));
59 1 return 0;
60 }
61
62
63