Skip to content

path coverage vs branch coverage vs line coverage#516

@lefticus

Description

@lefticus

Also watch these videos by Jorgen.

https://www.youtube.com/watch?v=kkAsakZCCAY

voidfunc(bool a, bool b){int *ptr = nullptr; if (a){ptr = newint(42)} if (b){delete ptr} } voidtest_1(){func(false, false); // 2 uncovered lines, 50% branch coverage, 25% path coverage } voidtest_2(){// these stats are true by themselvesfunc(true, true); // 100% line coverage 50% branch coverage, 25% path coverage } voidtest_3(){func(false, false); func(true, true); // now we have 100% branch coverage and 50% path coverage and still a resource leak } voidtest_4(){func(false, true); func(false, false); func(true, false); // only this one exposes the memory leakfunc(true, true); // finally 100% of all 3 categories

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions