Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 37
Open
Description
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 categoriesAndreyTokmakov and LB--