Skip to content

Commit c3628f1

Browse files
committed
tests(coverage): Bless mcdc_non_control_flow tests
1 parent 891f1d9 commit c3628f1

File tree

2 files changed

+114
-31
lines changed

2 files changed

+114
-31
lines changed

tests/coverage/mcdc_non_control_flow.cov-map

+26-22
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Function name: mcdc_non_control_flow::assign_3
2-
Raw bytes (73): 0x[01, 01, 09, 05, 07, 0b, 11, 09, 0d, 01, 05, 01, 05, 22, 11, 01, 05, 22, 11, 01, 05, 09, 01, 12, 01, 00, 28, 03, 01, 09, 00, 0a, 01, 00, 0d, 00, 0e, 20, 05, 22, 00, 0d, 00, 0e, 22, 00, 12, 00, 13, 20, 1e, 11, 00, 12, 00, 13, 1e, 00, 17, 00, 18, 20, 09, 0d, 00, 17, 00, 18, 03, 01, 05, 01, 02]
2+
Raw bytes (89): 0x[01, 01, 09, 05, 07, 0b, 11, 09, 0d, 01, 05, 01, 05, 22, 11, 01, 05, 22, 11, 01, 05, 0a, 01, 12, 01, 00, 28, 03, 01, 09, 00, 0a, 01, 00, 0d, 00, 0e, 28, 00, 03, 00, 0d, 00, 18, 30, 05, 22, 01, 00, 02, 00, 0d, 00, 0e, 22, 00, 12, 00, 13, 30, 1e, 11, 02, 03, 00, 00, 12, 00, 13, 1e, 00, 17, 00, 18, 30, 09, 0d, 03, 00, 00, 00, 17, 00, 18, 03, 01, 05, 01, 02]
33
Number of files: 1
44
- file 0 => global file 1
55
Number of expressions: 9
@@ -12,29 +12,30 @@ Number of expressions: 9
1212
- expression 6 operands: lhs = Counter(0), rhs = Counter(1)
1313
- expression 7 operands: lhs = Expression(8, Sub), rhs = Counter(4)
1414
- expression 8 operands: lhs = Counter(0), rhs = Counter(1)
15-
Number of file 0 mappings: 9
15+
Number of file 0 mappings: 10
1616
- Code(Counter(0)) at (prev + 18, 1) to (start + 0, 40)
1717
- Code(Expression(0, Add)) at (prev + 1, 9) to (start + 0, 10)
1818
= (c1 + ((c2 + c3) + c4))
1919
- Code(Counter(0)) at (prev + 0, 13) to (start + 0, 14)
20-
- Branch { true: Counter(1), false: Expression(8, Sub) } at (prev + 0, 13) to (start + 0, 14)
20+
- MCDCDecision { bitmap_idx: 0, conditions_num: 3 } at (prev + 0, 13) to (start + 0, 24)
21+
- MCDCBranch { true: Counter(1), false: Expression(8, Sub), condition_id: 1, true_next_id: 0, false_next_id: 2 } at (prev + 0, 13) to (start + 0, 14)
2122
true = c1
2223
false = (c0 - c1)
2324
- Code(Expression(8, Sub)) at (prev + 0, 18) to (start + 0, 19)
2425
= (c0 - c1)
25-
- Branch { true: Expression(7, Sub), false: Counter(4) } at (prev + 0, 18) to (start + 0, 19)
26+
- MCDCBranch { true: Expression(7, Sub), false: Counter(4), condition_id: 2, true_next_id: 3, false_next_id: 0 } at (prev + 0, 18) to (start + 0, 19)
2627
true = ((c0 - c1) - c4)
2728
false = c4
2829
- Code(Expression(7, Sub)) at (prev + 0, 23) to (start + 0, 24)
2930
= ((c0 - c1) - c4)
30-
- Branch { true: Counter(2), false: Counter(3) } at (prev + 0, 23) to (start + 0, 24)
31+
- MCDCBranch { true: Counter(2), false: Counter(3), condition_id: 3, true_next_id: 0, false_next_id: 0 } at (prev + 0, 23) to (start + 0, 24)
3132
true = c2
3233
false = c3
3334
- Code(Expression(0, Add)) at (prev + 1, 5) to (start + 1, 2)
3435
= (c1 + ((c2 + c3) + c4))
3536

