GCC Code Coverage Report


Directory: ./
File: TESTS/TEST_OPTION/main.cpp
Date: 2024-07-27 10:53:27
Exec Total Coverage
Lines: 35 35 100.0%
Branches: 78 78 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
12 #include "Option.h"
13
14 ///Print value of Option
15 /** @param opt : Option to be printed
16 */
17 3 void printValueOfOptConst(const Option & opt){
18
4/4
✓ Branch 2 taken 3 times.
✓ Branch 6 taken 3 times.
✓ Branch 9 taken 3 times.
✓ Branch 12 taken 3 times.
3 phoenix_print(opt.getDocString(), "", "Docstring : ");
19
4/4
✓ Branch 2 taken 3 times.
✓ Branch 6 taken 3 times.
✓ Branch 9 taken 3 times.
✓ Branch 12 taken 3 times.
3 phoenix_print(opt.getLongName(), "", "LongName : ");
20
4/4
✓ Branch 2 taken 3 times.
✓ Branch 6 taken 3 times.
✓ Branch 9 taken 3 times.
✓ Branch 12 taken 3 times.
3 phoenix_print(opt.getShortName(), "", "ShortName : ");
21
5/5
✓ Branch 2 taken 3 times.
✓ Branch 6 taken 3 times.
✓ Branch 9 taken 3 times.
✓ Branch 12 taken 3 times.
✓ Branch 15 taken 3 times.
3 phoenix_print(opt.getValue().getValue(), "", "Value : ");
22
4/4
✓ Branch 2 taken 3 times.
✓ Branch 6 taken 3 times.
✓ Branch 9 taken 3 times.
✓ Branch 12 taken 3 times.
3 phoenix_print(opt.isRequired(), "", "IsRequired : ");
23
4/4
✓ Branch 2 taken 3 times.
✓ Branch 6 taken 3 times.
✓ Branch 9 taken 3 times.
✓ Branch 12 taken 3 times.
3 phoenix_print(opt.isAllowEmpty(), "", "IsAllowEmpty : ");
24 3 }
25
26 ///Print value of Option
27 /** @param opt : Option to be printed
28 */
29 1 void printValueOfOpt(Option & opt){
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(opt.getDocString(), "", "Docstring : ");
31
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.getLongName(), "", "LongName : ");
32
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.getShortName(), "", "ShortName : ");
33
5/5
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 9 taken 1 times.
✓ Branch 12 taken 1 times.
✓ Branch 15 taken 1 times.
1 phoenix_print(opt.getValue().getValue(), "", "Value : ");
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(opt.isRequired(), "", "IsRequired : ");
35
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.isAllowEmpty(), "", "IsAllowEmpty : ");
36 1 }
37
38 ///Test the option type
39 1 void testOption(){
40
4/4
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
2 Option opt("long", "short", "value", "some doc");
41
1/1
✓ Branch 1 taken 1 times.
1 printValueOfOpt(opt);
42
1/1
✓ Branch 1 taken 1 times.
1 printValueOfOptConst(opt);
43
44
4/4
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
2 Option optReq("long", "short", true, "some doc");
45
1/1
✓ Branch 1 taken 1 times.
1 printValueOfOptConst(optReq);
46
47
4/4
✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
2 Option optSet;
48
2/2
✓ Branch 2 taken 1 times.
✓ Branch 5 taken 1 times.
1 optSet.setDocString("Some doc");
49
2/2
✓ Branch 2 taken 1 times.
✓ Branch 5 taken 1 times.
1 optSet.setLongName("long");
50
2/2
✓ Branch 2 taken 1 times.
✓ Branch 5 taken 1 times.
1 optSet.setShortName("short");
51
3/3
✓ Branch 2 taken 1 times.
✓ Branch 5 taken 1 times.
✓ Branch 8 taken 1 times.
1 optSet.setValue(OptionValue("Value", OptionType::STRING));
52
1/1
✓ Branch 1 taken 1 times.
1 optSet.setIsRequired(true);
53
1/1
✓ Branch 1 taken 1 times.
1 optSet.setIsAllowEmpty(true);
54
1/1
✓ Branch 1 taken 1 times.
1 optSet.setIsParsed(false);
55
1/1
✓ Branch 1 taken 1 times.
1 printValueOfOptConst(optSet);
56 1 }
57
58 1 int main(int argc, char** argv){
59 1 testOption();
60 1 return 0;
61 }
62
63
64