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