Skip to content

Commit

Permalink
coverage. Add basic tests for MC/DC
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhuUx authored and Lambdaris committed Apr 19, 2024
1 parent 439dbfa commit 402dc38
Show file tree
Hide file tree
Showing 3 changed files with 583 additions and 0 deletions.
218 changes: 218 additions & 0 deletions tests/coverage/mcdc_if.cov-map
Original file line number Diff line number Diff line change
@@ -0,0 +1,218 @@
Function name: mcdc_if::mcdc_check_a
Raw bytes (64): 0x[01, 01, 04, 01, 05, 09, 02, 0d, 0f, 09, 02, 08, 01, 0f, 01, 01, 09, 28, 00, 02, 01, 08, 00, 0e, 30, 05, 02, 01, 02, 00, 00, 08, 00, 09, 05, 00, 0d, 00, 0e, 30, 0d, 09, 02, 00, 00, 00, 0d, 00, 0e, 0d, 00, 0f, 02, 06, 0f, 02, 0c, 02, 06, 0b, 03, 01, 00, 02]
Number of files: 1
- file 0 => global file 1
Number of expressions: 4
- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
- expression 1 operands: lhs = Counter(2), rhs = Expression(0, Sub)
- expression 2 operands: lhs = Counter(3), rhs = Expression(3, Add)
- expression 3 operands: lhs = Counter(2), rhs = Expression(0, Sub)
Number of file 0 mappings: 8
- Code(Counter(0)) at (prev + 15, 1) to (start + 1, 9)
- MCDCDecision { bitmap_idx: 0, conditions_num: 2 } at (prev + 1, 8) to (start + 0, 14)
- MCDCBranch { true: Counter(1), false: Expression(0, Sub), condition_id: 1, true_next_id: 2, false_next_id: 0 } at (prev + 0, 8) to (start + 0, 9)
true = c1
false = (c0 - c1)
- Code(Counter(1)) at (prev + 0, 13) to (start + 0, 14)
- MCDCBranch { true: Counter(3), false: Counter(2), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 13) to (start + 0, 14)
true = c3
false = c2
- Code(Counter(3)) at (prev + 0, 15) to (start + 2, 6)
- Code(Expression(3, Add)) at (prev + 2, 12) to (start + 2, 6)
= (c2 + (c0 - c1))
- Code(Expression(2, Add)) at (prev + 3, 1) to (start + 0, 2)
= (c3 + (c2 + (c0 - c1)))

Function name: mcdc_if::mcdc_check_b
Raw bytes (64): 0x[01, 01, 04, 01, 05, 09, 02, 0d, 0f, 09, 02, 08, 01, 17, 01, 01, 09, 28, 00, 02, 01, 08, 00, 0e, 30, 05, 02, 01, 02, 00, 00, 08, 00, 09, 05, 00, 0d, 00, 0e, 30, 0d, 09, 02, 00, 00, 00, 0d, 00, 0e, 0d, 00, 0f, 02, 06, 0f, 02, 0c, 02, 06, 0b, 03, 01, 00, 02]
Number of files: 1
- file 0 => global file 1
Number of expressions: 4
- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
- expression 1 operands: lhs = Counter(2), rhs = Expression(0, Sub)
- expression 2 operands: lhs = Counter(3), rhs = Expression(3, Add)
- expression 3 operands: lhs = Counter(2), rhs = Expression(0, Sub)
Number of file 0 mappings: 8
- Code(Counter(0)) at (prev + 23, 1) to (start + 1, 9)
- MCDCDecision { bitmap_idx: 0, conditions_num: 2 } at (prev + 1, 8) to (start + 0, 14)
- MCDCBranch { true: Counter(1), false: Expression(0, Sub), condition_id: 1, true_next_id: 2, false_next_id: 0 } at (prev + 0, 8) to (start + 0, 9)
true = c1
false = (c0 - c1)
- Code(Counter(1)) at (prev + 0, 13) to (start + 0, 14)
- MCDCBranch { true: Counter(3), false: Counter(2), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 13) to (start + 0, 14)
true = c3
false = c2
- Code(Counter(3)) at (prev + 0, 15) to (start + 2, 6)
- Code(Expression(3, Add)) at (prev + 2, 12) to (start + 2, 6)
= (c2 + (c0 - c1))
- Code(Expression(2, Add)) at (prev + 3, 1) to (start + 0, 2)
= (c3 + (c2 + (c0 - c1)))