3637
Function name: mcdc_non_control_flow::assign_3_bis
37-
Raw bytes (82): 0x[01, 01, 07, 07, 11, 09, 0d, 01, 05, 05, 09, 16, 1a, 05, 09, 01, 05, 0a, 01, 17, 01, 00, 2c, 03, 01, 09, 00, 0a, 01, 00, 0d, 00, 0e, 28, 00, 02, 00, 0d, 00, 13, 30, 05, 1a, 01, 02, 00, 00, 0d, 00, 0e, 05, 00, 12, 00, 13, 30, 09, 16, 02, 00, 00, 00, 12, 00, 13, 13, 00, 17, 00, 18, 20, 0d, 11, 00, 17, 00, 18, 03, 01, 05, 01, 02]
38+
Raw bytes (85): 0x[01, 01, 07, 07, 11, 09, 0d, 01, 05, 05, 09, 16, 1a, 05, 09, 01, 05, 0a, 01, 17, 01, 00, 2c, 03, 01, 09, 00, 0a, 01, 00, 0d, 00, 0e, 28, 00, 03, 00, 0d, 00, 18, 30, 05, 1a, 01, 03, 02, 00, 0d, 00, 0e, 05, 00, 12, 00, 13, 30, 09, 16, 03, 00, 02, 00, 12, 00, 13, 13, 00, 17, 00, 18, 30, 0d, 11, 02, 00, 00, 00, 17, 00, 18, 03, 01, 05, 01, 02]
3839
Number of files: 1
3940
- file 0 => global file 1
4041
Number of expressions: 7
@@ -50,66 +51,68 @@ Number of file 0 mappings: 10
5051
- Code(Expression(0, Add)) at (prev + 1, 9) to (start + 0, 10)
5152
= ((c2 + c3) + c4)
5253
- Code(Counter(0)) at (prev + 0, 13) to (start + 0, 14)
53-
- MCDCDecision { bitmap_idx: 0, conditions_num: 2 } at (prev + 0, 13) to (start + 0, 19)
54-
- MCDCBranch { true: Counter(1), false: Expression(6, Sub), condition_id: 1, true_next_id: 2, false_next_id: 0 } at (prev + 0, 13) to (start + 0, 14)
54+
- MCDCDecision { bitmap_idx: 0, conditions_num: 3 } at (prev + 0, 13) to (start + 0, 24)
55+
- MCDCBranch { true: Counter(1), false: Expression(6, Sub), condition_id: 1, true_next_id: 3, false_next_id: 2 } at (prev + 0, 13) to (start + 0, 14)
5556
true = c1
5657
false = (c0 - c1)
5758
- Code(Counter(1)) at (prev + 0, 18) to (start + 0, 19)
58-
- MCDCBranch { true: Counter(2), false: Expression(5, Sub), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 18) to (start + 0, 19)
59+
- MCDCBranch { true: Counter(2), false: Expression(5, Sub), condition_id: 3, true_next_id: 0, false_next_id: 2 } at (prev + 0, 18) to (start + 0, 19)
5960
true = c2
6061
false = (c1 - c2)
6162
- Code(Expression(4, Add)) at (prev + 0, 23) to (start + 0, 24)
6263
= ((c1 - c2) + (c0 - c1))
63-
- Branch { true: Counter(3), false: Counter(4) } at (prev + 0, 23) to (start + 0, 24)
64+
- MCDCBranch { true: Counter(3), false: Counter(4), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 23) to (start + 0, 24)
6465
true = c3
6566
false = c4
6667
- Code(Expression(0, Add)) at (prev + 1, 5) to (start + 1, 2)
6768
= ((c2 + c3) + c4)
6869

