| Directory: | ./ |
|---|---|
| File: | TESTS/TEST_ParserOptionListString/main.cpp |
| Date: | 2024-12-09 15:28:54 |
| Exec | Total | Coverage | |
|---|---|---|---|
| Lines: | 17 | 17 | 100.0% |
| Branches: | 23 | 23 | 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("input", "i", OptionType::FILENAME, true, "Required option"); |
| 18 | 1 | return parser; | |
| 19 | } | ||
| 20 | |||
| 21 | 1 | int main(int argc, char** argv){ | |
| 22 |
1/1✓ Branch 1 taken 1 times.
|
1 | OptionParser parser = createOptionParser(); |
| 23 |
1/1✓ Branch 1 taken 1 times.
|
1 | parser.parseArgument(argc, argv); |
| 24 | |||
| 25 |
1/1✓ Branch 1 taken 1 times.
|
1 | const OptionMode & defaultMode = parser.getDefaultMode(); |
| 26 | 1 | std::list<std::string> listInputFile; | |
| 27 |
2/2✓ Branch 2 taken 1 times.
✓ Branch 5 taken 1 times.
|
1 | defaultMode.getValue(listInputFile, "input"); |
| 28 | // std::cout << "input = {" << std::endl; | ||
| 29 | // for(std::list<std::string>::iterator it(listInputFile.begin()); it != listInputFile.end(); ++it){ | ||
| 30 | // std::cout << "\t'" << *it << "'" << std::endl; | ||
| 31 | // } | ||
| 32 | // std::cout << "}" << std::endl; | ||
| 33 | 1 | std::list<std::string> listReference; | |
| 34 |
2/2✓ Branch 2 taken 1 times.
✓ Branch 5 taken 1 times.
|
1 | listReference.push_back("fileName1.txt"); |
| 35 |
2/2✓ Branch 2 taken 1 times.
✓ Branch 5 taken 1 times.
|
1 | listReference.push_back("fileName2.txt"); |
| 36 |
2/2✓ Branch 2 taken 1 times.
✓ Branch 5 taken 1 times.
|
1 | listReference.push_back("fileName3.txt"); |
| 37 |
6/6✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 14 taken 1 times.
✓ Branch 17 taken 1 times.
✓ Branch 20 taken 1 times.
|
1 | phoenix_assert(phoenix_check("Check list input", listInputFile, listReference)); |
| 38 | 1 | return 0; | |
| 39 | 1 | } | |
| 40 | |||
| 41 | |||
| 42 |