| Line | Branch | Condition | Exec | Source |
|---|---|---|---|---|
| 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 | 1 | Bar() : m_param(1) | ||
| 11 | 1 | {} | ||
| 12 | 1 | virtual ~Bar() | ||
| 13 | 1 | {} // possible compiler-generated destruction code - auto-detected and excluded | ||
| 14 | ||||
| 15 | private: | |||
| 16 | int m_param; | |||
| 17 | }; | |||
| 18 | ||||
| 19 | 1 | int main(int argc, char* argv[]) { | ||
| 20 |
2/2✓ Branch 0 (5→3) taken 5 times.
✓ Branch 1 (5→6) taken 1 times.
|
2/2✓ Fully covered.
|
6 | for (int i = 0; i < 5; i++) { // 2/2 branches |
| 21 | 5 | 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 | 1 | return 0; | ||
| 33 | } // compiler-generated destruction code - auto-detected and excluded | |||
| 34 | ||||
| 35 | // total: 8/10 branches reported | |||
| 36 | ||||
| 37 |