Directory: | ./ |
---|---|
File: | tmp_project/PhoenixString/TESTS/TEST_PTIMER/main.cpp |
Date: | 2024-07-27 10:53:27 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 21 | 21 | 100.0% |
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 |
1/1✓ Branch 1 taken 1 times.
|
1 | PTimer timer1(1000000000lu); |
15 |
1/1✓ Branch 1 taken 1 times.
|
1 | PTimer timer2; |
16 |
1/1✓ Branch 1 taken 1 times.
|
1 | timer2.setEllapsedTime(100000000lu); |
17 | |||
18 | 1 | size_t counter(0lu), counterTimer2(0lu); | |
19 |
3/3✓ Branch 1 taken 10805478 times.
✓ Branch 3 taken 10805477 times.
✓ Branch 4 taken 1 times.
|
10805478 | while(!timer1.isTime()){ |
20 | 10805477 | size_t ellapsedTimeNs(0lu); | |
21 |
3/3✓ Branch 1 taken 10805477 times.
✓ Branch 3 taken 9 times.
✓ Branch 4 taken 10805468 times.
|
10805477 | if(timer2.isTime(ellapsedTimeNs)){ |
22 |
4/4✓ Branch 1 taken 9 times.
✓ Branch 4 taken 9 times.
✓ Branch 7 taken 9 times.
✓ Branch 10 taken 9 times.
|
9 | std::cerr << counterTimer2 << " : " << ellapsedTimeNs << std::endl; |
23 | 9 | ++counterTimer2; | |
24 | } | ||
25 | 10805477 | ++counter; | |
26 | } | ||
27 | // std::cout << "counter\t= " << counter << std::endl; | ||
28 | // std::cout << "counterTimer2\t= " << counterTimer2 << std::endl; | ||
29 | |||
30 |
5/5✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
|
1 | phoenix_assert(timer1.getEllapsedTime() == 1000000000lu); |
31 |
5/5✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
|
1 | phoenix_assert(timer2.getEllapsedTime() == 100000000lu); |
32 |
2/2✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
|
1 | PTimer timer3(timer2), timer4; |
33 |
1/1✓ Branch 1 taken 1 times.
|
1 | timer4 = timer1; |
34 | |||
35 |
5/5✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
|
1 | phoenix_assert(timer4.getEllapsedTime() == 1000000000lu); |
36 |
5/5✓ Branch 2 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 16 taken 1 times.
|
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 | |||
45 |