diff options
| author | Zalathar <Zalathar@users.noreply.github.com> | 2024-06-12 22:48:11 +1000 |
|---|---|---|
| committer | Zalathar <Zalathar@users.noreply.github.com> | 2024-06-12 22:48:11 +1000 |
| commit | 0bfdb8d33dd89099fc2b573d3df4c2347ffa2dbb (patch) | |
| tree | 1f53fe6abc3b161f559c1d63cc889d1bc6ab6b7f | |
| parent | dc6def3042074f38e7c6bdaba3038fb2b1f0e2aa (diff) | |
| download | rust-0bfdb8d33dd89099fc2b573d3df4c2347ffa2dbb.tar.gz rust-0bfdb8d33dd89099fc2b573d3df4c2347ffa2dbb.zip | |
coverage: Add `tests/coverage/loop-break.rs`
This is a modified copy of `tests/mir-opt/coverage/instrument_coverage.rs`.
| -rw-r--r-- | tests/coverage/loop-break.cov-map | 14 | ||||
| -rw-r--r-- | tests/coverage/loop-break.coverage | 14 | ||||
| -rw-r--r-- | tests/coverage/loop-break.rs | 13 |
3 files changed, 41 insertions, 0 deletions
diff --git a/tests/coverage/loop-break.cov-map b/tests/coverage/loop-break.cov-map new file mode 100644 index 00000000000..98df0fdab6b --- /dev/null +++ b/tests/coverage/loop-break.cov-map @@ -0,0 +1,14 @@ +Function name: loop_break::main +Raw bytes (31): 0x[01, 01, 01, 01, 05, 05, 01, 03, 01, 00, 0b, 03, 01, 05, 01, 27, 01, 02, 0d, 00, 12, 05, 01, 0a, 00, 0b, 01, 02, 01, 00, 02] +Number of files: 1 +- file 0 => global file 1 +Number of expressions: 1 +- expression 0 operands: lhs = Counter(0), rhs = Counter(1) +Number of file 0 mappings: 5 +- Code(Counter(0)) at (prev + 3, 1) to (start + 0, 11) +- Code(Expression(0, Add)) at (prev + 1, 5) to (start + 1, 39) + = (c0 + c1) +- Code(Counter(0)) at (prev + 2, 13) to (start + 0, 18) +- Code(Counter(1)) at (prev + 1, 10) to (start + 0, 11) +- Code(Counter(0)) at (prev + 2, 1) to (start + 0, 2) + diff --git a/tests/coverage/loop-break.coverage b/tests/coverage/loop-break.coverage new file mode 100644 index 00000000000..cea7dee83f1 --- /dev/null +++ b/tests/coverage/loop-break.coverage @@ -0,0 +1,14 @@ + LL| |//@ edition: 2021 + LL| | + LL| 1|fn main() { + LL| 1| loop { + LL| 1| if core::hint::black_box(true) { + LL| 1| break; + LL| 0| } + LL| | } + LL| 1|} + LL| | + LL| |// This test is a lightly-modified version of `tests/mir-opt/coverage/instrument_coverage.rs`. + LL| |// If this test needs to be blessed, then the mir-opt version probably needs to + LL| |// be blessed too! + diff --git a/tests/coverage/loop-break.rs b/tests/coverage/loop-break.rs new file mode 100644 index 00000000000..9a842225e83 --- /dev/null +++ b/tests/coverage/loop-break.rs @@ -0,0 +1,13 @@ +//@ edition: 2021 + +fn main() { + loop { + if core::hint::black_box(true) { + break; + } + } +} + +// This test is a lightly-modified version of `tests/mir-opt/coverage/instrument_coverage.rs`. +// If this test needs to be blessed, then the mir-opt version probably needs to +// be blessed too! |
