Skip to content

Commit 0bfdb8d

Browse files
committed
coverage: Add tests/coverage/loop-break.rs
This is a modified copy of `tests/mir-opt/coverage/instrument_coverage.rs`.
1 parent dc6def3 commit 0bfdb8d

File tree

3 files changed

+41
-0
lines changed

3 files changed

+41
-0
lines changed

tests/coverage/loop-break.cov-map

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Function name: loop_break::main
2+
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]
3+
Number of files: 1
4+
- file 0 => global file 1
5+
Number of expressions: 1
6+
- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
7+
Number of file 0 mappings: 5
8+
- Code(Counter(0)) at (prev + 3, 1) to (start + 0, 11)
9+
- Code(Expression(0, Add)) at (prev + 1, 5) to (start + 1, 39)
10+
= (c0 + c1)
11+
- Code(Counter(0)) at (prev + 2, 13) to (start + 0, 18)
12+
- Code(Counter(1)) at (prev + 1, 10) to (start + 0, 11)
13+
- Code(Counter(0)) at (prev + 2, 1) to (start + 0, 2)
14+

tests/coverage/loop-break.coverage

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
LL| |//@ edition: 2021
2+
LL| |
3+
LL| 1|fn main() {
4+
LL| 1| loop {
5+
LL| 1| if core::hint::black_box(true) {
6+
LL| 1| break;
7+
LL| 0| }
8+
LL| | }
9+
LL| 1|}
10+
LL| |
11+
LL| |// This test is a lightly-modified version of `tests/mir-opt/coverage/instrument_coverage.rs`.
12+
LL| |// If this test needs to be blessed, then the mir-opt version probably needs to
13+
LL| |// be blessed too!
14+

tests/coverage/loop-break.rs

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//@ edition: 2021
2+
3+
fn main() {
4+
loop {
5+
if core::hint::black_box(true) {
6+
break;
7+
}
8+
}
9+
}
10+
11+
// This test is a lightly-modified version of `tests/mir-opt/coverage/instrument_coverage.rs`.
12+
// If this test needs to be blessed, then the mir-opt version probably needs to
13+
// be blessed too!

0 commit comments

Comments
 (0)