Directory: | ./ |
---|---|
File: | tmp_project/PhoenixFileParser/tmp_project/PhoenixCore/TESTS/TEST_VECTOR_SPLIT/main.cpp |
Date: | 2025-03-14 11:45:13 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 24 | 24 | 100.0% |
Branches: | 28 | 28 | 100.0% |
Line | Branch | Exec | Source |
---|---|---|---|
1 | |||
2 | /*************************************** | ||
3 | Auteur : Pierre Aubert | ||
4 | Mail : pierre.aubert@lapp.in2p3.fr | ||
5 | Licence : CeCILL-C | ||
6 | ****************************************/ | ||
7 | |||
8 | #include <iostream> | ||
9 | #include <vector> | ||
10 | #include "phoenix_assert.h" | ||
11 | #include "phoenix_vector_split.h" | ||
12 | |||
13 | ///Test the string filename function | ||
14 | 1 | void testVectorSplit(){ | |
15 | 1 | std::vector<int> vecInt; | |
16 |
2/2✓ Branch 0 taken 10 times.
✓ Branch 1 taken 1 times.
|
11 | for(size_t i(0lu); i < 10lu; ++i){ |
17 |
1/1✓ Branch 1 taken 10 times.
|
10 | vecInt.push_back((int)i); |
18 | } | ||
19 | 1 | std::vector<std::vector<int> > vecVecInt; | |
20 |
1/1✓ Branch 1 taken 1 times.
|
1 | phoenix_vector_split(vecVecInt, vecInt, 2lu); |
21 |
2/2✓ Branch 0 taken 5 times.
✓ Branch 1 taken 1 times.
|
6 | for(int i(0); i < 5; ++i){ |
22 |
4/4✓ Branch 2 taken 5 times.
✓ Branch 6 taken 5 times.
✓ Branch 10 taken 5 times.
✓ Branch 15 taken 5 times.
|
5 | phoenix_assert(vecVecInt[0][i] == 2*i); |
23 |
4/4✓ Branch 2 taken 5 times.
✓ Branch 6 taken 5 times.
✓ Branch 10 taken 5 times.
✓ Branch 15 taken 5 times.
|
5 | phoenix_assert(vecVecInt[1][i] == 2*i + 1); |
24 | } | ||
25 | 1 | } | |
26 | |||
27 | ///Test the string filename function | ||
28 | 1 | void testVectorSplit2(){ | |
29 | 1 | std::vector<int> vecInt; | |
30 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 1 times.
|
3 | for(size_t i(0lu); i < 2lu; ++i){ |
31 |
1/1✓ Branch 1 taken 2 times.
|
2 | vecInt.push_back((int)i); |
32 | } | ||
33 | |||
34 | 1 | std::vector<std::vector<int> > vecVecInt; | |
35 |
1/1✓ Branch 1 taken 1 times.
|
1 | phoenix_vector_split(vecVecInt, vecInt, 6lu); |
36 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 1 times.
|
2 | for(int i(0); i < 1; ++i){ |
37 |
4/4✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 15 taken 1 times.
|
1 | phoenix_assert(vecVecInt[0][i] == 2*i); |
38 |
4/4✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 15 taken 1 times.
|
1 | phoenix_assert(vecVecInt[1][i] == 2*i + 1); |
39 | } | ||
40 | 1 | } | |
41 | |||
42 | 1 | int main(int argc, char** argv){ | |
43 | 1 | testVectorSplit(); | |
44 | 1 | testVectorSplit2(); | |
45 | 1 | return 0; | |
46 | } | ||
47 | |||
48 | |||
49 |