6970
Function name: mcdc_non_control_flow::assign_and
70-
Raw bytes (51): 0x[01, 01, 04, 07, 0e, 09, 0d, 01, 05, 01, 05, 07, 01, 08, 01, 00, 21, 03, 01, 09, 00, 0a, 01, 00, 0d, 00, 0e, 20, 05, 0e, 00, 0d, 00, 0e, 05, 00, 12, 00, 13, 20, 09, 0d, 00, 12, 00, 13, 03, 01, 05, 01, 02]
71+
Raw bytes (64): 0x[01, 01, 04, 07, 0e, 09, 0d, 01, 05, 01, 05, 08, 01, 08, 01, 00, 21, 03, 01, 09, 00, 0a, 01, 00, 0d, 00, 0e, 28, 00, 02, 00, 0d, 00, 13, 30, 05, 0e, 01, 02, 00, 00, 0d, 00, 0e, 05, 00, 12, 00, 13, 30, 09, 0d, 02, 00, 00, 00, 12, 00, 13, 03, 01, 05, 01, 02]
7172
Number of files: 1
7273
- file 0 => global file 1
7374
Number of expressions: 4
7475
- expression 0 operands: lhs = Expression(1, Add), rhs = Expression(3, Sub)
7576
- expression 1 operands: lhs = Counter(2), rhs = Counter(3)
7677
- expression 2 operands: lhs = Counter(0), rhs = Counter(1)
7778
- expression 3 operands: lhs = Counter(0), rhs = Counter(1)
78-
Number of file 0 mappings: 7
79+
Number of file 0 mappings: 8
7980
- Code(Counter(0)) at (prev + 8, 1) to (start + 0, 33)
8081
- Code(Expression(0, Add)) at (prev + 1, 9) to (start + 0, 10)
8182
= ((c2 + c3) + (c0 - c1))
8283
- Code(Counter(0)) at (prev + 0, 13) to (start + 0, 14)
83-
- Branch { true: Counter(1), false: Expression(3, Sub) } at (prev + 0, 13) to (start + 0, 14)
84+
- MCDCDecision { bitmap_idx: 0, conditions_num: 2 } at (prev + 0, 13) to (start + 0, 19)
85+
- MCDCBranch { true: Counter(1), false: Expression(3, Sub), condition_id: 1, true_next_id: 2, false_next_id: 0 } at (prev + 0, 13) to (start + 0, 14)
8486
true = c1
8587
false = (c0 - c1)
8688
- Code(Counter(1)) at (prev + 0, 18) to (start + 0, 19)
87-
- Branch { true: Counter(2), false: Counter(3) } at (prev + 0, 18) to (start + 0, 19)
89+
- MCDCBranch { true: Counter(2), false: Counter(3), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 18) to (start + 0, 19)
8890
true = c2
8991
false = c3
9092
- Code(Expression(0, Add)) at (prev + 1, 5) to (start + 1, 2)
9193
= ((c2 + c3) + (c0 - c1))
9294

9395
Function name: mcdc_non_control_flow::assign_or
94-
Raw bytes (51): 0x[01, 01, 04, 07, 0d, 05, 09, 01, 05, 01, 05, 07, 01, 0d, 01, 00, 20, 03, 01, 09, 00, 0a, 01, 00, 0d, 00, 0e, 20, 05, 0e, 00, 0d, 00, 0e, 0e, 00, 12, 00, 13, 20, 09, 0d, 00, 12, 00, 13, 03, 01, 05, 01, 02]
96+
Raw bytes (64): 0x[01, 01, 04, 07, 0d, 05, 09, 01, 05, 01, 05, 08, 01, 0d, 01, 00, 20, 03, 01, 09, 00, 0a, 01, 00, 0d, 00, 0e, 28, 00, 02, 00, 0d, 00, 13, 30, 05, 0e, 01, 00, 02, 00, 0d, 00, 0e, 0e, 00, 12, 00, 13, 30, 09, 0d, 02, 00, 00, 00, 12, 00, 13, 03, 01, 05, 01, 02]
9597
Number of files: 1
9698
- file 0 => global file 1
9799
Number of expressions: 4
98100
- expression 0 operands: lhs = Expression(1, Add), rhs = Counter(3)
99101
- expression 1 operands: lhs = Counter(1), rhs = Counter(2)
100102
- expression 2 operands: lhs = Counter(0), rhs = Counter(1)
101103
- expression 3 operands: lhs = Counter(0), rhs = Counter(1)
102-
Number of file 0 mappings: 7
104+
Number of file 0 mappings: 8
103105
- Code(Counter(0)) at (prev + 13, 1) to (start + 0, 32)
104106
- Code(Expression(0, Add)) at (prev + 1, 9) to (start + 0, 10)
105107
= ((c1 + c2) + c3)
106108
- Code(Counter(0)) at (prev + 0, 13) to (start + 0, 14)
107-
- Branch { true: Counter(1), false: Expression(3, Sub) } at (prev + 0, 13) to (start + 0, 14)
109+
- MCDCDecision { bitmap_idx: 0, conditions_num: 2 } at (prev + 0, 13) to (start + 0, 19)
110+
- MCDCBranch { true: Counter(1), false: Expression(3, Sub), condition_id: 1, true_next_id: 0, false_next_id: 2 } at (prev + 0, 13) to (start + 0, 14)
108111
true = c1
109112
false = (c0 - c1)
110113
- Code(Expression(3, Sub)) at (prev + 0, 18) to (start + 0, 19)
111114
= (c0 - c1)
112-
- Branch { true: Counter(2), false: Counter(3) } at (prev + 0, 18) to (start + 0, 19)
115+
- MCDCBranch { true: Counter(2), false: Counter(3), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 18) to (start + 0, 19)
113116
true = c2
114117
false = c3
115118
- Code(Expression(0, Add)) at (prev + 1, 5) to (start + 1, 2)
@@ -124,20 +127,21 @@ Number of file 0 mappings: 1
124127
- Code(Counter(0)) at (prev + 28, 1) to (start + 2, 2)
125128

