EDIT some more motivation: branch coverage is much more useful than line coverage because line coverage tends to overcount, eg:
proc foo(bar: int)=
if bar == 1:
# suppose this has 100 lines of code
else:
echo "baz"
foo(1)
with LOC (line of code) coverage, coverage is 103/105 = almost 100%
with branch coverage, coverage is 50% (need to check that number)
in terms of making sure unittests/tests cover a codebase, it's irrelevant how large is each code block and branch coverage is the correct metric to track.
see my previous forum post https://forum.dlang.org/thread/mailman.3083.1517859192.9493.digitalmars-d@puremagic.com (-cov LOC is inadequate for 1 liner branching; need a metric based on branching) which applies to Nim as well
EDIT some more motivation: branch coverage is much more useful than line coverage because line coverage tends to overcount, eg:
with LOC (line of code) coverage, coverage is 103/105 = almost 100% with branch coverage, coverage is 50% (need to check that number) in terms of making sure unittests/tests cover a codebase, it's irrelevant how large is each code block and branch coverage is the correct metric to track.