GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: tmp_project/StringUtils/TESTS/TEST_PTIMER/main.cpp Lines: 21 21 100.0 %
Date: 2024-12-09 15:30:52 Branches: 36 36 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 "phoenix_assert.h"
10
#include "PTimer.h"
11
12
///Test the PTimer
13
1
void testPTimer(){
14
2
	PTimer timer1(1000000000lu);
15
2
	PTimer timer2;
16
1
	timer2.setEllapsedTime(100000000lu);
17
18
1
	size_t counter(0lu), counterTimer2(0lu);
19
243900
	while(!timer1.isTime()){
20
243899
		size_t ellapsedTimeNs(0lu);
21
243899
		if(timer2.isTime(ellapsedTimeNs)){
22

9
			std::cerr << counterTimer2 << " : " << ellapsedTimeNs << std::endl;
23
9
			++counterTimer2;
24
		}
25
243899
		++counter;
26
	}
27
// 	std::cout << "counter\t= " << counter << std::endl;
28
// 	std::cout << "counterTimer2\t= " << counterTimer2 << std::endl;
29
30

1
	phoenix_assert(timer1.getEllapsedTime() == 1000000000lu);
31

1
	phoenix_assert(timer2.getEllapsedTime() == 100000000lu);
32
2
	PTimer timer3(timer2), timer4;
33
1
	timer4 = timer1;
34
35

1
	phoenix_assert(timer4.getEllapsedTime() == 1000000000lu);
36

1
	phoenix_assert(timer3.getEllapsedTime() == 100000000lu);
37
1
}
38
39
1
int main(int argc, char** argv){
40
1
	testPTimer();
41
1
	return 0;
42
}
43
44