Directory: | ./ |
---|---|
File: | program/main_info.cpp |
Date: | 2025-03-14 11:54:19 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 24 | 24 | 100.0% |
Branches: | 28 | 29 | 96.6% |
Line | Branch | Exec | Source |
---|---|---|---|
1 | /*************************************** | ||
2 | Auteur : Pierre Aubert | ||
3 | Mail : pierre.aubert@lapp.in2p3.fr | ||
4 | Licence : CeCILL-C | ||
5 | ****************************************/ | ||
6 | |||
7 | #include "OptionParser.h" | ||
8 | |||
9 | #include "phoenix_mock.h" | ||
10 | |||
11 | ///Create the OptionParser of this program | ||
12 | /** @return OptionParser of this program | ||
13 | */ | ||
14 | 2 | OptionParser createOptionParser(){ | |
15 |
1/1✓ Branch 2 taken 2 times.
|
2 | OptionParser parser(true, __PROGRAM_VERSION__); |
16 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | parser.setExampleLongOption("phoenix_mock_info --input=file.pmock"); |
17 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | parser.setExampleShortOption("phoenix_mock_info -i file2.mock file2.pmock"); |
18 | |||
19 |
4/4✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
✓ Branch 7 taken 2 times.
✓ Branch 10 taken 2 times.
|
2 | parser.addOption("input", "i", OptionType::FILENAME, true, "List of input mock to get the info"); |
20 | 2 | return parser; | |
21 | } | ||
22 | |||
23 | ///Merge mock files | ||
24 | /** @param vecInputFile : vector of input files to print the info | ||
25 | * @return true on success, false otherwise | ||
26 | */ | ||
27 | 2 | bool infoMock(const std::vector<PString> & vecInputFile){ | |
28 | 2 | bool b(true); | |
29 |
5/6✓ Branch 4 taken 2 times.
✓ Branch 5 taken 2 times.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 2 times.
✓ Branch 9 taken 2 times.
|
4 | for(std::vector<PString>::const_iterator itFile(vecInputFile.begin()); itFile != vecInputFile.end() && b; ++itFile){ |
30 | 2 | std::vector<std::vector<char> > vecTmpFile; | |
31 |
3/3✓ Branch 2 taken 2 times.
✓ Branch 4 taken 1 times.
✓ Branch 5 taken 1 times.
|
2 | if(data_load(*itFile, vecTmpFile)){ |
32 | 1 | size_t nbMessageIn(vecTmpFile.size()); | |
33 |
5/5✓ Branch 1 taken 1 times.
✓ Branch 5 taken 1 times.
✓ Branch 8 taken 1 times.
✓ Branch 11 taken 1 times.
✓ Branch 14 taken 1 times.
|
1 | std::cout << "Mock '"<<(*itFile)<<"' : nbMessage = " << nbMessageIn << std::endl; |
34 | }else{ | ||
35 | 1 | b = false; | |
36 | } | ||
37 | 2 | } | |
38 | 2 | return b; | |
39 | } | ||
40 | |||
41 | 2 | int main(int argc, char** argv){ | |
42 |
1/1✓ Branch 1 taken 2 times.
|
2 | OptionParser parser = createOptionParser(); |
43 |
1/1✓ Branch 1 taken 2 times.
|
2 | parser.parseArgument(argc, argv); |
44 |
1/1✓ Branch 1 taken 2 times.
|
2 | const OptionMode & defaultMode = parser.getDefaultMode(); |
45 | 2 | std::vector<PString> vecInputFile; | |
46 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
2 | defaultMode.getValue(vecInputFile, "input"); |
47 |
1/1✓ Branch 1 taken 2 times.
|
2 | return infoMock(vecInputFile) - 1; |
48 | 2 | } | |
49 | |||
50 | |||
51 |