Directory: | ./ |
---|---|
File: | tmp_project/PhoenixString/TESTS/TEST_VECTOR_SPLIT/main.cpp |
Date: | 2024-07-27 10:53:27 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 32 | 32 | 100.0% |
Branches: | 48 | 48 | 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 "print_string.h" | ||
12 | #include "phoenix_vector_split.h" | ||
13 | |||
14 | ///Test the string filename function | ||
15 | 1 | void testVectorSplit(){ | |
16 | 1 | std::vector<int> vecInt; | |
17 |
2/2✓ Branch 0 taken 10 times.
✓ Branch 1 taken 1 times.
|
11 | for(size_t i(0lu); i < 10lu; ++i){ |
18 |
1/1✓ Branch 1 taken 10 times.
|
10 | vecInt.push_back((int)i); |
19 | } | ||
20 | |||
21 | 1 | std::vector<std::vector<int> > vecVecInt; | |
22 | |||
23 |
1/1✓ Branch 1 taken 1 times.
|
1 | phoenix_vector_split(vecVecInt, vecInt, 2lu); |
24 |
2/2✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
|
1 | std::cout << "testVectorSplit : vecInt :" << std::endl; |
25 |
3/3✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 9 taken 1 times.
|
1 | phoenix_print(vecInt); |
26 |
2/2✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
|
1 | std::cout << "testVectorSplit : vecVecInt :" << std::endl; |
27 |
3/3✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 9 taken 1 times.
|
1 | phoenix_print(vecVecInt); |
28 | |||
29 |
2/2✓ Branch 0 taken 5 times.
✓ Branch 1 taken 1 times.
|
6 | for(int i(0); i < 5; ++i){ |
30 |
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); |
31 |
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); |
32 | } | ||
33 | 1 | } | |
34 | |||
35 | ///Test the string filename function | ||
36 | 1 | void testVectorSplit2(){ | |
37 | 1 | std::vector<int> vecInt; | |
38 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 1 times.
|
3 | for(size_t i(0lu); i < 2lu; ++i){ |
39 |
1/1✓ Branch 1 taken 2 times.
|
2 | vecInt.push_back((int)i); |
40 | } | ||
41 | |||
42 | 1 | std::vector<std::vector<int> > vecVecInt; | |
43 | |||
44 |
1/1✓ Branch 1 taken 1 times.
|
1 | phoenix_vector_split(vecVecInt, vecInt, 6lu); |
45 |
2/2✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
|
1 | std::cout << "testVectorSplit2 : vecInt :" << std::endl; |
46 |
3/3✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 9 taken 1 times.
|
1 | phoenix_print(vecInt); |
47 |
2/2✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
|
1 | std::cout << "testVectorSplit2 : vecVecInt :" << std::endl; |
48 |
3/3✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 9 taken 1 times.
|
1 | phoenix_print(vecVecInt); |
49 | |||
50 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 1 times.
|
2 | for(int i(0); i < 1; ++i){ |
51 |
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); |
52 |
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); |
53 | } | ||
54 | 1 | } | |
55 | |||
56 | 1 | int main(int argc, char** argv){ | |
57 | 1 | testVectorSplit(); | |
58 | 1 | testVectorSplit2(); | |
59 | 1 | return 0; | |
60 | } | ||
61 | |||
62 | |||
63 |