126129
Function name: mcdc_non_control_flow::func_call
127-
Raw bytes (39): 0x[01, 01, 03, 01, 05, 0b, 02, 09, 0d, 05, 01, 20, 01, 01, 0a, 20, 05, 02, 01, 09, 00, 0a, 05, 00, 0e, 00, 0f, 20, 09, 0d, 00, 0e, 00, 0f, 07, 01, 01, 00, 02]
130+
Raw bytes (52): 0x[01, 01, 03, 01, 05, 0b, 02, 09, 0d, 06, 01, 20, 01, 01, 0a, 28, 00, 02, 01, 09, 00, 0f, 30, 05, 02, 01, 02, 00, 00, 09, 00, 0a, 05, 00, 0e, 00, 0f, 30, 09, 0d, 02, 00, 00, 00, 0e, 00, 0f, 07, 01, 01, 00, 02]
128131
Number of files: 1
129132
- file 0 => global file 1
130133
Number of expressions: 3
131134
- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
132135
- expression 1 operands: lhs = Expression(2, Add), rhs = Expression(0, Sub)
133136
- expression 2 operands: lhs = Counter(2), rhs = Counter(3)
134-
Number of file 0 mappings: 5
137+
Number of file 0 mappings: 6
135138
- Code(Counter(0)) at (prev + 32, 1) to (start + 1, 10)
136-
- Branch { true: Counter(1), false: Expression(0, Sub) } at (prev + 1, 9) to (start + 0, 10)
139+
- MCDCDecision { bitmap_idx: 0, conditions_num: 2 } at (prev + 1, 9) to (start + 0, 15)
140+
- MCDCBranch { true: Counter(1), false: Expression(0, Sub), condition_id: 1, true_next_id: 2, false_next_id: 0 } at (prev + 0, 9) to (start + 0, 10)
137141
true = c1
138142
false = (c0 - c1)
139143
- Code(Counter(1)) at (prev + 0, 14) to (start + 0, 15)
140-
- Branch { true: Counter(2), false: Counter(3) } at (prev + 0, 14) to (start + 0, 15)
144+
- MCDCBranch { true: Counter(2), false: Counter(3), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 14) to (start + 0, 15)
141145
true = c2
142146
false = c3
143147
- Code(Expression(1, Add)) at (prev + 1, 1) to (start + 0, 2)

tests/coverage/mcdc_non_control_flow.coverage

