i\'m trying to use lcov for code coverage metrics, but I cannot get branches coverage to work.
Here\'s how i\'m using it:
g++ -ggdb3 --coverage src/read.
Sorry, not so much an "idea" as a confirmation that you're doing everything correctly. Your exact commands worked on this simple code:
#include
using namespace std;
bool foo(int i)
{
if (i != 0) {
return 12 / i;
} else {
return 0;
}
}
int main(int argc, char** argv)
{
cout << foo(argc) << endl;
return 0;
}
The lcov coverage table has statistics for Lines, Functions, and Branches. Maybe double-check that you're actually looking at the correct output HTML?