coverage: Simplify counter expressions using simple algebra

Some of these cases currently don't occur in practice, but are included for
completeness, and to avoid having to add them later as branch coverage and
MC/DC coverage start building more complex expressions.
This commit is contained in:
Zalathar 2024-05-14 13:51:24 +10:00
parent a68bb5e176
commit d01df6f9aa
43 changed files with 845 additions and 1315 deletions

View file

@ -27,17 +27,15 @@ Number of file 0 mappings: 9
- Code(Counter(4)) at (prev + 2, 5) to (start + 1, 2)
Function name: overflow::might_overflow
Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 05, 01, 01, 12, 05, 01, 13, 02, 06, 02, 02, 06, 00, 07, 07, 01, 09, 05, 02]
Raw bytes (26): 0x[01, 01, 01, 01, 05, 04, 01, 05, 01, 01, 12, 05, 01, 13, 02, 06, 02, 02, 06, 00, 07, 01, 01, 09, 05, 02]
Number of files: 1
- file 0 => global file 1
Number of expressions: 2
Number of expressions: 1
- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub)
Number of file 0 mappings: 4
- Code(Counter(0)) at (prev + 5, 1) to (start + 1, 18)
- Code(Counter(1)) at (prev + 1, 19) to (start + 2, 6)
- Code(Expression(0, Sub)) at (prev + 2, 6) to (start + 0, 7)
= (c0 - c1)
- Code(Expression(1, Add)) at (prev + 1, 9) to (start + 5, 2)
= (c1 + (c0 - c1))
- Code(Counter(0)) at (prev + 1, 9) to (start + 5, 2)