Directory: | ./ |
---|---|
File: | TESTS/TEST_ParseOptionBase/main.cpp |
Date: | 2024-07-27 10:53:27 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 17 | 17 | 100.0% |
Branches: | 29 | 29 | 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 "OptionParser.h" | ||
11 | |||
12 | ///Create the OptionParser of this program | ||
13 | /** @return OptionParser of this program | ||
14 | */ | ||
15 | 1 | OptionParser createOptionParser(){ | |
16 |
2/2✓ Branch 2 taken 1 times.
✓ Branch 5 taken 1 times.
|
2 | OptionParser parser(true, "1.0.0"); |
17 |
4/4✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
|
1 | parser.addOption("plugin", "p", OptionType::FILENAME, true, "Required option"); |
18 | |||
19 |
1/1✓ Branch 2 taken 1 times.
|
1 | std::string defaultConfigHost(""); |
20 |
5/5✓ Branch 2 taken 1 times.
✓ Branch 5 taken 1 times.
✓ Branch 9 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
|
1 | parser.addOption("config", "c", defaultConfigHost, "Optional value"); |
21 | |||
22 |
4/4✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
|
1 | parser.addOption("loadonly", "l", OptionType::NONE, false, "Optional Trigger option"); |
23 | 2 | return parser; | |
24 | 1 | } | |
25 | |||
26 | 1 | int main(int argc, char** argv){ | |
27 |
1/1✓ Branch 1 taken 1 times.
|
1 | OptionParser parser = createOptionParser(); |
28 |
1/1✓ Branch 1 taken 1 times.
|
1 | parser.parseArgument(argc, argv); |
29 | |||
30 |
1/1✓ Branch 1 taken 1 times.
|
1 | const OptionMode & defaultMode = parser.getDefaultMode(); |
31 |
1/1✓ Branch 2 taken 1 times.
|
1 | std::string pluginOption(""); |
32 |
2/2✓ Branch 2 taken 1 times.
✓ Branch 5 taken 1 times.
|
1 | defaultMode.getValue(pluginOption, "plugin"); |
33 | // std::cout << "pluginOption = '" << pluginOption << "'" << std::endl; | ||
34 | |||
35 |
7/7✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 14 taken 1 times.
✓ Branch 18 taken 1 times.
✓ Branch 21 taken 1 times.
✓ Branch 24 taken 1 times.
|
1 | phoenix_assert(phoenix_check("Check ", pluginOption, "RequiredOptionValue")); |
36 | 1 | return 0; | |
37 | 1 | } | |
38 | |||
39 | |||
40 |