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 "dico_replace_var.h" |
10 |
|
|
#include "parser_yml.h" |
11 |
|
|
|
12 |
|
|
///Check the embeded dico |
13 |
|
|
/** @return true on success, false otherwise |
14 |
|
|
*/ |
15 |
|
2 |
bool checkReplaceVarDicoConfig(const std::string & fileName, const std::string & varIdentifier){ |
16 |
✓✓✓✓ ✓✓ |
2 |
std::cout << "\ncheckReplaceVarDicoEmpty('"<<fileName<<"', varIdentifier = '"<<varIdentifier<<"') :" << std::endl; |
17 |
✓ |
4 |
DicoValue dico; |
18 |
|
2 |
bool b(true); |
19 |
✓ |
2 |
b &= parser_yml(dico, fileName); |
20 |
✓✓ |
2 |
std::cout << "================================================" << std::endl; |
21 |
✓✓ |
2 |
std::cout << "checkCompactDico : output DicoValue :" << std::endl; |
22 |
✓✓ |
2 |
std::cout << "================================================" << std::endl; |
23 |
✓ |
2 |
dico.print(); |
24 |
✓ |
2 |
dico_replace_var(dico, varIdentifier); |
25 |
|
|
|
26 |
✓✓ |
2 |
std::cout << "================================================" << std::endl; |
27 |
✓✓ |
2 |
std::cout << "checkCompactDico : after var replace DicoValue :" << std::endl; |
28 |
✓✓ |
2 |
std::cout << "================================================" << std::endl; |
29 |
✓ |
2 |
dico.print(); |
30 |
|
|
|
31 |
✓✓✓ |
6 |
std::string dl1FileName(phoenix_get_string(dico, "dl1_filename", "")); |
32 |
✓✓✓✓
|
2 |
std::cout << "dl1_filename = '" << dl1FileName << "', expected = 'dl1_sb_id_12345_obs_id_67899_tel_id_1_line_idx_§{processIndex}_thread_idx_§{threadIndex}_th_file_idx_§{threadFileId}_file_idx_§{fileIndex}.h5'" << std::endl; |
33 |
|
2 |
b &= dl1FileName == "dl1_sb_id_12345_obs_id_67899_tel_id_1_line_idx_§{processIndex}_thread_idx_§{threadIndex}_th_file_idx_§{threadFileId}_file_idx_§{fileIndex}.h5"; |
34 |
✓✓✓ |
4 |
std::string commonAbsPath(phoenix_get_string(dico, "common_abs_path", "")); |
35 |
✓✓✓✓
|
2 |
std::cout << "common_abs_path = '" << commonAbsPath << "', expected = '/fefs/aswg/workspace/enrique.garcia/RTA/second_night'" << std::endl; |
36 |
|
2 |
b &= commonAbsPath == "/fefs/aswg/workspace/enrique.garcia/RTA/second_night"; |
37 |
✓✓ |
2 |
phoenix_functionOk("checkReplaceVarDicoConfig", b); |
38 |
|
4 |
return b; |
39 |
|
|
} |
40 |
|
|
|
41 |
|
|
|
42 |
|
1 |
int main(int argc, char** argv){ |
43 |
✓✓✓ |
1 |
bool b(checkReplaceVarDicoConfig(CONFIG_YML, "$")); |
44 |
✓✓✓ |
1 |
b &= checkReplaceVarDicoConfig(CONFIG_YML_SECTION, "§"); |
45 |
✓✓ |
1 |
phoenix_functionOk("final", b); |
46 |
|
1 |
return b - 1; |
47 |
|
|
} |
48 |
|
|
|
49 |
|
|
|