Directory: | ./ |
---|---|
File: | tmp_project/PhoenixDataStream/TESTS/TEST_DATA_FILE/main_vector.cpp |
Date: | 2025-03-14 11:54:19 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 26 | 26 | 100.0% |
Branches: | 43 | 43 | 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 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 | 22 | void testSimpleVectorValue(const std::string & testTypeName){ | |
14 |
1/1✓ Branch 2 taken 11 times.
|
22 | std::string fileName("value_test_vector.data"); |
15 | 22 | size_t nbValue(10lu); | |
16 | 22 | std::vector<T> vecRef; | |
17 |
3/3✓ Branch 1 taken 110 times.
✓ Branch 3 taken 110 times.
✓ Branch 4 taken 11 times.
|
242 | for(size_t i(0lu); i < nbValue; ++i){vecRef.push_back(i);} |
18 |
5/5✓ Branch 2 taken 11 times.
✓ Branch 6 taken 11 times.
✓ Branch 10 taken 11 times.
✓ Branch 13 taken 11 times.
✓ Branch 16 taken 11 times.
|
22 | data_stream_assert(data_save(fileName, vecRef)); |
19 | 22 | std::vector<T> vecValue; | |
20 |
5/5✓ Branch 2 taken 11 times.
✓ Branch 6 taken 11 times.
✓ Branch 10 taken 11 times.
✓ Branch 13 taken 11 times.
✓ Branch 16 taken 11 times.
|
22 | data_stream_assert(data_load(fileName, vecValue)); |
21 |
7/7✓ Branch 2 taken 11 times.
✓ Branch 6 taken 11 times.
✓ Branch 10 taken 11 times.
✓ Branch 13 taken 11 times.
✓ Branch 16 taken 11 times.
✓ Branch 19 taken 11 times.
✓ Branch 22 taken 11 times.
|
22 | data_stream_assert(checkValue("std::vector<"+testTypeName+">", vecValue, vecRef)); |
22 | 22 | } | |
23 | |||
24 | ///Test if data size is Ok | ||
25 | 1 | void testVectorDataFile(){ | |
26 |
2/2✓ Branch 2 taken 1 times.
✓ Branch 5 taken 1 times.
|
1 | testSimpleVectorValue<long unsigned int>("long unsigned int"); |
27 |
2/2✓ Branch 2 taken 1 times.
✓ Branch 5 taken 1 times.
|
1 | testSimpleVectorValue<unsigned int>("unsigned int"); |
28 |
2/2✓ Branch 2 taken 1 times.
✓ Branch 5 taken 1 times.
|
1 | testSimpleVectorValue<unsigned short>("unsigned short"); |
29 |
2/2✓ Branch 2 taken 1 times.
✓ Branch 5 taken 1 times.
|
1 | testSimpleVectorValue<unsigned char>("unsigned char"); |
30 |
2/2✓ Branch 2 taken 1 times.
✓ Branch 5 taken 1 times.
|
1 | testSimpleVectorValue<long int>("long int"); |
31 |
2/2✓ Branch 2 taken 1 times.
✓ Branch 5 taken 1 times.
|
1 | testSimpleVectorValue<int>("int"); |
32 |
2/2✓ Branch 2 taken 1 times.
✓ Branch 5 taken 1 times.
|
1 | testSimpleVectorValue<short>("short"); |
33 |
2/2✓ Branch 2 taken 1 times.
✓ Branch 5 taken 1 times.
|
1 | testSimpleVectorValue<char>("char"); |
34 |
2/2✓ Branch 2 taken 1 times.
✓ Branch 5 taken 1 times.
|
1 | testSimpleVectorValue<int8_t>("int8_t"); |
35 |
2/2✓ Branch 2 taken 1 times.
✓ Branch 5 taken 1 times.
|
1 | testSimpleVectorValue<float>("float"); |
36 |
2/2✓ Branch 2 taken 1 times.
✓ Branch 5 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 |