Function name: mcdc_if::mcdc_check_both
Raw bytes (64): 0x[01, 01, 04, 01, 05, 09, 02, 0d, 0f, 09, 02, 08, 01, 1f, 01, 01, 09, 28, 00, 02, 01, 08, 00, 0e, 30, 05, 02, 01, 02, 00, 00, 08, 00, 09, 05, 00, 0d, 00, 0e, 30, 0d, 09, 02, 00, 00, 00, 0d, 00, 0e, 0d, 00, 0f, 02, 06, 0f, 02, 0c, 02, 06, 0b, 03, 01, 00, 02]
Number of files: 1
- file 0 => global file 1
Number of expressions: 4
- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
- expression 1 operands: lhs = Counter(2), rhs = Expression(0, Sub)
- expression 2 operands: lhs = Counter(3), rhs = Expression(3, Add)
- expression 3 operands: lhs = Counter(2), rhs = Expression(0, Sub)
Number of file 0 mappings: 8
- Code(Counter(0)) at (prev + 31, 1) to (start + 1, 9)
- MCDCDecision { bitmap_idx: 0, conditions_num: 2 } at (prev + 1, 8) to (start + 0, 14)
- MCDCBranch { true: Counter(1), false: Expression(0, Sub), condition_id: 1, true_next_id: 2, false_next_id: 0 } at (prev + 0, 8) to (start + 0, 9)
true = c1
false = (c0 - c1)
- Code(Counter(1)) at (prev + 0, 13) to (start + 0, 14)
- MCDCBranch { true: Counter(3), false: Counter(2), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 13) to (start + 0, 14)
true = c3
false = c2
- Code(Counter(3)) at (prev + 0, 15) to (start + 2, 6)
- Code(Expression(3, Add)) at (prev + 2, 12) to (start + 2, 6)
= (c2 + (c0 - c1))
- Code(Expression(2, Add)) at (prev + 3, 1) to (start + 0, 2)
= (c3 + (c2 + (c0 - c1)))

Function name: mcdc_if::mcdc_check_neither
Raw bytes (64): 0x[01, 01, 04, 01, 05, 09, 02, 0d, 0f, 09, 02, 08, 01, 07, 01, 01, 09, 28, 00, 02, 01, 08, 00, 0e, 30, 05, 02, 01, 02, 00, 00, 08, 00, 09, 05, 00, 0d, 00, 0e, 30, 0d, 09, 02, 00, 00, 00, 0d, 00, 0e, 0d, 00, 0f, 02, 06, 0f, 02, 0c, 02, 06, 0b, 03, 01, 00, 02]
Number of files: 1
- file 0 => global file 1
Number of expressions: 4
- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
- expression 1 operands: lhs = Counter(2), rhs = Expression(0, Sub)
- expression 2 operands: lhs = Counter(3), rhs = Expression(3, Add)
- expression 3 operands: lhs = Counter(2), rhs = Expression(0, Sub)
Number of file 0 mappings: 8
- Code(Counter(0)) at (prev + 7, 1) to (start + 1, 9)
- MCDCDecision { bitmap_idx: 0, conditions_num: 2 } at (prev + 1, 8) to (start + 0, 14)
- MCDCBranch { true: Counter(1), false: Expression(0, Sub), condition_id: 1, true_next_id: 2, false_next_id: 0 } at (prev + 0, 8) to (start + 0, 9)
true = c1
false = (c0 - c1)
- Code(Counter(1)) at (prev + 0, 13) to (start + 0, 14)
- MCDCBranch { true: Counter(3), false: Counter(2), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 13) to (start + 0, 14)
true = c3
false = c2
- Code(Counter(3)) at (prev + 0, 15) to (start + 2, 6)
- Code(Expression(3, Add)) at (prev + 2, 12) to (start + 2, 6)
= (c2 + (c0 - c1))
- Code(Expression(2, Add)) at (prev + 3, 1) to (start + 0, 2)
= (c3 + (c2 + (c0 - c1)))

