GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: tmp_project/StringUtils/TESTS/TEST_VECTOR_SPLIT/main.cpp Lines: 32 32 100.0 %
Date: 2024-12-09 15:30:52 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
2
	std::vector<int> vecInt;
17
11
	for(size_t i(0lu); i < 10lu; ++i){
18
10
		vecInt.push_back((int)i);
19
	}
20
21
2
	std::vector<std::vector<int> > vecVecInt;
22
23
1
	phoenix_vector_split(vecVecInt, vecInt, 2lu);
24
1
	std::cout << "testVectorSplit : vecInt :" << std::endl;
25
1
	phoenix_print(vecInt);
26
1
	std::cout << "testVectorSplit : vecVecInt :" << std::endl;
27
1
	phoenix_print(vecVecInt);
28
29
6
	for(int i(0); i < 5; ++i){
30

5
		phoenix_assert(vecVecInt[0][i] == 2*i);
31

5
		phoenix_assert(vecVecInt[1][i] == 2*i + 1);
32
	}
33
1
}
34
35
///Test the string filename function
36
1
void testVectorSplit2(){
37
2
	std::vector<int> vecInt;
38
3
	for(size_t i(0lu); i < 2lu; ++i){
39
2
		vecInt.push_back((int)i);
40
	}
41
42
2
	std::vector<std::vector<int> > vecVecInt;
43
44
1
	phoenix_vector_split(vecVecInt, vecInt, 6lu);
45
1
	std::cout << "testVectorSplit2 : vecInt :" << std::endl;
46
1
	phoenix_print(vecInt);
47
1
	std::cout << "testVectorSplit2 : vecVecInt :" << std::endl;
48
1
	phoenix_print(vecVecInt);
49
50
2
	for(int i(0); i < 1; ++i){
51

1
		phoenix_assert(vecVecInt[0][i] == 2*i);
52

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