Directory: | ./ |
---|---|
File: | tmp_project/PhoenixDataStream/TESTS/TEST_DATA_FILE/main_list_pair.cpp |
Date: | 2025-03-14 12:18:05 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 41 | 41 | 100.0% |
Branches: | 67 | 67 | 100.0% |
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 | 288 | void testSimpleListPairValue(const std::string & testName, size_t nbValue){ | |
15 |
1/1✓ Branch 2 taken 144 times.
|
288 | std::string fileName("value_test_list_pair.data"); |
16 | |||
17 | 288 | std::list<std::pair<T, U> > vecRef; | |
18 |
3/3✓ Branch 2 taken 1440 times.
✓ Branch 4 taken 1440 times.
✓ Branch 5 taken 144 times.
|
3168 | for(size_t i(0lu); i < nbValue; ++i){vecRef.push_back(std::pair<T, U>(i,2lu*i));} |
19 |
5/5✓ Branch 2 taken 144 times.
✓ Branch 6 taken 144 times.
✓ Branch 10 taken 144 times.
✓ Branch 13 taken 144 times.
✓ Branch 16 taken 144 times.
|
288 | data_stream_assert(data_save(fileName, vecRef)); |
20 | |||
21 | 288 | std::list<std::pair<T, U> > vecValue; | |
22 |
5/5✓ Branch 2 taken 144 times.
✓ Branch 6 taken 144 times.
✓ Branch 10 taken 144 times.
✓ Branch 13 taken 144 times.
✓ Branch 16 taken 144 times.
|
288 | data_stream_assert(data_load(fileName, vecValue)); |
23 |
5/5✓ Branch 2 taken 144 times.
✓ Branch 6 taken 144 times.
✓ Branch 10 taken 144 times.
✓ Branch 13 taken 144 times.
✓ Branch 16 taken 144 times.
|
288 | data_stream_assert(checkValue(testName, vecValue, vecRef)); |
24 | 288 | } | |
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 | 24 | void testSetListPairValue(const std::string & firstTypeName, size_t nbValue){ | |
32 |
2/2✓ Branch 2 taken 12 times.
✓ Branch 5 taken 12 times.
|
24 | testSimpleListPairValue<T, long unsigned int>("std::list<std::pair<"+firstTypeName+", long unsigned int> >", nbValue); |
33 |
2/2✓ Branch 2 taken 12 times.
✓ Branch 5 taken 12 times.
|
24 | testSimpleListPairValue<T, unsigned int>("std::list<std::pair<"+firstTypeName+", unsigned int> >", nbValue); |
34 |
2/2✓ Branch 2 taken 12 times.
✓ Branch 5 taken 12 times.
|
24 | testSimpleListPairValue<T, unsigned short>("std::list<std::pair<"+firstTypeName+", unsigned short> >", nbValue); |
35 |
2/2✓ Branch 2 taken 12 times.
✓ Branch 5 taken 12 times.
|
24 | testSimpleListPairValue<T, unsigned char>("std::list<std::pair<"+firstTypeName+", unsigned char> >", nbValue); |
36 | |||
37 |
2/2✓ Branch 2 taken 12 times.
✓ Branch 5 taken 12 times.
|
24 | testSimpleListPairValue<T, long int>("std::list<std::pair<"+firstTypeName+", long int> >", nbValue); |
38 |
2/2✓ Branch 2 taken 12 times.
✓ Branch 5 taken 12 times.
|
24 | testSimpleListPairValue<T, int>("std::list<std::pair<"+firstTypeName+", int> >", nbValue); |
39 |
2/2✓ Branch 2 taken 12 times.
✓ Branch 5 taken 12 times.
|
24 | testSimpleListPairValue<T, short>("std::list<std::pair<"+firstTypeName+", short> >", nbValue); |
40 |
2/2✓ Branch 2 taken 12 times.
✓ Branch 5 taken 12 times.
|
24 | testSimpleListPairValue<T, char>("std::list<std::pair<"+firstTypeName+", char> >", nbValue); |
41 |
2/2✓ Branch 2 taken 12 times.
✓ Branch 5 taken 12 times.
|
24 | testSimpleListPairValue<T, int8_t>("std::list<std::pair<"+firstTypeName+", int8_t> >", nbValue); |
42 |
2/2✓ Branch 2 taken 12 times.
✓ Branch 5 taken 12 times.
|
24 | testSimpleListPairValue<T, float>("std::list<std::pair<"+firstTypeName+", float> >", nbValue); |
43 |
2/2✓ Branch 2 taken 12 times.
✓ Branch 5 taken 12 times.
|
24 | testSimpleListPairValue<T, double>("std::list<std::pair<"+firstTypeName+", double> >", nbValue); |
44 |
2/2✓ Branch 2 taken 12 times.
✓ Branch 5 taken 12 times.
|
24 | testSimpleListPairValue<T, bool>("std::list<std::pair<"+firstTypeName+", bool> >", nbValue); |
45 | 24 | } | |
46 | |||
47 | ///Test if data size is Ok | ||
48 | 1 | void testListPairDataFile(){ | |
49 | 1 | size_t nbValue(10lu); | |
50 |
2/2✓ Branch 2 taken 1 times.
✓ Branch 5 taken 1 times.
|
1 | testSetListPairValue<long unsigned int>("long unsigned int", nbValue); |
51 |
2/2✓ Branch 2 taken 1 times.
✓ Branch 5 taken 1 times.
|
1 | testSetListPairValue<unsigned int>("unsigned int", nbValue); |
52 |
2/2✓ Branch 2 taken 1 times.
✓ Branch 5 taken 1 times.
|
1 | testSetListPairValue<unsigned short>("unsigned short", nbValue); |
53 |
2/2✓ Branch 2 taken 1 times.
✓ Branch 5 taken 1 times.
|
1 | testSetListPairValue<unsigned char>("unsigned char", nbValue); |
54 |
2/2✓ Branch 2 taken 1 times.
✓ Branch 5 taken 1 times.
|
1 | testSetListPairValue<long int>("long int", nbValue); |
55 |
2/2✓ Branch 2 taken 1 times.
✓ Branch 5 taken 1 times.
|
1 | testSetListPairValue<int>("int", nbValue); |
56 |
2/2✓ Branch 2 taken 1 times.
✓ Branch 5 taken 1 times.
|
1 | testSetListPairValue<short>("short", nbValue); |
57 |
2/2✓ Branch 2 taken 1 times.
✓ Branch 5 taken 1 times.
|
1 | testSetListPairValue<char>("char", nbValue); |
58 |
2/2✓ Branch 2 taken 1 times.
✓ Branch 5 taken 1 times.
|
1 | testSetListPairValue<int8_t>("int8_t", nbValue); |
59 |
2/2✓ Branch 2 taken 1 times.
✓ Branch 5 taken 1 times.
|
1 | testSetListPairValue<float>("float", nbValue); |
60 |
2/2✓ Branch 2 taken 1 times.
✓ Branch 5 taken 1 times.
|
1 | testSetListPairValue<double>("double", nbValue); |
61 |
2/2✓ Branch 2 taken 1 times.
✓ Branch 5 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 |