Directory: | ./ |
---|---|
File: | TESTS/TEST_PTIMER/main.cpp |
Date: | 2025-03-25 16:20:12 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 23 | 23 | 100.0% |
Branches: | 11 | 11 | 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 "PTimer.h" | ||
9 | |||
10 | /// @brief test if setTimer works | ||
11 | /// @return true on success, false on failure | ||
12 | 1 | bool testPtimer(){ | |
13 |
1/1✓ Branch 1 taken 1 times.
|
1 | PTimer timer(1000l); |
14 | 1 | time_t currentTime = 0l; | |
15 |
1/1✓ Branch 1 taken 1 times.
|
1 | timer.setStartTime(currentTime); |
16 |
1/1✓ Branch 1 taken 1 times.
|
1 | bool bRet = !timer.isTime(currentTime); |
17 |
1/1✓ Branch 1 taken 1 times.
|
1 | bRet&=timer.isTime(1000l); |
18 | 1 | return bRet; | |
19 | 1 | } | |
20 | |||
21 | 1 | bool testCopyPtimer(){ | |
22 |
1/1✓ Branch 1 taken 1 times.
|
1 | PTimer timer(1000l); |
23 |
1/1✓ Branch 1 taken 1 times.
|
1 | PTimer timer2(timer); |
24 | 1 | time_t currentTime = 0l; | |
25 |
1/1✓ Branch 1 taken 1 times.
|
1 | timer.setEllapsedTime(currentTime); |
26 |
1/1✓ Branch 1 taken 1 times.
|
1 | bool bRet = timer.getEllapsedTime() == currentTime; |
27 |
1/1✓ Branch 1 taken 1 times.
|
1 | PTimer timer3; |
28 |
1/1✓ Branch 1 taken 1 times.
|
1 | timer3 = timer; |
29 |
1/1✓ Branch 1 taken 1 times.
|
1 | bRet&=timer3.getEllapsedTime() == currentTime; |
30 | 1 | return bRet; | |
31 | 1 | } | |
32 | |||
33 | 1 | int main(int argc, char** argv){ | |
34 | 1 | bool b = testPtimer(); | |
35 | 1 | b&=testCopyPtimer(); | |
36 | 1 | return b-1; | |
37 | } | ||
38 | |||
39 | |||
40 |