GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: tmp_project/DataStream/TESTS/TEST_CHECK_VALUE/main.cpp Lines: 65 65 100.0 %
Date: 2024-12-09 15:30:52 Branches: 143 143 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 "data_stream_assert.h"
8
#include "data_stream_check_value.h"
9
10
///Test if data size is Ok
11
1
void testCheckValue(){
12
1
	int tabValue[] = {1, 2, 3, 4};
13
1
	int tabValue2[] = {2, 3, 4, 5};
14
15

1
	data_stream_assert(checkValue("Check Int", 42, 42));
16

1
	data_stream_assert(checkValue("Check Tab Int OK", tabValue, tabValue, 4lu));
17

1
	data_stream_assert(!checkValue("Check Tab Int Wrong", tabValue, tabValue2, 4lu));
18
19
2
	std::vector<int> vecA, vecB, vecC;
20
1
	vecA.push_back(1);
21
1
	vecA.push_back(2);
22
1
	vecB.push_back(1);
23
1
	vecB.push_back(1);
24
1
	vecB.push_back(1);
25
1
	vecC.push_back(1);
26
1
	vecC.push_back(1);
27
28

1
	data_stream_assert(checkValue("Check Vec Int OK", vecA, vecA));
29

1
	data_stream_assert(!checkValue("Check Vec Int Wrong size", vecA, vecB));
30

1
	data_stream_assert(!checkValue("Check Vec Int Wrong", vecA, vecC));
31
32
2
	std::list<int> listA, listB, listC;
33
1
	listA.push_back(1);
34
1
	listA.push_back(2);
35
1
	listB.push_back(1);
36
1
	listB.push_back(1);
37
1
	listB.push_back(1);
38
1
	listC.push_back(1);
39
1
	listC.push_back(1);
40
41

1
	data_stream_assert(checkValue("Check List Int OK", listA, listA));
42

1
	data_stream_assert(!checkValue("Check List Int Wrong size", listA, listB));
43

1
	data_stream_assert(!checkValue("Check List Int Wrong", listA, listC));
44
45
2
	std::map<int, int> mapA, mapB, mapC;
46
1
	mapA[0] = 1;
47
1
	mapA[1] = 2;
48
1
	mapB[0] = 1;
49
1
	mapB[1] = 1;
50
1
	mapB[2] = 1;
51
1
	mapC[3] = 1;
52
1
	mapC[4] = 1;
53
54

1
	data_stream_assert(checkValue("Check Map Int OK", mapA, mapA));
55

1
	data_stream_assert(!checkValue("Check Map Int Wrong size", mapA, mapB));
56

1
	data_stream_assert(!checkValue("Check Map Int Wrong", mapA, mapC));
57
58
2
	std::vector<std::pair<int, int> > vecPairA, vecPairB, vecPairC;
59
1
	vecPairA.push_back(std::pair<int, int>(1,0));
60
1
	vecPairA.push_back(std::pair<int, int>(2,0));
61
1
	vecPairB.push_back(std::pair<int, int>(1,0));
62
1
	vecPairB.push_back(std::pair<int, int>(1,0));
63
1
	vecPairB.push_back(std::pair<int, int>(1,0));
64
1
	vecPairC.push_back(std::pair<int, int>(1,0));
65
1
	vecPairC.push_back(std::pair<int, int>(1,0));
66
67

1
	data_stream_assert(checkValue("Check VecPair Int OK", vecPairA, vecPairA));
68

1
	data_stream_assert(!checkValue("Check VecPair Int Wrong size", vecPairA, vecPairB));
69

1
	data_stream_assert(!checkValue("Check VecPair Int Wrong", vecPairA, vecPairC));
70
71
2
	std::list<std::pair<int, int> > listPairA, listPairB, listPairC;
72
1
	listPairA.push_back(std::pair<int, int>(1,0));
73
1
	listPairA.push_back(std::pair<int, int>(2,0));
74
1
	listPairB.push_back(std::pair<int, int>(1,0));
75
1
	listPairB.push_back(std::pair<int, int>(1,0));
76
1
	listPairB.push_back(std::pair<int, int>(1,0));
77
1
	listPairC.push_back(std::pair<int, int>(1,0));
78
1
	listPairC.push_back(std::pair<int, int>(1,0));
79
80

1
	data_stream_assert(checkValue("Check ListPair Int OK", listPairA, listPairA));
81

1
	data_stream_assert(!checkValue("Check ListPair Int Wrong size", listPairA, listPairB));
82

1
	data_stream_assert(!checkValue("Check ListPair Int Wrong", listPairA, listPairC));
83
1
}
84
85
1
int main(int argc, char** argv){
86
1
	testCheckValue();
87
1
	return 0;
88
}
89