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 "print_string.h" |
10 |
|
|
#include "OptionValue.h" |
11 |
|
|
|
12 |
|
|
///Print value of OptionValue |
13 |
|
|
/** @param opt : OptionValue to be printed |
14 |
|
|
*/ |
15 |
|
1 |
void printValueOfOpt(const OptionValue & opt){ |
16 |
✓✓✓✓
|
1 |
phoenix_print(opt.getValue()); |
17 |
|
|
|
18 |
✓✓✓✓
|
1 |
phoenix_print(opt.getDefaultValue()); |
19 |
✓✓✓✓
|
1 |
phoenix_print(opt.getPossibleValue()); |
20 |
|
1 |
} |
21 |
|
|
|
22 |
|
|
///Test the option type |
23 |
|
|
/** @return true on success, false otherwise |
24 |
|
|
*/ |
25 |
|
1 |
bool testOptionValue(){ |
26 |
|
1 |
bool b(true); |
27 |
|
|
|
28 |
✓✓ |
3 |
OptionValue optValue("Shadoko", OptionType::STRING); |
29 |
✓✓✓✓
|
1 |
phoenix_print(optValue.getValue()); |
30 |
✓ |
1 |
printValueOfOpt(optValue); |
31 |
|
2 |
VecValue vecVal; |
32 |
✓ |
2 |
OptionValue optVecValue(vecVal, OptionType::STRING); |
33 |
✓✓✓✓
|
1 |
phoenix_print(optVecValue.getValue()); |
34 |
✓✓ |
3 |
OptionValue optDefValue("Shadoko", OptionType::STRING, vecVal); |
35 |
✓✓✓✓
|
1 |
phoenix_print(optDefValue.getValue()); |
36 |
✓ |
2 |
OptionValue optVecDefValue(vecVal, OptionType::STRING, vecVal); |
37 |
✓✓✓✓
|
1 |
phoenix_print(optVecDefValue.getValue()); |
38 |
|
|
|
39 |
✓✓ |
1 |
optVecDefValue.setValue("val"); |
40 |
✓ |
1 |
optVecDefValue.setValue(vecVal); |
41 |
|
|
|
42 |
✓✓ |
3 |
OptionValue optPossibleDefValue("value", OptionType::STRING, vecVal, vecVal); |
43 |
✓✓✓✓
|
1 |
phoenix_print(optPossibleDefValue.getValue()); |
44 |
✓ |
1 |
OptionValue optVecPossibleDefValue(vecVal, OptionType::STRING, vecVal, vecVal); |
45 |
✓✓✓✓
|
1 |
phoenix_print(optVecPossibleDefValue.getValue()); |
46 |
|
|
|
47 |
✓✓✓✓
|
1 |
phoenix_print(optVecPossibleDefValue.getDefaultValue()); |
48 |
✓✓✓✓
|
1 |
phoenix_print(optVecPossibleDefValue.getPossibleValue()); |
49 |
✓✓ |
1 |
phoenix_functionOk("testOptionValue", b); |
50 |
|
2 |
return b; |
51 |
|
|
} |
52 |
|
|
|
53 |
|
1 |
int main(int argc, char** argv){ |
54 |
|
1 |
bool b(testOptionValue()); |
55 |
✓✓ |
1 |
phoenix_functionOk("final", b); |
56 |
|
1 |
return b - 1; |
57 |
|
|
} |
58 |
|
|
|
59 |
|
|
|