GCC Code Coverage Report


Directory: ./
File: TESTS/TESTS_REPRESENTATION/TEST_REPRESENTATION/TEST_FUNCTION/main.cpp
Date: 2026-05-19 15:42:59
Exec Total Coverage
Lines: 29 29 100.0%
Functions: 5 5 100.0%
Branches: 19 24 79.2%

Line Branch Exec Source
1 /***************************************
2 Auteur : Pierre Aubert
3 Mail : pierre.aubert@lapp.in2p3.fr
4 Licence : CeCILL-C
5 ****************************************/
6
7 #include "assert.h"
8
9 #include "Representation.h"
10
11 using namespace Swarm;
12
13 ///Check the equality between two Function classes
14 /** @param var : variable to be checked
15 * @param reference : reference
16 * @return true on success, false otherwise
17 */
18 2 bool checkFunctionEquality(Function & var, Function & reference){
19 2 bool b(true);
20 2 b &= var.getName() == reference.getName();
21 2 b &= var.getDescription() == reference.getDescription();
22 2 return b;
23 }
24
25 ///Check the equality between two Function classes
26 /** @param var : variable to be checked
27 * @param reference : reference
28 * @return true on success, false otherwise
29 */
30 2 bool checkFunctionEqualityConst(const Function & var, const Function & reference){
31 2 bool b(true);
32 2 b &= var.getName() == reference.getName();
33 2 b &= var.getDescription() == reference.getDescription();
34 2 return b;
35 }
36
37 ///Check copy of class Function
38 1 void checkFunctionCopy(){
39
1/1
✓ Branch 0 (2→3) taken 1 times.
1 Function reference;
40 //Let's use the setters
41
2/2
✓ Branch 0 (3→4) taken 1 times.
✓ Branch 2 (4→5) taken 1 times.
1 reference.setName("Some string");
42
2/2
✓ Branch 0 (6→7) taken 1 times.
✓ Branch 2 (7→8) taken 1 times.
1 reference.setDescription("Some string");
43
1/1
✓ Branch 0 (9→10) taken 1 times.
1 Function varCopy(reference);
44
1/1
✓ Branch 0 (10→11) taken 1 times.
1 Function varEqual;
45
1/1
✓ Branch 0 (11→12) taken 1 times.
1 varEqual = reference;
46
2/3
✓ Branch 0 (12→13) taken 1 times.
✗ Branch 2 (13→14) not taken.
✓ Branch 3 (13→15) taken 1 times.
1 assert(checkFunctionEquality(varCopy, reference));
47
2/3
✓ Branch 0 (15→16) taken 1 times.
✗ Branch 2 (16→17) not taken.
✓ Branch 3 (16→18) taken 1 times.
1 assert(checkFunctionEqualityConst(varCopy, reference));
48
2/3
✓ Branch 0 (18→19) taken 1 times.
✗ Branch 2 (19→20) not taken.
✓ Branch 3 (19→21) taken 1 times.
1 assert(checkFunctionEquality(varEqual, reference));
49
2/3
✓ Branch 0 (21→22) taken 1 times.
✗ Branch 2 (22→23) not taken.
✓ Branch 3 (22→24) taken 1 times.
1 assert(checkFunctionEqualityConst(varEqual, reference));
50 1 }
51
52 ///Check TypeStream of class Function
53 1 void checkFunctionTypeStream(){
54
3/4
✓ Branch 0 (2→3) taken 1 times.
✓ Branch 2 (3→4) taken 1 times.
✗ Branch 4 (4→5) not taken.
✓ Branch 5 (4→6) taken 1 times.
1 assert(phoenix_getTypeToStr<Function>() == "Function");
55 1 }
56
57 1 int main(int argc, char ** argv){
58 1 checkFunctionCopy();
59 1 checkFunctionTypeStream();
60 1 return 0;
61 }
62