1
Fork 0

coverage: Enable branch coverage in the branch coverage tests

This commit is contained in:
Zalathar 2024-03-10 21:20:27 +11:00
parent 31d0b50178
commit 5fb1f61a77
12 changed files with 295 additions and 139 deletions

View file

@ -1,6 +1,6 @@
LL| |#![feature(coverage_attribute)]
LL| |//@ edition: 2021
LL| |
LL| |//@ compile-flags: -Zcoverage-options=branch
LL| |//@ llvm-cov-flags: --show-branches=count
LL| |
LL| |macro_rules! no_merge {
@ -14,6 +14,9 @@
LL| |
LL| 1| let mut a = 8;
LL| 9| while a > 0 {
------------------
| Branch (LL:11): [True: 8, False: 1]
------------------
LL| 8| a -= 1;
LL| 8| }
LL| 1|}
@ -23,6 +26,9 @@
LL| |
LL| 1| let mut a = 8;
LL| 9| while !(a == 0) {
------------------
| Branch (LL:11): [True: 8, False: 1]
------------------
LL| 8| a -= 1;
LL| 8| }
LL| 1|}
@ -33,6 +39,10 @@
LL| 1| let mut a = 8;
LL| 1| let mut b = 4;
LL| 5| while a > 0 && b > 0 {
------------------
| Branch (LL:11): [True: 5, False: 0]
| Branch (LL:20): [True: 4, False: 1]
------------------
LL| 4| a -= 1;
LL| 4| b -= 1;
LL| 4| }
@ -45,6 +55,10 @@
LL| 1| let mut b = 8;
LL| 9| while a > 0 || b > 0 {
^5
------------------
| Branch (LL:11): [True: 4, False: 5]
| Branch (LL:20): [True: 4, False: 1]
------------------
LL| 8| a -= 1;
LL| 8| b -= 1;
LL| 8| }