| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /*************************************** | ||
| 2 | Auteur : Pierre Aubert | ||
| 3 | Mail : pierre.aubert@lapp.in2p3.fr | ||
| 4 | Licence : LGPL-3.0-only | ||
| 5 | ****************************************/ | ||
| 6 | |||
| 7 | #include "data_stream_assert.h" | ||
| 8 | #include "data_stream_check_value.h" | ||
| 9 | #include "data_size.h" | ||
| 10 | #include "data_file.h" | ||
| 11 | #include "data_message.h" | ||
| 12 | |||
| 13 | /// @brief Test if DataStream size works with pointer type attributes | ||
| 14 | 1 | void testPointerSize(){ | |
| 15 | 1 | int* value = NULL; | |
| 16 |
7/7✓ Branch 0 (4→5) taken 1 times.
✓ Branch 2 (5→6) taken 1 times.
✓ Branch 4 (6→7) taken 1 times.
✓ Branch 6 (9→10) taken 1 times.
✓ Branch 8 (12→13) taken 1 times.
✓ Branch 10 (15→16) taken 1 times.
✓ Branch 12 (16→17) taken 1 times.
|
7 | data_stream_assert(checkValue("int*", data_size(value), 8lu)); |
| 17 | 1 | } | |
| 18 | |||
| 19 | /// @brief Test if DataStream READ/WRITE file works with pointer type attribute | ||
| 20 | 1 | void testReadWritePointerFile(){ | |
| 21 | 1 | int value = 42; | |
| 22 | 1 | int* address = &value; | |
| 23 | |||
| 24 |
6/6✓ Branch 0 (4→5) taken 1 times.
✓ Branch 2 (5→6) taken 1 times.
✓ Branch 4 (8→9) taken 1 times.
✓ Branch 6 (11→12) taken 1 times.
✓ Branch 8 (14→15) taken 1 times.
✓ Branch 10 (15→16) taken 1 times.
|
7 | data_stream_assert(data_save("ptr", address)); |
| 25 | 1 | int* readAddress = NULL; | |
| 26 |
6/6✓ Branch 0 (26→27) taken 1 times.
✓ Branch 2 (27→28) taken 1 times.
✓ Branch 4 (30→31) taken 1 times.
✓ Branch 6 (33→34) taken 1 times.
✓ Branch 8 (36→37) taken 1 times.
✓ Branch 10 (37→38) taken 1 times.
|
8 | data_stream_assert(data_load("ptr", readAddress)); |
| 27 |
6/6✓ Branch 0 (48→49) taken 1 times.
✓ Branch 2 (49→50) taken 1 times.
✓ Branch 4 (52→53) taken 1 times.
✓ Branch 6 (55→56) taken 1 times.
✓ Branch 8 (58→59) taken 1 times.
✓ Branch 10 (59→60) taken 1 times.
|
7 | data_stream_assert(checkValue("testPtrFile", readAddress, address)); |
| 28 | 1 | } | |
| 29 | |||
| 30 | /// @brief Test if DataStream READ/WRITE message works with pointer type attribute | ||
| 31 | 1 | void testReadWritePointerMessage(){ | |
| 32 | 1 | int value = 42; | |
| 33 | 1 | int* address = &value; | |
| 34 | |||
| 35 | 1 | DataStreamMsg msg; | |
| 36 |
2/2✓ Branch 0 (3→4) taken 1 times.
✓ Branch 2 (4→5) taken 1 times.
|
1 | msg.resize(data_size(address)); |
| 37 | 1 | DataStreamIter iter = msg.data(); | |
| 38 |
5/5✓ Branch 0 (6→7) taken 1 times.
✓ Branch 2 (9→10) taken 1 times.
✓ Branch 4 (12→13) taken 1 times.
✓ Branch 6 (15→16) taken 1 times.
✓ Branch 8 (16→17) taken 1 times.
|
6 | data_stream_assert(data_message_save(iter, address)); |
| 39 | 1 | int* readAddress = NULL; | |
| 40 | 1 | DataStreamIter iterLoad = msg.data(); | |
| 41 |
5/5✓ Branch 0 (24→25) taken 1 times.
✓ Branch 2 (27→28) taken 1 times.
✓ Branch 4 (30→31) taken 1 times.
✓ Branch 6 (33→34) taken 1 times.
✓ Branch 8 (34→35) taken 1 times.
|
7 | data_stream_assert(data_message_load(iterLoad, readAddress)); |
| 42 |
6/6✓ Branch 0 (43→44) taken 1 times.
✓ Branch 2 (44→45) taken 1 times.
✓ Branch 4 (47→48) taken 1 times.
✓ Branch 6 (50→51) taken 1 times.
✓ Branch 8 (53→54) taken 1 times.
✓ Branch 10 (54→55) taken 1 times.
|
7 | data_stream_assert(checkValue("testPtrMessage", readAddress, address)); |
| 43 | 1 | } | |
| 44 | |||
| 45 | 1 | int main(int argc, char** argv){ | |
| 46 | 1 | testPointerSize(); | |
| 47 | 1 | testReadWritePointerFile(); | |
| 48 | 1 | testReadWritePointerMessage(); | |
| 49 | 1 | return 0; | |
| 50 | } | ||
| 51 |