GCC Code Coverage Report | |||||||||||||||||||||
|
|||||||||||||||||||||
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 <unistd.h> |
||
9 |
#include <iostream> |
||
10 |
#include "phoenix_assert.h" |
||
11 |
#include "ProgressBarr.h" |
||
12 |
#include "ProgressTime.h" |
||
13 |
|||
14 |
///Test the ProgressBarr |
||
15 |
/** @return true on success, false otherwise |
||
16 |
*/ |
||
17 |
1 |
bool testProgressBar(){ |
|
18 |
1 |
size_t nbValue(1000); |
|
19 |
✓ | 2 |
ProgressBarr progress(nbValue); |
20 |
|||
21 |
✓✓ | 1001 |
for(size_t i(0lu); i < nbValue; ++i){ |
22 |
✓ | 1000 |
progress.progress(i); |
23 |
|||
24 |
✓ | 1000 |
usleep(500); |
25 |
} |
||
26 |
✓ | 1 |
progress.finish(); |
27 |
|||
28 |
✓✓ | 2 |
ProgressBarr progress2(progress), progress3; |
29 |
✓ | 1 |
progress3 = progress2; |
30 |
|||
31 |
✓✓✓✓ ✓✓✓ |
1 |
std::cout << "testProgressBar : max = " << progress3.getMax() << ", size = " << progress3.getSize() << std::endl; |
32 |
✓✓✓✓ ✓✓✓✓ ✓✓✓ |
1 |
std::cout << "chPlein = '" << progress3.getChPlein() << "', chMiddle = '" << progress3.getChMiddle() << "', chEnd = '" << progress3.getChEnd() << "'" << std::endl; |
33 |
|||
34 |
✓ | 1 |
progress3.setMax(42); |
35 |
✓ | 1 |
progress3.setSize(100); |
36 |
✓ | 1 |
progress3.setChPlein('='); |
37 |
✓ | 1 |
progress3.setChMiddle('>'); |
38 |
✓ | 1 |
progress3.setChEnd(' '); |
39 |
|||
40 |
✓ | 2 |
ProgressBarr progress4; |
41 |
✓ | 1 |
progress3 = progress4; |
42 |
✓ | 1 |
progress3.progress(500); |
43 |
✓ | 1 |
progress3.progress(400); |
44 |
|||
45 |
✓ | 1 |
ProgressBarr progress5; |
46 |
✓✓✓✓ |
1 |
std::cout << "testProgressBar : progress5.getMax() = " << progress5.getMax() << std::endl; |
47 |
|||
48 |
2 |
return true; |
|
49 |
} |
||
50 |
|||
51 |
///Test the ProgressTime |
||
52 |
/** @return true on success, false otherwise |
||
53 |
*/ |
||
54 |
1 |
bool testProgressTime(){ |
|
55 |
1 |
size_t nbValue(1000); |
|
56 |
✓ | 2 |
ProgressTime progress(nbValue); |
57 |
|||
58 |
✓ | 1 |
progress.start(); |
59 |
✓✓ | 1001 |
for(size_t i(0lu); i < nbValue; ++i){ |
60 |
✓ | 1000 |
progress.print(); |
61 |
|||
62 |
✓ | 1000 |
usleep(500); |
63 |
} |
||
64 |
✓ | 1 |
progress.finish(); |
65 |
|||
66 |
✓✓ | 2 |
ProgressTime progress2(progress), progress3; |
67 |
✓ | 1 |
progress3 = progress2; |
68 |
|||
69 |
✓ | 1 |
progress3.setNbSteps(42); |
70 |
✓ | 1 |
progress3.setChPlein('='); |
71 |
✓ | 1 |
progress3.setChMiddle('>'); |
72 |
✓ | 1 |
progress3.setChEnd(' '); |
73 |
|||
74 |
✓ | 1 |
ProgressTime progress4(42); |
75 |
✓ | 1 |
progress3 = progress4; |
76 |
✓ | 1 |
progress3.print(); |
77 |
✓ | 1 |
progress3.finish(); |
78 |
|||
79 |
2 |
return true; |
|
80 |
} |
||
81 |
|||
82 |
1 |
int main(int argc, char** argv){ |
|
83 |
✓✓✓✓ ✓ |
1 |
phoenix_assert(testProgressBar()); |
84 |
✓✓✓✓ ✓ |
1 |
phoenix_assert(testProgressTime()); |
85 |
1 |
return 0; |
|
86 |
} |
||
87 |
|||
88 |
Generated by: GCOVR (Version 4.2) |