Skip to content

6. MC/DC tests

Proofs say the controller is right. Tests are still needed: on the real hardware, by the code generated from the circuit, for the standards that ask for them. MC/DC (Modified Condition / Decision Coverage) asks that each condition of a decision be shown to change the decision's outcome on its own. The editors find the tests that show it.

The tests of a decision

The decision is the alarm. Select the alarm Out block, and tick MC/DC decision in its properties.

The alarm chosen as the MC/DC decision, its conditions listed The alarm chosen as the MC/DC decision, its conditions listed

The properties list its conditions, and outline them on the canvas. The editor walks back from the decision through the logic (and, or, not, …), into alarm_logic, down to the first blocks that are not logic:

  • door_open, an input;
  • alarm_logic.gt1, the comparison speed > 5;
  • ack, an input;
  • alarm_logic.rs1, the RS bistable.

Press MC/DC tests, in the toolbar. For each condition, intrepyd searches two tests that differ in that condition and in the alarm, and where that condition alone decides it. The MC/DC tab shows them:

The MC/DC table: 4 of 4 conditions covered, 6 tests The MC/DC table: 4 of 4 conditions covered, 6 tests

All 4 conditions are covered, by 6 tests. Each row is a test: the inputs the decision reads, the value of each condition, and the alarm. Below the table, each condition's pair: a click marks its two rows. In tests 1 and 2, for instance, the conditions differ only in door_open, and the alarm with it.

The pair of the bistable's condition, tests 5 and 6, takes two steps: to set the bistable, the driver must acknowledge at the step before. A click on a test's row plays it on the canvas and in the scope; the tab's ⋯ exports the table and the tests as CSV, for the test bench.

The assumption speed_not_negative holds in every test: no test drives the speed below zero.

The tests of the requirements

Back to the requirements table. Each requirement's circuit has its decision already, its Out block. Press Generate MC/DC: the tests of every requirement without tests up to date are generated, one after the other, each row showing its progress.

The requirements table: every requirement's conditions covered The requirements table: every requirement's conditions covered

DA-001 has 2 conditions, DA-002 5, DA-003 and DA-004 3 each: all covered. The tests are kept next to each circuit, in door-alarm/DA-001.mcdc.json and the others, with the date and the versions they were made with. Change a formula, and its tests become out of date.

DA-004 looks one step ahead (next(locked, 1)): its circuit is a step late, and its decision counts from step 1.

Next: all of it in a report.