GCC Code Coverage Report


Directory: ./
File: TESTS/TEST_FUNCTION/main.cpp
Date: 2025-03-14 12:18:05
Exec Total Coverage
Lines: 19 19 100.0%
Branches: 27 28 96.4%

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 "phoenix_check.h"
11 #include "phoenix_createData.h"
12 #include "FunctionCall.h"
13
14 ///Super interesting function which will called in the test
15 /** @param val : integer value
16 * @return operation on the value
17 */
18 1 int superInterestingFunction(int val){
19 1 return val + 2;
20 }
21
22 ///Test the function call
23 1 void testFunction(){
24
3/3
✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
✓ Branch 7 taken 1 times.
1 AbstractFunction* call = new FunctionCall(superInterestingFunction, "superInterestingFunction");
25
5/5
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 17 taken 1 times.
1 phoenix_assert(call->getName() == "superInterestingFunction");
26
2/2
✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
1 call->setName("multiply");
27
5/5
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 17 taken 1 times.
1 phoenix_assert(call->getName() == "multiply");
28
29 1 int value(42);
30
1/1
✓ Branch 1 taken 1 times.
1 Data param(phoenix_createData(value));
31
32
1/1
✓ Branch 1 taken 1 times.
1 PLog log;
33
1/1
✓ Branch 1 taken 1 times.
1 Data result;
34
1/1
✓ Branch 1 taken 1 times.
1 call->call(log, result, param);
35
36
1/1
✓ Branch 1 taken 1 times.
1 int resValue = phoenix_getValueFromData<int>(result);
37
6/6
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 14 taken 1 times.
✓ Branch 17 taken 1 times.
✓ Branch 20 taken 1 times.
1 phoenix_assert(phoenix_check("resValue", resValue, 44));
38
39
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 delete call;
40 1 }
41
42 1 int main(int argc, char** argv){
43 1 testFunction();
44 1 return 0;
45 }
46
47
48