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