| 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 of values stored in a file | ||
| 10 | /** @param testName : name of the test | ||
| 11 | * @param nbValue : number of values to put in the reference list | ||
| 12 | */ | ||
| 13 | template<typename T, typename U> | ||
| 14 | 144 | void testSimpleListPairValue(const std::string & testName, size_t nbValue){ | |
| 15 |
1/1✓ Branch 0 (4→5) taken 144 times.
|
144 | std::string fileName("value_test_list_pair.data"); |
| 16 | |||
| 17 | 144 | std::list<std::pair<T, U> > vecRef; | |
| 18 |
3/3✓ Branch 0 (9→10) taken 1440 times.
✓ Branch 2 (11→8) taken 1440 times.
✓ Branch 3 (11→12) taken 144 times.
|
1584 | for(size_t i(0lu); i < nbValue; ++i){vecRef.push_back(std::pair<T, U>(i,2lu*i));} |
| 19 |
5/5✓ Branch 0 (14→15) taken 144 times.
✓ Branch 2 (17→18) taken 144 times.
✓ Branch 4 (20→21) taken 144 times.
✓ Branch 6 (21→22) taken 144 times.
✓ Branch 8 (22→23) taken 144 times.
|
720 | data_stream_assert(data_save(fileName, vecRef)); |
| 20 | |||
| 21 | 144 | std::list<std::pair<T, U> > vecValue; | |
| 22 |
5/5✓ Branch 0 (32→33) taken 144 times.
✓ Branch 2 (35→36) taken 144 times.
✓ Branch 4 (38→39) taken 144 times.
✓ Branch 6 (39→40) taken 144 times.
✓ Branch 8 (40→41) taken 144 times.
|
864 | data_stream_assert(data_load(fileName, vecValue)); |
| 23 |
5/5✓ Branch 0 (49→50) taken 144 times.
✓ Branch 2 (52→53) taken 144 times.
✓ Branch 4 (55→56) taken 144 times.
✓ Branch 6 (56→57) taken 144 times.
✓ Branch 8 (57→58) taken 144 times.
|
720 | data_stream_assert(checkValue(testName, vecValue, vecRef)); |
| 24 | 144 | } | |
| 25 | |||
| 26 | ///Abstract check of values stored in a file | ||
| 27 | /** @param firstTypeName : name of the first type | ||
| 28 | * @param nbValue : number of values to put in the reference list | ||
| 29 | */ | ||
| 30 | template<typename T> | ||
| 31 | 12 | void testSetListPairValue(const std::string & firstTypeName, size_t nbValue){ | |
| 32 |
3/3✓ Branch 0 (2→3) taken 12 times.
✓ Branch 2 (3→4) taken 12 times.
✓ Branch 4 (4→5) taken 12 times.
|
12 | testSimpleListPairValue<T, long unsigned int>("std::list<std::pair<"+firstTypeName+", long unsigned int> >", nbValue); |
| 33 |
3/3✓ Branch 0 (7→8) taken 12 times.
✓ Branch 2 (8→9) taken 12 times.
✓ Branch 4 (9→10) taken 12 times.
|
12 | testSimpleListPairValue<T, unsigned int>("std::list<std::pair<"+firstTypeName+", unsigned int> >", nbValue); |
| 34 |
3/3✓ Branch 0 (12→13) taken 12 times.
✓ Branch 2 (13→14) taken 12 times.
✓ Branch 4 (14→15) taken 12 times.
|
12 | testSimpleListPairValue<T, unsigned short>("std::list<std::pair<"+firstTypeName+", unsigned short> >", nbValue); |
| 35 |
3/3✓ Branch 0 (17→18) taken 12 times.
✓ Branch 2 (18→19) taken 12 times.
✓ Branch 4 (19→20) taken 12 times.
|
12 | testSimpleListPairValue<T, unsigned char>("std::list<std::pair<"+firstTypeName+", unsigned char> >", nbValue); |
| 36 | |||
| 37 |
3/3✓ Branch 0 (22→23) taken 12 times.
✓ Branch 2 (23→24) taken 12 times.
✓ Branch 4 (24→25) taken 12 times.
|
12 | testSimpleListPairValue<T, long int>("std::list<std::pair<"+firstTypeName+", long int> >", nbValue); |
| 38 |
3/3✓ Branch 0 (27→28) taken 12 times.
✓ Branch 2 (28→29) taken 12 times.
✓ Branch 4 (29→30) taken 12 times.
|
12 | testSimpleListPairValue<T, int>("std::list<std::pair<"+firstTypeName+", int> >", nbValue); |
| 39 |
3/3✓ Branch 0 (32→33) taken 12 times.
✓ Branch 2 (33→34) taken 12 times.
✓ Branch 4 (34→35) taken 12 times.
|
12 | testSimpleListPairValue<T, short>("std::list<std::pair<"+firstTypeName+", short> >", nbValue); |
| 40 |
3/3✓ Branch 0 (37→38) taken 12 times.
✓ Branch 2 (38→39) taken 12 times.
✓ Branch 4 (39→40) taken 12 times.
|
12 | testSimpleListPairValue<T, char>("std::list<std::pair<"+firstTypeName+", char> >", nbValue); |
| 41 |
3/3✓ Branch 0 (42→43) taken 12 times.
✓ Branch 2 (43→44) taken 12 times.
✓ Branch 4 (44→45) taken 12 times.
|
12 | testSimpleListPairValue<T, int8_t>("std::list<std::pair<"+firstTypeName+", int8_t> >", nbValue); |
| 42 |
3/3✓ Branch 0 (47→48) taken 12 times.
✓ Branch 2 (48→49) taken 12 times.
✓ Branch 4 (49→50) taken 12 times.
|
12 | testSimpleListPairValue<T, float>("std::list<std::pair<"+firstTypeName+", float> >", nbValue); |
| 43 |
3/3✓ Branch 0 (52→53) taken 12 times.
✓ Branch 2 (53→54) taken 12 times.
✓ Branch 4 (54→55) taken 12 times.
|
12 | testSimpleListPairValue<T, double>("std::list<std::pair<"+firstTypeName+", double> >", nbValue); |
| 44 |
3/3✓ Branch 0 (57→58) taken 12 times.
✓ Branch 2 (58→59) taken 12 times.
✓ Branch 4 (59→60) taken 12 times.
|
12 | testSimpleListPairValue<T, bool>("std::list<std::pair<"+firstTypeName+", bool> >", nbValue); |
| 45 | 12 | } | |
| 46 | |||
| 47 | ///Test if data size is Ok | ||
| 48 | 1 | void testListPairDataFile(){ | |
| 49 | 1 | size_t nbValue(10lu); | |
| 50 |
2/2✓ Branch 0 (4→5) taken 1 times.
✓ Branch 2 (5→6) taken 1 times.
|
2 | testSetListPairValue<long unsigned int>("long unsigned int", nbValue); |
| 51 |
2/2✓ Branch 0 (10→11) taken 1 times.
✓ Branch 2 (11→12) taken 1 times.
|
2 | testSetListPairValue<unsigned int>("unsigned int", nbValue); |
| 52 |
2/2✓ Branch 0 (16→17) taken 1 times.
✓ Branch 2 (17→18) taken 1 times.
|
2 | testSetListPairValue<unsigned short>("unsigned short", nbValue); |
| 53 |
2/2✓ Branch 0 (22→23) taken 1 times.
✓ Branch 2 (23→24) taken 1 times.
|
2 | testSetListPairValue<unsigned char>("unsigned char", nbValue); |
| 54 |
2/2✓ Branch 0 (28→29) taken 1 times.
✓ Branch 2 (29→30) taken 1 times.
|
2 | testSetListPairValue<long int>("long int", nbValue); |
| 55 |
2/2✓ Branch 0 (34→35) taken 1 times.
✓ Branch 2 (35→36) taken 1 times.
|
2 | testSetListPairValue<int>("int", nbValue); |
| 56 |
2/2✓ Branch 0 (40→41) taken 1 times.
✓ Branch 2 (41→42) taken 1 times.
|
2 | testSetListPairValue<short>("short", nbValue); |
| 57 |
2/2✓ Branch 0 (46→47) taken 1 times.
✓ Branch 2 (47→48) taken 1 times.
|
2 | testSetListPairValue<char>("char", nbValue); |
| 58 |
2/2✓ Branch 0 (52→53) taken 1 times.
✓ Branch 2 (53→54) taken 1 times.
|
2 | testSetListPairValue<int8_t>("int8_t", nbValue); |
| 59 |
2/2✓ Branch 0 (58→59) taken 1 times.
✓ Branch 2 (59→60) taken 1 times.
|
2 | testSetListPairValue<float>("float", nbValue); |
| 60 |
2/2✓ Branch 0 (64→65) taken 1 times.
✓ Branch 2 (65→66) taken 1 times.
|
2 | testSetListPairValue<double>("double", nbValue); |
| 61 |
2/2✓ Branch 0 (70→71) taken 1 times.
✓ Branch 2 (71→72) taken 1 times.
|
1 | testSetListPairValue<bool>("bool", nbValue); |
| 62 | 1 | } | |
| 63 | |||
| 64 | 1 | int main(int argc, char** argv){ | |
| 65 | 1 | testListPairDataFile(); | |
| 66 | 1 | return 0; | |
| 67 | } | ||
| 68 | |||
| 69 | |||
| 70 |