Open lirui311012 opened 2 years ago
Does diff cover report any missing lines? In the scenario you described I would not expect diff cover to report any lines as missing ...
Can you show an example?
for example: Unmodified code: src/test.cpp
using namespace std;
int main()
{
int a = 10;
int b= 20;
int c = a + b;
cout << (a + b) << endl;
return 0;
}
Modified code: src/test.cpp
using namespace std;
int main()
{
int a = 10;
int b= 20;
// int c = a + b;
cout << (a + b) << endl;
return 0;
}
The comparison can be found, int c = a + b; is blocked but,This line of code should not be calculated into the incremental code, so that is 100% coverage However, in the actual test, this line of blocked code is calculated as incremental code and is not covered by the google test unit test case
It sounds like the coverage report is returning something incorrect? Diff cover does not compute coverage itself.
It takes coverage computed by another tool and compares it to the diff.
So if the underlying coverage tool is reporting the wrong thing then you need to look at that tool.
After integrating diff-cover, a line of code appears to be commented out, and the incremental code coverage is 0. How to solve this? I think adding a line of comment code, this line of code will not be compiled, then the denominator of the incremental coverage should be 0, so the coverage should be 100%