GCC Code Coverage Report


Directory: tests/exclude-line-branch/
File: main.cpp
Date: 2025-09-27 21:24:05+00:00
Coverage Exec Excl Total
Lines: 80.0% 8 2 12
Functions: 100.0% 3 0 3
Branches: 100.0% 2 0 2
Conditions: 100.0% 2 0 2

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 5 → 3 taken 5 times.
✓ Branch 5 → 6 taken 1 time.
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