GCC Code Coverage Report


Directory: ./
File: tmp_project/PhoenixCore/src/phoenix_check.cpp
Date: 2025-03-14 12:18:05
Exec Total Coverage
Lines: 22 25 88.0%
Branches: 29 34 85.3%

Line Branch Exec Source
1 /***************************************
2 Auteur : Pierre Aubert
3 Mail : pierre.aubert@lapp.in2p3.fr
4 Licence : CeCILL-C
5 ****************************************/
6
7 #include "convertToString.h"
8 #include "phoenix_check.h"
9
10 ///Check two string
11 /** @param testName : name of the current test
12 * @param val : std::string to be checked
13 * @param reference : reference std::string
14 * @return true if val == reference, false otherwise
15 */
16 172 bool phoenix_check(const std::string & testName, const std::string & val, const std::string & reference){
17 172 bool b(val == reference);
18
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 172 times.
172 if(!b){
19 std::cout << "phoenix_check : " << testName << " => " << phoenix_isOk(b) << std::endl;
20 std::cout << "\tval = '"<<val<<"'" << std::endl;
21 std::cout << "\treference = '"<<reference<<"'" << std::endl;
22 }
23 172 return b;
24 }
25
26 ///Check two vector of string
27 /** @param testName : name of the current test
28 * @param listVal : list of std::string to be checked
29 * @param listRef : list of reference std::string
30 * @return true if val == reference, false otherwise
31 */
32 9 bool phoenix_check(const std::string & testName, const std::vector<std::string> & listVal, const std::vector<std::string> & listRef){
33 9 bool b(true);
34 //On this implementation, two vectors of different sizes are not comparable
35
2/2
✓ Branch 3 taken 9 times.
✓ Branch 6 taken 9 times.
9 b &= phoenix_check(testName + " size", listVal.size(), listRef.size());
36
6/6
✓ Branch 1 taken 11 times.
✓ Branch 2 taken 4 times.
✓ Branch 3 taken 6 times.
✓ Branch 4 taken 5 times.
✓ Branch 5 taken 6 times.
✓ Branch 6 taken 9 times.
15 for(size_t i(0lu); i < listVal.size() && b; ++i){
37
5/5
✓ Branch 3 taken 6 times.
✓ Branch 6 taken 6 times.
✓ Branch 9 taken 6 times.
✓ Branch 12 taken 6 times.
✓ Branch 15 taken 6 times.
6 b &= phoenix_check(testName + " str("+valueToString(i)+")", listVal[i], listRef[i]);
38 }
39 9 return b;
40 }
41
42 ///Check two list of string
43 /** @param testName : name of the current test
44 * @param listVal : list of std::string to be checked
45 * @param listRef : list of reference std::string
46 * @return true if val == reference, false otherwise
47 */
48 8 bool phoenix_check(const std::string & testName, const std::list<std::string> & listVal, const std::list<std::string> & listRef){
49 8 bool b(true);
50 //On this implementation, two list of different sizes are not comparable
51
2/2
✓ Branch 3 taken 8 times.
✓ Branch 6 taken 8 times.
8 b &= phoenix_check(testName + " size", listVal.size(), listRef.size());
52 8 std::list<std::string>::const_iterator itVal(listVal.begin());
53 8 std::list<std::string>::const_iterator itRef(listRef.begin());
54 8 size_t i(0lu);
55
8/8
✓ Branch 2 taken 8 times.
✓ Branch 3 taken 3 times.
✓ Branch 6 taken 7 times.
✓ Branch 7 taken 1 times.
✓ Branch 8 taken 3 times.
✓ Branch 9 taken 4 times.
✓ Branch 10 taken 3 times.
✓ Branch 11 taken 8 times.
11 while(itVal != listVal.end() && itRef != listRef.end() && b){
56
5/5
✓ Branch 3 taken 3 times.
✓ Branch 6 taken 3 times.
✓ Branch 9 taken 3 times.
✓ Branch 12 taken 3 times.
✓ Branch 15 taken 3 times.
3 b &= phoenix_check(testName + " str("+valueToString(i)+")", *itVal, *itRef);
57 3 ++itVal;
58 3 ++itRef;
59 3 ++i;
60 }
61 8 return b;
62 }
63
64
65