diff options
| author | Zalathar <Zalathar@users.noreply.github.com> | 2024-04-17 11:41:40 +1000 |
|---|---|---|
| committer | Zalathar <Zalathar@users.noreply.github.com> | 2024-04-17 11:41:40 +1000 |
| commit | 40cfc2de77a605a2b373c0767037065d304d556a (patch) | |
| tree | 3888ac3aa319b1e93e312b2bd8ab2d575b237cfb /tests/coverage/branch_if.rs | |
| parent | 3fba2782310b2754259a3c329220a5b1e6cf9a5c (diff) | |
| download | rust-40cfc2de77a605a2b373c0767037065d304d556a.tar.gz rust-40cfc2de77a605a2b373c0767037065d304d556a.zip | |
coverage: Move branch coverage tests into a subdirectory
Diffstat (limited to 'tests/coverage/branch_if.rs')
| -rw-r--r-- | tests/coverage/branch_if.rs | 81 |
1 files changed, 0 insertions, 81 deletions
diff --git a/tests/coverage/branch_if.rs b/tests/coverage/branch_if.rs deleted file mode 100644 index 151eede75bb..00000000000 --- a/tests/coverage/branch_if.rs +++ /dev/null @@ -1,81 +0,0 @@ -#![feature(coverage_attribute)] -//@ edition: 2021 -//@ compile-flags: -Zcoverage-options=branch -//@ llvm-cov-flags: --show-branches=count - -macro_rules! no_merge { - () => { - for _ in 0..1 {} - }; -} - -fn branch_not(a: bool) { - no_merge!(); - - if a { - say("a") - } - if !a { - say("not a"); - } - if !!a { - say("not not a"); - } - if !!!a { - say("not not not a"); - } -} - -fn branch_not_as(a: bool) { - no_merge!(); - - if !(a as bool) { - say("not (a as bool)"); - } - if !!(a as bool) { - say("not not (a as bool)"); - } - if !!!(a as bool) { - say("not not (a as bool)"); - } -} - -fn branch_and(a: bool, b: bool) { - no_merge!(); - - if a && b { - say("both"); - } else { - say("not both"); - } -} - -fn branch_or(a: bool, b: bool) { - no_merge!(); - - if a || b { - say("either"); - } else { - say("neither"); - } -} - -#[coverage(off)] -fn say(message: &str) { - core::hint::black_box(message); -} - -#[coverage(off)] -fn main() { - for a in [false, true, true] { - branch_not(a); - branch_not_as(a); - } - - for a in [false, true, true, true, true] { - for b in [false, true, true] { - branch_and(a, b); - branch_or(a, b); - } - } -} |