Function name: mcdc_if::mcdc_check_not_tree_decision
Raw bytes (87): 0x[01, 01, 08, 01, 05, 02, 09, 05, 09, 0d, 1e, 02, 09, 11, 1b, 0d, 1e, 02, 09, 0a, 01, 31, 01, 03, 0a, 28, 00, 03, 03, 08, 00, 15, 30, 05, 02, 01, 02, 03, 00, 09, 00, 0a, 02, 00, 0e, 00, 0f, 30, 09, 1e, 03, 02, 00, 00, 0e, 00, 0f, 0b, 00, 14, 00, 15, 30, 11, 0d, 02, 00, 00, 00, 14, 00, 15, 11, 00, 16, 02, 06, 1b, 02, 0c, 02, 06, 17, 03, 01, 00, 02]
Number of files: 1
- file 0 => global file 1
Number of expressions: 8
- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
- expression 1 operands: lhs = Expression(0, Sub), rhs = Counter(2)
- expression 2 operands: lhs = Counter(1), rhs = Counter(2)
- expression 3 operands: lhs = Counter(3), rhs = Expression(7, Sub)
- expression 4 operands: lhs = Expression(0, Sub), rhs = Counter(2)
- expression 5 operands: lhs = Counter(4), rhs = Expression(6, Add)
- expression 6 operands: lhs = Counter(3), rhs = Expression(7, Sub)
- expression 7 operands: lhs = Expression(0, Sub), rhs = Counter(2)
Number of file 0 mappings: 10
- Code(Counter(0)) at (prev + 49, 1) to (start + 3, 10)
- MCDCDecision { bitmap_idx: 0, conditions_num: 3 } at (prev + 3, 8) to (start + 0, 21)
- MCDCBranch { true: Counter(1), false: Expression(0, Sub), condition_id: 1, true_next_id: 2, false_next_id: 3 } at (prev + 0, 9) to (start + 0, 10)
true = c1
false = (c0 - c1)
- Code(Expression(0, Sub)) at (prev + 0, 14) to (start + 0, 15)
= (c0 - c1)
- MCDCBranch { true: Counter(2), false: Expression(7, Sub), condition_id: 3, true_next_id: 2, false_next_id: 0 } at (prev + 0, 14) to (start + 0, 15)
true = c2
false = ((c0 - c1) - c2)
- Code(Expression(2, Add)) at (prev + 0, 20) to (start + 0, 21)
= (c1 + c2)
- MCDCBranch { true: Counter(4), false: Counter(3), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 20) to (start + 0, 21)
true = c4
false = c3
- Code(Counter(4)) at (prev + 0, 22) to (start + 2, 6)
- Code(Expression(6, Add)) at (prev + 2, 12) to (start + 2, 6)
= (c3 + ((c0 - c1) - c2))
- Code(Expression(5, Add)) at (prev + 3, 1) to (start + 0, 2)
= (c4 + (c3 + ((c0 - c1) - c2)))

Function name: mcdc_if::mcdc_check_tree_decision
Raw bytes (87): 0x[01, 01, 08, 01, 05, 05, 0d, 05, 0d, 0d, 11, 09, 02, 1b, 1f, 0d, 11, 09, 02, 0a, 01, 27, 01, 03, 09, 28, 00, 03, 03, 08, 00, 15, 30, 05, 02, 01, 02, 00, 00, 08, 00, 09, 05, 00, 0e, 00, 0f, 30, 0d, 0a, 02, 00, 03, 00, 0e, 00, 0f, 0a, 00, 13, 00, 14, 30, 11, 09, 03, 00, 00, 00, 13, 00, 14, 1b, 00, 16, 02, 06, 1f, 02, 0c, 02, 06, 17, 03, 01, 00, 02]
Number of files: 1
- file 0 => global file 1
Number of expressions: 8
- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
- expression 1 operands: lhs = Counter(1), rhs = Counter(3)
- expression 2 operands: lhs = Counter(1), rhs = Counter(3)
- expression 3 operands: lhs = Counter(3), rhs = Counter(4)
- expression 4 operands: lhs = Counter(2), rhs = Expression(0, Sub)
- expression 5 operands: lhs = Expression(6, Add), rhs = Expression(7, Add)
- expression 6 operands: lhs = Counter(3), rhs = Counter(4)
- expression 7 operands: lhs = Counter(2), rhs = Expression(0, Sub)
Number of file 0 mappings: 10
- Code(Counter(0)) at (prev + 39, 1) to (start + 3, 9)
- MCDCDecision { bitmap_idx: 0, conditions_num: 3 } at (prev + 3, 8) to (start + 0, 21)
- MCDCBranch { true: Counter(1), false: Expression(0, Sub), condition_id: 1, true_next_id: 2, false_next_id: 0 } at (prev + 0, 8) to (start + 0, 9)
true = c1
false = (c0 - c1)
- Code(Counter(1)) at (prev + 0, 14) to (start + 0, 15)
- MCDCBranch { true: Counter(3), false: Expression(2, Sub), condition_id: 2, true_next_id: 0, false_next_id: 3 } at (prev + 0, 14) to (start + 0, 15)
true = c3
false = (c1 - c3)
- Code(Expression(2, Sub)) at (prev + 0, 19) to (start + 0, 20)
= (c1 - c3)
- MCDCBranch { true: Counter(4), false: Counter(2), condition_id: 3, true_next_id: 0, false_next_id: 0 } at (prev + 0, 19) to (start + 0, 20)
true = c4
false = c2
- Code(Expression(6, Add)) at (prev + 0, 22) to (start + 2, 6)
= (c3 + c4)
- Code(Expression(7, Add)) at (prev + 2, 12) to (start + 2, 6)
= (c2 + (c0 - c1))
- Code(Expression(5, Add)) at (prev + 3, 1) to (start + 0, 2)
= ((c3 + c4) + (c2 + (c0 - c1)))

