Skip to content

Commit 5ccfda9

Browse files
committed
Added nested or-pattern test
1 parent c0dcdc9 commit 5ccfda9

File tree

3 files changed

+100
-0
lines changed

3 files changed

+100
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
Function name: match_or_pattern_nested::foo
2+
Raw bytes (102): 0x[01, 01, 19, 17, 1d, 27, 19, 53, 15, 57, 11, 09, 0d, 27, 19, 53, 15, 57, 11, 09, 0d, 53, 15, 57, 11, 09, 0d, 57, 11, 09, 0d, 5f, 21, 63, 1d, 15, 19, 57, 11, 09, 0d, 53, 5b, 57, 11, 09, 0d, 5f, 21, 63, 1d, 15, 19, 08, 01, 08, 01, 01, 1c, 20, 21, 03, 02, 0d, 00, 0e, 20, 1d, 17, 00, 11, 00, 12, 20, 19, 27, 00, 1a, 00, 1b, 20, 15, 53, 00, 1e, 00, 1f, 5b, 00, 24, 00, 26, 53, 01, 0e, 00, 10, 4f, 02, 01, 00, 02]
3+
Number of files: 1
4+
- file 0 => global file 1
5+
Number of expressions: 25
6+
- expression 0 operands: lhs = Expression(5, Add), rhs = Counter(7)
7+
- expression 1 operands: lhs = Expression(9, Add), rhs = Counter(6)
8+
- expression 2 operands: lhs = Expression(20, Add), rhs = Counter(5)
9+
- expression 3 operands: lhs = Expression(21, Add), rhs = Counter(4)
10+
- expression 4 operands: lhs = Counter(2), rhs = Counter(3)
11+
- expression 5 operands: lhs = Expression(9, Add), rhs = Counter(6)
12+
- expression 6 operands: lhs = Expression(20, Add), rhs = Counter(5)
13+
- expression 7 operands: lhs = Expression(21, Add), rhs = Counter(4)
14+
- expression 8 operands: lhs = Counter(2), rhs = Counter(3)
15+
- expression 9 operands: lhs = Expression(20, Add), rhs = Counter(5)
16+
- expression 10 operands: lhs = Expression(21, Add), rhs = Counter(4)
17+
- expression 11 operands: lhs = Counter(2), rhs = Counter(3)
18+
- expression 12 operands: lhs = Expression(21, Add), rhs = Counter(4)
19+
- expression 13 operands: lhs = Counter(2), rhs = Counter(3)
20+
- expression 14 operands: lhs = Expression(23, Add), rhs = Counter(8)
21+
- expression 15 operands: lhs = Expression(24, Add), rhs = Counter(7)
22+
- expression 16 operands: lhs = Counter(5), rhs = Counter(6)
23+
- expression 17 operands: lhs = Expression(21, Add), rhs = Counter(4)
24+
- expression 18 operands: lhs = Counter(2), rhs = Counter(3)
25+
- expression 19 operands: lhs = Expression(20, Add), rhs = Expression(22, Add)
26+
- expression 20 operands: lhs = Expression(21, Add), rhs = Counter(4)
27+
- expression 21 operands: lhs = Counter(2), rhs = Counter(3)
28+
- expression 22 operands: lhs = Expression(23, Add), rhs = Counter(8)
29+
- expression 23 operands: lhs = Expression(24, Add), rhs = Counter(7)
30+
- expression 24 operands: lhs = Counter(5), rhs = Counter(6)
31+
Number of file 0 mappings: 8
32+
- Code(Counter(0)) at (prev + 8, 1) to (start + 1, 28)
33+
- Branch { true: Counter(8), false: Expression(0, Add) } at (prev + 2, 13) to (start + 0, 14)
34+
true = c8
35+
false = (((((c2 + c3) + c4) + c5) + c6) + c7)
36+
- Branch { true: Counter(7), false: Expression(5, Add) } at (prev + 0, 17) to (start + 0, 18)
37+
true = c7
38+
false = ((((c2 + c3) + c4) + c5) + c6)
39+
- Branch { true: Counter(6), false: Expression(9, Add) } at (prev + 0, 26) to (start + 0, 27)
40+
true = c6
41+
false = (((c2 + c3) + c4) + c5)
42+
- Branch { true: Counter(5), false: Expression(20, Add) } at (prev + 0, 30) to (start + 0, 31)
43+
true = c5
44+
false = ((c2 + c3) + c4)
45+
- Code(Expression(22, Add)) at (prev + 0, 36) to (start + 0, 38)
46+
= (((c5 + c6) + c7) + c8)
47+
- Code(Expression(20, Add)) at (prev + 1, 14) to (start + 0, 16)
48+
= ((c2 + c3) + c4)
49+
- Code(Expression(19, Add)) at (prev + 2, 1) to (start + 0, 2)
50+
= (((c2 + c3) + c4) + (((c5 + c6) + c7) + c8))
51+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
LL| |#![feature(coverage_attribute)]
2+
LL| |//@ edition: 2021
3+
LL| |//@ compile-flags: -Zcoverage-options=branch
4+
LL| |//@ llvm-cov-flags: --show-branches=count
5+
LL| |
6+
LL| |use core::hint::black_box;
7+
LL| |
8+
LL| 3|fn foo(a: i32, b: i32) {
9+
LL| 3| match black_box((a, b)) {
10+
LL| 2| (1, 2 | 3) | (2, 4 | 5) => {}
11+
------------------
12+
| Branch (LL:13): [True: 1, False: 2]
13+
| Branch (LL:17): [True: 0, False: 2]
14+
| Branch (LL:26): [True: 0, False: 2]
15+
| Branch (LL:30): [True: 1, False: 1]
16+
------------------
17+
LL| 1| _ => {}
18+
LL| | }
19+
LL| 3|}
20+
LL| |
21+
LL| |
22+
LL| |#[coverage(off)]
23+
LL| |fn main() {
24+
LL| | foo(1, 2);
25+
LL| | foo(1, 99);
26+
LL| | foo(2, 5);
27+
LL| |}
28+
LL| |
29+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#![feature(coverage_attribute)]
2+
//@ edition: 2021
3+
//@ compile-flags: -Zcoverage-options=branch
4+
//@ llvm-cov-flags: --show-branches=count
5+
6+
use core::hint::black_box;
7+
8+
fn foo(a: i32, b: i32) {
9+
match black_box((a, b)) {
10+
(1, 2 | 3) | (2, 4 | 5) => {}
11+
_ => {}
12+
}
13+
}
14+
15+
#[coverage(off)]
16+
fn main() {
17+
foo(1, 2);
18+
foo(1, 99);
19+
foo(2, 5);
20+
}

0 commit comments

Comments
 (0)