UTBotCpp
UTBotCpp copied to clipboard
Strange coverage report for `switch` statement
Description
Colorization of coverage report for switch looks inconsistent, for instance case: line may be shown uncovered while inside that branch everything is covered.
To Reproduce Generate and run tests on following code and look at coverage report.
int my_switch(int i) {
int result = 0;
switch (i) {
case 0:
result = 0;
break;
case 1:
result = 100;
break;
case -1:
result = -100;
break;
default:
result = -1;
break;
}
return result;
}
Expected behavior All lines are green. Because UTBot actually generated tests for all four branches.
Actual behavior

There are number of problems with coverage report shown above:
-
switch (i)line is red, but should be green in this case, as all branches are covered -
caseandbreaklines are green, butresultassignment is red (should be green too) - lines inside
defaultbranch are red and brown but should be green
Additional sample
Generate and run tests for enums.c#getSignValue in c-examples project

Note that switch(s) is red, but should be brown because some branches are covered and default is not.