Function name: mcdc_if::mcdc_nested_if
Raw bytes (124): 0x[01, 01, 0d, 01, 05, 02, 09, 05, 09, 1b, 15, 05, 09, 1b, 15, 05, 09, 11, 15, 02, 09, 2b, 32, 0d, 2f, 11, 15, 02, 09, 0e, 01, 3b, 01, 01, 09, 28, 00, 02, 01, 08, 00, 0e, 30, 05, 02, 01, 00, 02, 00, 08, 00, 09, 02, 00, 0d, 00, 0e, 30, 09, 32, 02, 00, 00, 00, 0d, 00, 0e, 1b, 01, 09, 01, 0d, 28, 01, 02, 01, 0c, 00, 12, 30, 16, 15, 01, 02, 00, 00, 0c, 00, 0d, 16, 00, 11, 00, 12, 30, 0d, 11, 02, 00, 00, 00, 11, 00, 12, 0d, 00, 13, 02, 0a, 2f, 02, 0a, 00, 0b, 32, 01, 0c, 02, 06, 27, 03, 01, 00, 02]
Number of files: 1
- file 0 => global file 1
Number of expressions: 13
- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
- expression 1 operands: lhs = Expression(0, Sub), rhs = Counter(2)
- expression 2 operands: lhs = Counter(1), rhs = Counter(2)
- expression 3 operands: lhs = Expression(6, Add), rhs = Counter(5)
- expression 4 operands: lhs = Counter(1), rhs = Counter(2)
- expression 5 operands: lhs = Expression(6, Add), rhs = Counter(5)
- expression 6 operands: lhs = Counter(1), rhs = Counter(2)
- expression 7 operands: lhs = Counter(4), rhs = Counter(5)
- expression 8 operands: lhs = Expression(0, Sub), rhs = Counter(2)
- expression 9 operands: lhs = Expression(10, Add), rhs = Expression(12, Sub)
- expression 10 operands: lhs = Counter(3), rhs = Expression(11, Add)
- expression 11 operands: lhs = Counter(4), rhs = Counter(5)
- expression 12 operands: lhs = Expression(0, Sub), rhs = Counter(2)
Number of file 0 mappings: 14
- Code(Counter(0)) at (prev + 59, 1) to (start + 1, 9)
- MCDCDecision { bitmap_idx: 0, conditions_num: 2 } at (prev + 1, 8) to (start + 0, 14)
- MCDCBranch { true: Counter(1), false: Expression(0, Sub), condition_id: 1, true_next_id: 0, false_next_id: 2 } at (prev + 0, 8) to (start + 0, 9)
true = c1
false = (c0 - c1)
- Code(Expression(0, Sub)) at (prev + 0, 13) to (start + 0, 14)
= (c0 - c1)
- MCDCBranch { true: Counter(2), false: Expression(12, Sub), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 13) to (start + 0, 14)
true = c2
false = ((c0 - c1) - c2)
- Code(Expression(6, Add)) at (prev + 1, 9) to (start + 1, 13)
= (c1 + c2)
- MCDCDecision { bitmap_idx: 1, conditions_num: 2 } at (prev + 1, 12) to (start + 0, 18)
- MCDCBranch { true: Expression(5, Sub), false: Counter(5), condition_id: 1, true_next_id: 2, false_next_id: 0 } at (prev + 0, 12) to (start + 0, 13)
true = ((c1 + c2) - c5)
false = c5
- Code(Expression(5, Sub)) at (prev + 0, 17) to (start + 0, 18)
= ((c1 + c2) - c5)
- MCDCBranch { true: Counter(3), false: Counter(4), condition_id: 2, true_next_id: 0, false_next_id: 0 } at (prev + 0, 17) to (start + 0, 18)
true = c3
false = c4
- Code(Counter(3)) at (prev + 0, 19) to (start + 2, 10)
- Code(Expression(11, Add)) at (prev + 2, 10) to (start + 0, 11)
= (c4 + c5)
- Code(Expression(12, Sub)) at (prev + 1, 12) to (start + 2, 6)
= ((c0 - c1) - c2)
- Code(Expression(9, Add)) at (prev + 3, 1) to (start + 0, 2)
= ((c3 + (c4 + c5)) + ((c0 - c1) - c2))

Loading

0 comments on commit 402dc38

Please sign in to comment.