MCDC Coverage: instrument last boolean RHS operands from condition coverage by RenjiSann · Pull Request #124652 · rust-lang/rust (original) (raw)
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It took me some times to understand why this would not create an MCDC record for the first 2 conditions.
Actually, it's just because of operator's priority. The AST looks like this
Therefore, before the change,
- We would instrument
||
's LHS throughthen_else_break
, which would not produce a record because there is only 1 condition (a
) - We would repeat the same for
&&
, its LHS being justb
.
This emphasizes another weak point of the previous implementation :
let x = a && (b && ( c && (d && (e))));
This decision wasn't recorded at all by MCDC.