+88-9
Original file line numberDiff line numberDiff line change
@@ -8,41 +8,101 @@
88
LL| 3|fn assign_and(a: bool, b: bool) {
99
LL| 3| let x = a && b;
1010
^2
11+
------------------
12+
|---> MC/DC Decision Region (LL:13) to (LL:19)
13+
|
14+
| Number of Conditions: 2
15+
| Condition C1 --> (LL:13)
16+
| Condition C2 --> (LL:18)
17+
|
18+
| Executed MC/DC Test Vectors:
19+
|
20+
| C1, C2 Result
21+
| 1 { F, - = F }
22+
| 2 { T, F = F }
23+
| 3 { T, T = T }
24+
|
25+
| C1-Pair: covered: (1,3)
26+
| C2-Pair: covered: (2,3)
27+
| MC/DC Coverage for Decision: 100.00%
28+
|
29+
------------------
1130
LL| 3| black_box(x);
1231
LL| 3|}
1332
LL| |
1433
LL| 3|fn assign_or(a: bool, b: bool) {
1534
LL| 3| let x = a || b;
1635
^1
36+
------------------
37+
|---> MC/DC Decision Region (LL:13) to (LL:19)
38+
|
39+
| Number of Conditions: 2
40+
| Condition C1 --> (LL:13)
41+
| Condition C2 --> (LL:18)
42+
|
43+
| Executed MC/DC Test Vectors:
44+
|
45+
| C1, C2 Result
46+
| 1 { F, F = F }
47+
| 2 { T, - = T }
48+
|
49+
| C1-Pair: covered: (1,2)
50+
| C2-Pair: not covered
51+
| MC/DC Coverage for Decision: 50.00%
52+
|
53+
------------------
1754
LL| 3| black_box(x);
1855
LL| 3|}
1956
LL| |
2057
LL| 4|fn assign_3(a: bool, b: bool, c: bool) {
2158
LL| 4| let x = a || b && c;
2259
^2 ^1
60+
------------------
61+
|---> MC/DC Decision Region (LL:13) to (LL:24)
62+
|
63+
| Number of Conditions: 3
64+
| Condition C1 --> (LL:13)
65+
| Condition C2 --> (LL:18)
66+
| Condition C3 --> (LL:23)
67+
|
68+
| Executed MC/DC Test Vectors:
69+
|
70+
| C1, C2, C3 Result
71+
| 1 { F, F, - = F }
72+
| 2 { T, -, - = T }
73+
| 3 { F, T, T = T }
74+
|
75+
| C1-Pair: covered: (1,2)
76+
| C2-Pair: covered: (1,3)
77+
| C3-Pair: not covered
78+
| MC/DC Coverage for Decision: 66.67%
79+
|
80+
------------------
2381
LL| 4| black_box(x);
2482
LL| 4|}
2583
LL| |
2684
LL| 4|fn assign_3_bis(a: bool, b: bool, c: bool) {
2785
LL| 4| let x = a && b || c;
2886
^2 ^3
2987
------------------
30-
|---> MC/DC Decision Region (LL:13) to (LL:19)
88+
|---> MC/DC Decision Region (LL:13) to (LL:24)
3189
|
32-
| Number of Conditions: 2
90+
| Number of Conditions: 3
3391
| Condition C1 --> (LL:13)
3492
| Condition C2 --> (LL:18)
93+
| Condition C3 --> (LL:23)
3594
|
3695
| Executed MC/DC Test Vectors:
3796
|
38-
| C1, C2 Result
39-
| 1 { F, - = F }
40-
| 2 { T, F = F }
41-
| 3 { T, T = T }
97+
| C1, C2, C3 Result
98+
| 1 { T, F, F = F }
99+
| 2 { F, -, T = T }
100+
| 3 { T, T, - = T }
42101
|
43-
| C1-Pair: covered: (1,3)
44-
| C2-Pair: covered: (2,3)
45-
| MC/DC Coverage for Decision: 100.00%
102+
| C1-Pair: not covered
103+
| C2-Pair: covered: (1,3)
104+
| C3-Pair: not covered
105+
| MC/DC Coverage for Decision: 33.33%
46106
|
47107
------------------
48108
LL| 4| black_box(x);
@@ -55,6 +115,25 @@
55115
LL| 3|fn func_call(a: bool, b: bool) {
56116
LL| 3| foo(a && b);
57117
^2
118+
------------------
119+
|---> MC/DC Decision Region (LL:9) to (LL:15)
120+
|
121+
| Number of Conditions: 2
122+
| Condition C1 --> (LL:9)
123+
| Condition C2 --> (LL:14)
124+
|
125+
| Executed MC/DC Test Vectors:
126+
|
127+
| C1, C2 Result
128+
| 1 { F, - = F }
129+
| 2 { T, F = F }
130+
| 3 { T, T = T }
131+
|
132+
| C1-Pair: covered: (1,3)
133+
| C2-Pair: covered: (2,3)
134+
| MC/DC Coverage for Decision: 100.00%
135+
|
136+
------------------
58137
LL| 3|}
59138
LL| |
60139
LL| |

0 commit comments

Comments
 (0)