| 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_data_stream.h" | ||
| 8 | |||
| 9 | ///Abstract check a vector of values stored in a file | ||
| 10 | /** @param testName : name of the type use in the test | ||
| 11 | */ | ||
| 12 | template<typename T> | ||
| 13 | 11 | void testSimpleVectorValue(const std::string & testTypeName){ | |
| 14 |
1/1✓ Branch 0 (4→5) taken 11 times.
|
11 | std::string fileName("value_test_vector.data"); |
| 15 | 11 | size_t nbValue(10lu); | |
| 16 | 11 | std::vector<T> vecRef; | |
| 17 |
3/3✓ Branch 0 (8→9) taken 110 times.
✓ Branch 2 (10→8) taken 110 times.
✓ Branch 3 (10→11) taken 11 times.
|
121 | for(size_t i(0lu); i < nbValue; ++i){vecRef.push_back(i);} |
| 18 |
5/5✓ Branch 0 (13→14) taken 11 times.
✓ Branch 2 (16→17) taken 11 times.
✓ Branch 4 (19→20) taken 11 times.
✓ Branch 6 (20→21) taken 11 times.
✓ Branch 8 (21→22) taken 11 times.
|
55 | data_stream_assert(data_save(fileName, vecRef)); |
| 19 | 11 | std::vector<T> vecValue; | |
| 20 |
5/5✓ Branch 0 (31→32) taken 11 times.
✓ Branch 2 (34→35) taken 11 times.
✓ Branch 4 (37→38) taken 11 times.
✓ Branch 6 (38→39) taken 11 times.
✓ Branch 8 (39→40) taken 11 times.
|
66 | data_stream_assert(data_load(fileName, vecValue)); |
| 21 |
7/7✓ Branch 0 (48→49) taken 11 times.
✓ Branch 2 (51→52) taken 11 times.
✓ Branch 4 (54→55) taken 11 times.
✓ Branch 6 (55→56) taken 11 times.
✓ Branch 8 (56→57) taken 11 times.
✓ Branch 10 (57→58) taken 11 times.
✓ Branch 12 (58→59) taken 11 times.
|
55 | data_stream_assert(checkValue("std::vector<"+testTypeName+">", vecValue, vecRef)); |
| 22 | 11 | } | |
| 23 | |||
| 24 | ///Test if data size is Ok | ||
| 25 | 1 | void testVectorDataFile(){ | |
| 26 |
2/2✓ Branch 0 (4→5) taken 1 times.
✓ Branch 2 (5→6) taken 1 times.
|
2 | testSimpleVectorValue<long unsigned int>("long unsigned int"); |
| 27 |
2/2✓ Branch 0 (10→11) taken 1 times.
✓ Branch 2 (11→12) taken 1 times.
|
2 | testSimpleVectorValue<unsigned int>("unsigned int"); |
| 28 |
2/2✓ Branch 0 (16→17) taken 1 times.
✓ Branch 2 (17→18) taken 1 times.
|
2 | testSimpleVectorValue<unsigned short>("unsigned short"); |
| 29 |
2/2✓ Branch 0 (22→23) taken 1 times.
✓ Branch 2 (23→24) taken 1 times.
|
2 | testSimpleVectorValue<unsigned char>("unsigned char"); |
| 30 |
2/2✓ Branch 0 (28→29) taken 1 times.
✓ Branch 2 (29→30) taken 1 times.
|
2 | testSimpleVectorValue<long int>("long int"); |
| 31 |
2/2✓ Branch 0 (34→35) taken 1 times.
✓ Branch 2 (35→36) taken 1 times.
|
2 | testSimpleVectorValue<int>("int"); |
| 32 |
2/2✓ Branch 0 (40→41) taken 1 times.
✓ Branch 2 (41→42) taken 1 times.
|
2 | testSimpleVectorValue<short>("short"); |
| 33 |
2/2✓ Branch 0 (46→47) taken 1 times.
✓ Branch 2 (47→48) taken 1 times.
|
2 | testSimpleVectorValue<char>("char"); |
| 34 |
2/2✓ Branch 0 (52→53) taken 1 times.
✓ Branch 2 (53→54) taken 1 times.
|
2 | testSimpleVectorValue<int8_t>("int8_t"); |
| 35 |
2/2✓ Branch 0 (58→59) taken 1 times.
✓ Branch 2 (59→60) taken 1 times.
|
2 | testSimpleVectorValue<float>("float"); |
| 36 |
2/2✓ Branch 0 (64→65) taken 1 times.
✓ Branch 2 (65→66) taken 1 times.
|
1 | testSimpleVectorValue<double>("double"); |
| 37 | 1 | } | |
| 38 | |||
| 39 | 1 | int main(int argc, char** argv){ | |
| 40 | 1 | testVectorDataFile(); | |
| 41 | 1 | return 0; | |
| 42 | } | ||
| 43 | |||
| 44 | |||
| 45 |