main.cpp
80.0% Lines (8 / 10, 2 excl)
100.0% Branches (2 / 2)
100.0% Conditions (2 / 2)
100.0% Functions (3 / 3)
Functions (3)
Function
Calls
Lines
Branches
Blocks
Bar::Bar()
:10
1x
100.0%
–
100.0%
Bar::~Bar()
:12
1x
0.0%
–
100.0%
main
:19
1x
100.0%
100.0%
100.0%
| Line | Branch | Condition | TLA | Hits | Source Code |
|---|---|---|---|---|---|
| 1 | #include <iostream> | ||||
| 2 | #include <cstring> | ||||
| 3 | |||||
| 4 | extern int foo(int param); | ||||
| 5 | extern int bar(int param); | ||||
| 6 | |||||
| 7 | class Bar | ||||
| 8 | { | ||||
| 9 | public: | ||||
| 10 | 1x | Bar() : m_param(1) | |||
| 11 | 1x | {} | |||
| 12 | 1x | virtual ~Bar() | |||
| 13 | 1x | {} // possible compiler-generated destruction code - auto-detected and excluded | |||
| 14 | |||||
| 15 | private: | ||||
| 16 | int m_param; | ||||
| 17 | }; | ||||
| 18 | |||||
| 19 | 1x | int main(int argc, char* argv[]) { | |||
| 20 |
2/2✓ Branch 5 → 3 taken 5 times.
✓ Branch 5 → 6 taken 1 time.
|
2/2✓ Fully covered.
|
6x | for (int i = 0; i < 5; i++) { // 2/2 branches | |
| 21 | 5x | foo(i); | |||
| 22 | } | ||||
| 23 | |||||
| 24 | try { | ||||
| 25 | − | Bar bar; // LCOV_EXCL_LINE | |||
| 26 | − | } catch (const std::exception &e) { // LCOV_EXCL_START | |||
| 27 | std::cout << "caught exception"; | ||||
| 28 | std::cout << ": " << e.what(); | ||||
| 29 | std::cout << std::endl; | ||||
| 30 | } // LCOV_EXCL_STOP | ||||
| 31 | |||||
| 32 | 1x | return 0; | |||
| 33 | } // compiler-generated destruction code - auto-detected and excluded | ||||
| 34 | |||||
| 35 | // total: 8/10 branches reported | ||||
| 36 | |||||
| 37 |