1 |
|
|
|
2 |
|
|
/*************************************** |
3 |
|
|
Auteur : Pierre Aubert |
4 |
|
|
Mail : pierre.aubert@lapp.in2p3.fr |
5 |
|
|
Licence : CeCILL-C |
6 |
|
|
****************************************/ |
7 |
|
|
|
8 |
|
|
#include "phoenix_check.h" |
9 |
|
|
#include "OptionParser.h" |
10 |
|
|
|
11 |
|
|
///Create the OptionParser of this program |
12 |
|
|
/** @return OptionParser of this program |
13 |
|
|
*/ |
14 |
|
2 |
OptionParser createOptionParser(){ |
15 |
✓✓ |
4 |
OptionParser parser(true, "1.0.0"); |
16 |
✓✓✓✓
|
2 |
parser.addOption("input", "i", OptionType::STRING, true, "Required option"); |
17 |
|
2 |
return parser; |
18 |
|
|
} |
19 |
|
|
|
20 |
|
2 |
int main(int argc, char** argv){ |
21 |
✓ |
4 |
OptionParser parser = createOptionParser(); |
22 |
✓ |
2 |
parser.parseArgument(argc, argv); |
23 |
|
|
|
24 |
✓ |
2 |
const OptionMode & defaultMode = parser.getDefaultMode(); |
25 |
✓ |
2 |
std::string inputFile(""); |
26 |
✓✓ |
2 |
defaultMode.getValue(inputFile, "input"); |
27 |
✓✓✓✓
|
2 |
std::cout << "input = '" << inputFile << "'" << std::endl; |
28 |
|
|
|
29 |
|
2 |
bool b(true); |
30 |
|
2 |
b &= inputFile == "one long string option"; |
31 |
✓✓ |
2 |
phoenix_functionOk("final", b); |
32 |
|
2 |
return b - 1; |
33 |
|
|
} |
34 |
|
|
|
35 |
|
|
|