GCC Code Coverage Report


Directory: ./
File: TESTS/TEST_OPTION_VALUE/main.cpp
Date: 2024-07-27 10:53:27
Exec Total Coverage
Lines: 31 31 100.0%
Branches: 64 64 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 "phoenix_assert.h"
9 #include "phoenix_check.h"
10 #include "print_string.h"
11 #include "OptionValue.h"
12
13 ///Print value of OptionValue
14 /** @param opt : OptionValue to be printed
15 */
16 1 void printValueOfOpt(const OptionValue & opt){
17
4/4
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 9 taken 1 times.
✓ Branch 12 taken 1 times.
1 phoenix_print(opt.getValue());
18
19
4/4
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 9 taken 1 times.
✓ Branch 12 taken 1 times.
1 phoenix_print(opt.getDefaultValue());
20
4/4
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 9 taken 1 times.
✓ Branch 12 taken 1 times.
1 phoenix_print(opt.getPossibleValue());
21 1 }
22
23 ///Test the option type
24 /** @return true on success, false otherwise
25 */
26 1 bool testOptionValue(){
27 1 bool b(true);
28
29
2/2
✓ Branch 2 taken 1 times.
✓ Branch 5 taken 1 times.
2 OptionValue optValue("Shadoko", OptionType::STRING);
30
4/4
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 9 taken 1 times.
✓ Branch 12 taken 1 times.
1 phoenix_print(optValue.getValue());
31
1/1
✓ Branch 1 taken 1 times.
1 printValueOfOpt(optValue);
32 1 VecValue vecVal;
33
1/1
✓ Branch 1 taken 1 times.
1 OptionValue optVecValue(vecVal, OptionType::STRING);
34
4/4
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 9 taken 1 times.
✓ Branch 12 taken 1 times.
1 phoenix_print(optVecValue.getValue());
35
2/2
✓ Branch 2 taken 1 times.
✓ Branch 5 taken 1 times.
2 OptionValue optDefValue("Shadoko", OptionType::STRING, vecVal);
36
4/4
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 9 taken 1 times.
✓ Branch 12 taken 1 times.
1 phoenix_print(optDefValue.getValue());
37
1/1
✓ Branch 1 taken 1 times.
1 OptionValue optVecDefValue(vecVal, OptionType::STRING, vecVal);
38
4/4
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 9 taken 1 times.
✓ Branch 12 taken 1 times.
1 phoenix_print(optVecDefValue.getValue());
39
40
2/2
✓ Branch 2 taken 1 times.
✓ Branch 5 taken 1 times.
1 optVecDefValue.setValue("val");
41
1/1
✓ Branch 1 taken 1 times.
1 optVecDefValue.setValue(vecVal);
42
43
2/2
✓ Branch 2 taken 1 times.
✓ Branch 5 taken 1 times.
2 OptionValue optPossibleDefValue("value", OptionType::STRING, vecVal, vecVal);
44
4/4
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 9 taken 1 times.
✓ Branch 12 taken 1 times.
1 phoenix_print(optPossibleDefValue.getValue());
45
1/1
✓ Branch 1 taken 1 times.
1 OptionValue optVecPossibleDefValue(vecVal, OptionType::STRING, vecVal, vecVal);
46
4/4
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 9 taken 1 times.
✓ Branch 12 taken 1 times.
1 phoenix_print(optVecPossibleDefValue.getValue());
47
48
4/4
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 9 taken 1 times.
✓ Branch 12 taken 1 times.
1 phoenix_print(optVecPossibleDefValue.getDefaultValue());
49
4/4
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 9 taken 1 times.
✓ Branch 12 taken 1 times.
1 phoenix_print(optVecPossibleDefValue.getPossibleValue());
50
2/2
✓ Branch 2 taken 1 times.
✓ Branch 5 taken 1 times.
1 phoenix_functionOk("testOptionValue", b);
51 1 return b;
52 1 }
53
54 1 int main(int argc, char** argv){
55
5/5
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
1 phoenix_assert(testOptionValue());
56 1 return 0;
57 }
58
59
60