Replaced hard coded 0 in total test coverage#1140
Conversation
with covered lines / total total lines. Rounding to 17 decimal places since that's what I found when looking at cobertura examples online. Used an rpad to generate the format mask to avoid having a long string of 9s. This was mentioned in utPLSQL#1107 but does not have an issue of its own.
I introduced the error in the previous commit. To fix I added a l_lines_valid variable, used a case statement to check for 0 else return the calculation. I also replaced the lines_valid calculation to use the new variable to reduce code duplication.
There was a problem hiding this comment.
integer will be better, as the lines are always integer
| ||'" branch-rate="0.0" lines-covered="' | ||
| ||a_coverage_data.covered_lines||'" lines-valid="' | ||
| ||TO_CHAR(a_coverage_data.covered_lines + a_coverage_data.uncovered_lines) | ||
| ||TO_CHAR(l_lines_valid) |
There was a problem hiding this comment.
can you make this TO_CHAR lowercase since you've touched this line?
| ut_utils.append_to_list( | ||
| l_result, | ||
| '<coverage line-rate="0" branch-rate="0.0" lines-covered="' | ||
| '<coverage line-rate="' |
|
Thank you @OsBlaineOra for the improvement. |
There was a problem hiding this comment.
it should probably be:
to_char( value , 'TM9' , 'NLS_NUMERIC_CHARACTERS=''. ''' ) to make sure it is OK for values of "0".
See those failing tests for extra "." present there.
The tests need to be fixed as they all assume the line-rate to be ZERO.
https://app.travis-ci.com/github/utPLSQL/utPLSQL/jobs/536073612#L6935

with covered lines / total total lines.
Rounding to 17 decimal places since that's what I found when looking at cobertura examples online.
Used an rpad to generate the format mask to avoid having a long string of 9s.
This was mentioned in #1107 but does not have an issue of its own.