Directory: | ./ |
---|---|
File: | TESTS/TEST_ParserOptionString/main.cpp |
Date: | 2024-07-27 10:53:27 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 13 | 13 | 100.0% |
Branches: | 16 | 16 | 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 | 2 | OptionParser createOptionParser(){ | |
16 |
2/2✓ Branch 2 taken 2 times.
✓ Branch 5 taken 2 times.
|
4 | OptionParser parser(true, "1.0.0"); |
17 |
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("input", "i", OptionType::FILENAME, true, "Required option"); |
18 | 2 | return parser; | |
19 | } | ||
20 | |||
21 | 2 | int main(int argc, char** argv){ | |
22 |
1/1✓ Branch 1 taken 2 times.
|
2 | OptionParser parser = createOptionParser(); |
23 |
1/1✓ Branch 1 taken 2 times.
|
2 | parser.parseArgument(argc, argv); |
24 | |||
25 |
1/1✓ Branch 1 taken 2 times.
|
2 | const OptionMode & defaultMode = parser.getDefaultMode(); |
26 |
1/1✓ Branch 2 taken 2 times.
|
2 | std::string inputFile(""); |
27 |
2/2✓ Branch 2 taken 2 times.
✓ Branch 5 taken 2 times.
|
2 | defaultMode.getValue(inputFile, "input"); |
28 | // std::cout << "input = '" << inputFile << "'" << std::endl; | ||
29 | |||
30 |
4/4✓ Branch 2 taken 2 times.
✓ Branch 6 taken 2 times.
✓ Branch 10 taken 2 times.
✓ Branch 14 taken 2 times.
|
2 | phoenix_assert(inputFile == "fileName.txt"); |
31 | 2 | return 0; | |
32 | 2 | } | |
33 | |||
34 | |||
35 |