GCC Code Coverage Report


Directory: ./
File: TESTS/TEST_ParseOption/main.cpp
Date: 2024-07-27 10:53:27
Exec Total Coverage
Lines: 16 16 100.0%
Branches: 26 26 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 "OptionParser.h"
9
10 ///Create the OptionParser of this program
11 /** @return OptionParser of this program
12 */
13 2 OptionParser createOptionParser(){
14
2/2
✓ Branch 2 taken 2 times.
✓ Branch 5 taken 2 times.
4 OptionParser parser(true, "1.0.0");
15
2/2
✓ Branch 2 taken 2 times.
✓ Branch 5 taken 2 times.
2 parser.setExampleLongOption("dps --version");
16
2/2
✓ Branch 2 taken 2 times.
✓ Branch 5 taken 2 times.
2 parser.setExampleShortOption("dps -v");
17
18
4/4
✓ Branch 2 taken 2 times.
✓ Branch 6 taken 2 times.
✓ Branch 10 taken 2 times.
✓ Branch 13 taken 2 times.
2 parser.addOption("plugin", "p", OptionType::FILENAME, true, std::string("Required option"));
19
4/4
✓ Branch 2 taken 2 times.
✓ Branch 6 taken 2 times.
✓ Branch 10 taken 2 times.
✓ Branch 13 taken 2 times.
2 parser.addOption("otherplugin", "q", OptionType::FILENAME, true, false, "other Required option");
20
21
1/1
✓ Branch 2 taken 2 times.
2 std::string defaultConfigHost("");
22
5/5
✓ Branch 2 taken 2 times.
✓ Branch 5 taken 2 times.
✓ Branch 9 taken 2 times.
✓ Branch 13 taken 2 times.
✓ Branch 16 taken 2 times.
2 parser.addOption("config", "c", defaultConfigHost, "Optional value");
23
24
4/4
✓ Branch 2 taken 2 times.
✓ Branch 6 taken 2 times.
✓ Branch 10 taken 2 times.
✓ Branch 13 taken 2 times.
2 parser.addOption("loadonly", "l", OptionType::NONE, false, "Optional Trigger option");
25 4 return parser;
26 2 }
27
28 2 int main(int argc, char** argv){
29
1/1
✓ Branch 1 taken 2 times.
2 OptionParser parser = createOptionParser();
30
1/1
✓ Branch 1 taken 1 times.
2 parser.parseArgument(argc, argv);
31 1 return 0;
32 1 }
33
34
35