MC/DC (modified condition/decision coverage) is the strictest structural coverage metric in common use. ISO 26262-6 highly recommends it for ASIL D software units, and DO-178C requires it for Level A avionics software. It sounds complicated, but the idea is simple.
The rule
A decision such as if (A && (B || C)) is made of conditions (A, B and C). MC/DC needs, for every condition, two test cases that:
- differ only in that condition, and
- give different decision outcomes.
That pair proves the condition independently affects the result. It is called an independence pair.
A worked example
Take A && (B || C). Four tests are enough:
- T1: A = true, B = true, C = false → true
- T2: A = false, B = true, C = false → false
- T3: A = true, B = false, C = false → false
- T4: A = true, B = false, C = true → true
T1 and T2 show A (only A changed, outcome changed). T1 and T3 show B. T3 and T4 show C.
How many tests?
- The full truth table has 2ᴺ rows: 8 for 3 conditions, 1,024 for 10.
- MC/DC usually needs only N + 1 tests for N conditions, and never more than 2N with unique-cause MC/DC.
- That is why MC/DC is practical even for large decisions, if the tests are chosen carefully.
When a condition has no pair
Sometimes no pair exists, for example in A && !A || B, where A can never change the outcome on its own. This usually means:
- Redundant logic: the condition can be removed or the code simplified.
- Coupled conditions: two conditions always change together, for example
speed > 10andspeed > 20. Masking MC/DC, which allows other conditions to change when their effect is masked, may be accepted instead. - Defensive code: the case cannot happen by design. Record a justification in your coverage report.
Tips for test teams
- Derive tests from requirements first, then use coverage to find what is missing. Coverage does not prove the requirements are met.
- Watch short-circuit evaluation in C: in
A && B, B is not evaluated when A is false. The tests are still valid, but your coverage tool must handle it. - Keep decisions small. Splitting a large condition into named helper functions makes MC/DC easier and the code clearer.
Try it
Paste any decision into our free MC/DC test case generator to get the minimal test set, the independence pairs and the full truth table, with an Excel export for your test specification.
Dervo



