| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /*************************************** | ||
| 2 | Auteur : Pierre Aubert | ||
| 3 | Mail : pierre.aubert@lapp.in2p3.fr | ||
| 4 | Licence : CeCILL-C | ||
| 5 | ****************************************/ | ||
| 6 | |||
| 7 | #include "phoenix_assert.h" | ||
| 8 | #include "data_all.h" | ||
| 9 | #include "FieldParser.h" | ||
| 10 | |||
| 11 | typedef std::vector<char> Message; | ||
| 12 | typedef std::vector<Message > VecMessage; | ||
| 13 | |||
| 14 | |||
| 15 | ///Dump all the messages bytes | ||
| 16 | 1 | void testMessageParsing(const std::string & fileName){ | |
| 17 | 1 | VecMessage vecInMessage; | |
| 18 |
5/5✓ Branch 0 (5→6) taken 1 times.
✓ Branch 2 (8→9) taken 1 times.
✓ Branch 4 (11→12) taken 1 times.
✓ Branch 6 (12→13) taken 1 times.
✓ Branch 8 (13→14) taken 1 times.
|
5 | phoenix_assert(data_load(fileName, vecInMessage)); |
| 19 | |||
| 20 |
1/1✓ Branch 0 (24→25) taken 1 times.
|
1 | phoenix_printFieldMessage(vecInMessage.front().data(), vecInMessage.front().size()); |
| 21 | |||
| 22 |
1/1✓ Branch 0 (25→26) taken 1 times.
|
1 | FieldParser parser; |
| 23 | 1 | size_t field1(0lu); | |
| 24 | 1 | unsigned int field3(0); | |
| 25 |
2/2✓ Branch 0 (26→27) taken 1 times.
✓ Branch 2 (27→28) taken 1 times.
|
1 | parser.addParseFieldEnum(&field1, 1lu, "Field 1"); |
| 26 |
2/2✓ Branch 0 (29→30) taken 1 times.
✓ Branch 2 (30→31) taken 1 times.
|
1 | parser.addParseFieldValue(&field3, 3lu, "Field 3"); |
| 27 | //Expected values of field 3 | ||
| 28 |
1/1✓ Branch 0 (34→35) taken 1 times.
|
2 | std::vector<unsigned int> vecExpectedField3 = {628325 ,628326, 628327,628328,628329,628330,628331,628332,628333,628334}; |
| 29 | |||
| 30 | 1 | size_t i(0lu); | |
| 31 | 1 | std::vector<unsigned int>::iterator itCheckField3 = vecExpectedField3.begin(); | |
| 32 |
2/2✓ Branch 0 (113→38) taken 10 times.
✓ Branch 1 (113→114) taken 1 times.
|
22 | for(VecMessage::iterator it(vecInMessage.begin()); it != vecInMessage.end(); ++it){ |
| 33 |
5/5✓ Branch 0 (40→41) taken 10 times.
✓ Branch 2 (43→44) taken 10 times.
✓ Branch 4 (46→47) taken 10 times.
✓ Branch 6 (49→50) taken 10 times.
✓ Branch 8 (50→51) taken 10 times.
|
60 | phoenix_assert(parser.load(*it)); |
| 34 |
5/5✓ Branch 0 (57→58) taken 10 times.
✓ Branch 2 (58→59) taken 10 times.
✓ Branch 4 (59→60) taken 10 times.
✓ Branch 6 (60→61) taken 10 times.
✓ Branch 8 (61→62) taken 10 times.
|
10 | std::cout << "testMessageParsing("<<i<<") : field 1 has value " << field1 << std::endl; |
| 35 |
4/4✓ Branch 0 (64→65) taken 10 times.
✓ Branch 2 (67→68) taken 10 times.
✓ Branch 4 (70→71) taken 10 times.
✓ Branch 6 (71→72) taken 10 times.
|
50 | phoenix_assert(field1 == 16lu); |
| 36 |
5/5✓ Branch 0 (78→79) taken 10 times.
✓ Branch 2 (79→80) taken 10 times.
✓ Branch 4 (80→81) taken 10 times.
✓ Branch 6 (81→82) taken 10 times.
✓ Branch 8 (82→83) taken 10 times.
|
10 | std::cout << "testMessageParsing("<<i<<") : field 3 has value " << field3 << std::endl; |
| 37 |
4/4✓ Branch 0 (85→86) taken 10 times.
✓ Branch 2 (88→89) taken 10 times.
✓ Branch 4 (91→92) taken 10 times.
✓ Branch 6 (94→95) taken 10 times.
|
70 | phoenix_assert(*itCheckField3 == field3); |
| 38 | ++itCheckField3; | ||
| 39 | 10 | ++i; | |
| 40 | } | ||
| 41 | 1 | } | |
| 42 | |||
| 43 | |||
| 44 | 1 | int main(){ | |
| 45 |
1/1✓ Branch 0 (4→5) taken 1 times.
|
1 | std::string fileName(STREAM_DATA_CUT); |
| 46 |
1/1✓ Branch 0 (6→7) taken 1 times.
|
1 | testMessageParsing(fileName); |
| 47 | 1 | return 0; | |
| 48 | 1 | } | |
| 49 |