FA-92051 / PLC ladder logic scan cycles / Open access
Non-retentive outputs survive a power cycle · case 01
An output coil that was on before the power loss is reported on after prescan, before its rung has been solved.
ROOT CAUSE
Prescan does not clear OTE destination bits.
VERIFIED REPAIR
Prescan resets every OTE destination bit to false.
Unsuccessful approach: Skipping OTE bits conditioned on the first-scan bit still leaves those outputs on after prescan.
Case contract
Latch (OTL), unlatch (OTU) and non-retentive output (OTE) rungs executed in program order each scan. rungs is a list of [instr, bit, condition_tag]; the rung is true when the condition input is true, or, for condition S:FS, on the first scan after power-up. A scan item {"power_cycle": true} models a power cycle: prescan clears only OTE destination bits, OTL/OTU bits are retentive, and the next scan is a first scan; it also reports the post-prescan state. OTL sets and OTU clears its bit only when its rung is true; the later rung wins. Return the sorted true bits after each item.
Why this case matters
Ladder programs are executed as repeated scans; each defect here changes what a rung, timer, counter or data-table instruction reports on a particular scan, which is how commissioning and field faults are actually observed.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(rungs, scans):
bits = {}
first = True
out = []
for scan in scans:
if scan.get('power_cycle'):
for instr, bit, cond in rungs:
pass
first = True
out.append(sorted(b for b, v in bits.items() if v))
continue
for instr, bit, cond in rungs:
rung = first if cond == 'S:FS' else bool(scan.get(cond, False))
if instr == 'OTE':
bits[bit] = rung
elif rung and instr == 'OTL':
bits[bit] = True
elif rung and instr == 'OTU':
bits[bit] = False
first = False
out.append(sorted(b for b, v in bits.items() if v))
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression: first-scan output then power cycle',
[[['OTE', 'B:2', 'S:FS'], ['OTL', 'B:0', 'S:FS']], [{}, {'power_cycle': True}, {}, {}]],
[['B:0', 'B:2'], ['B:0'], ['B:0', 'B:2'], ['B:0']]],
['regression: scenario 19',
[[['OTL', 'B:3', 'I:1'], ['OTU', 'B:3', 'I:0'], ['OTE', 'B:2', 'S:FS']],
[{'I:0': False, 'I:1': False, 'I:2': False},
{'power_cycle': True},
{'I:0': True, 'I:1': False, 'I:2': True},
{'power_cycle': True},
{'power_cycle': True},
{'power_cycle': True},
{'I:0': False, 'I:1': True, 'I:2': False},
{'I:0': True, 'I:1': False, 'I:2': True},
{'power_cycle': True},
{'I:0': False, 'I:1': True, 'I:2': False}]],
[['B:2'], [], ['B:2'], [], [], [], ['B:2', 'B:3'], [], [], ['B:2', 'B:3']]],
['control: latched through power cycle',
[[['OTL', 'B:0', 'I:0'], ['OTU', 'B:0', 'I:1'], ['OTE', 'B:1', 'I:0'], ['OTE', 'B:2', 'S:FS']],
[{'I:0': True}, {}, {'power_cycle': True}, {}, {'I:1': True}]],
[['B:0', 'B:1', 'B:2'], ['B:0'], ['B:0'], ['B:0', 'B:2'], []]],
['control: unlatch listed before latch',
[[['OTU', 'B:3', 'I:1'], ['OTL', 'B:3', 'I:0']], [{'I:0': True, 'I:1': True}, {}, {'I:1': True}]],
[['B:3'], ['B:3'], []]],
['control: latch then idle',
[[['OTL', 'B:1', 'I:2'], ['OTE', 'B:0', 'I:2']], [{'I:2': True}, {}, {'power_cycle': True}, {}]],
[['B:0', 'B:1'], ['B:1'], ['B:1'], ['B:1']]],
['control: scenario 1',
[[['OTL', 'B:3', 'I:2'],
['OTL', 'B:0', 'I:0'],
['OTE', 'B:0', 'S:FS'],
['OTL', 'B:1', 'S:FS'],
['OTU', 'B:1', 'S:FS'],
['OTE', 'B:2', 'I:1']],
[{'I:0': True, 'I:1': False, 'I:2': False},
{'I:0': False, 'I:1': False, 'I:2': False},
{'I:0': False, 'I:1': True, 'I:2': True},
{'I:0': False, 'I:1': False, 'I:2': False},
{'I:0': False, 'I:1': False, 'I:2': False},
{'I:0': True, 'I:1': False, 'I:2': False},
{'I:0': False, 'I:1': True, 'I:2': True},
{'I:0': False, 'I:1': True, 'I:2': False},
{'I:0': True, 'I:1': False, 'I:2': True}]],
[['B:0'], [], ['B:2', 'B:3'], ['B:3'], ['B:3'], ['B:3'], ['B:2', 'B:3'], ['B:2', 'B:3'], ['B:3']]],
['control: scenario 2',
[[['OTU', 'B:2', 'I:1'], ['OTL', 'B:1', 'I:1'], ['OTL', 'B:1', 'I:2'], ['OTL', 'B:0', 'I:0']],
[{'I:0': True, 'I:1': False, 'I:2': False},
{'power_cycle': True},
{'I:0': False, 'I:1': False, 'I:2': True},
{'I:0': True, 'I:1': True, 'I:2': True},
{'I:0': False, 'I:1': True, 'I:2': True},
{'power_cycle': True},
{'I:0': False, 'I:1': True, 'I:2': False},
{'I:0': False, 'I:1': False, 'I:2': True},
{'I:0': False, 'I:1': True, 'I:2': True}]],
[['B:0'],
['B:0'],
['B:0', 'B:1'],
['B:0', 'B:1'],
['B:0', 'B:1'],
['B:0', 'B:1'],
['B:0', 'B:1'],
['B:0', 'B:1'],
['B:0', 'B:1']]],
['control: scenario 3',
[[['OTE', 'B:3', 'I:2'],
['OTE', 'B:1', 'I:1'],
['OTL', 'B:2', 'I:0'],
['OTL', 'B:2', 'I:2'],
['OTL', 'B:2', 'I:0']],
[{'I:0': True, 'I:1': True, 'I:2': True},
{'I:0': False, 'I:1': False, 'I:2': True},
{'I:0': False, 'I:1': True, 'I:2': False},
{'I:0': True, 'I:1': False, 'I:2': False},
{'power_cycle': True}]],
[['B:1', 'B:2', 'B:3'], ['B:2', 'B:3'], ['B:1', 'B:2'], ['B:2'], ['B:2']]]],
[['regression: scenario 5',
[[['OTE', 'B:2', 'I:2'],
['OTE', 'B:0', 'I:0'],
['OTE', 'B:2', 'I:2'],
['OTU', 'B:2', 'I:1'],
['OTL', 'B:2', 'I:0']],
[{'I:0': True, 'I:1': True, 'I:2': True},
{'I:0': True, 'I:1': False, 'I:2': True},
{'power_cycle': True},
{'I:0': False, 'I:1': False, 'I:2': False},
{'I:0': True, 'I:1': True, 'I:2': True},
{'power_cycle': True},
{'power_cycle': True}]],
[['B:0', 'B:2'], ['B:0', 'B:2'], [], [], ['B:0', 'B:2'], [], []]],
['regression: scenario 7',
[[['OTU', 'B:2', 'I:0'], ['OTL', 'B:3', 'S:FS'], ['OTE', 'B:1', 'S:FS']],
[{'I:0': True, 'I:1': True, 'I:2': True},
{'I:0': False, 'I:1': True, 'I:2': False},
{'power_cycle': True},
{'power_cycle': True},
{'I:0': False, 'I:1': True, 'I:2': True},
{'I:0': False, 'I:1': False, 'I:2': False},
{'I:0': True, 'I:1': False, 'I:2': True},
{'power_cycle': True},
{'I:0': True, 'I:1': True, 'I:2': False},
{'power_cycle': True}]],
[['B:1', 'B:3'],
['B:3'],
['B:3'],
['B:3'],
['B:1', 'B:3'],
['B:3'],
['B:3'],
['B:3'],
['B:1', 'B:3'],
['B:3']]],
['control: latched through power cycle',
[[['OTL', 'B:0', 'I:0'], ['OTU', 'B:0', 'I:1'], ['OTE', 'B:1', 'I:0'], ['OTE', 'B:2', 'S:FS']],
[{'I:0': True}, {}, {'power_cycle': True}, {}, {'I:1': True}]],
[['B:0', 'B:1', 'B:2'], ['B:0'], ['B:0'], ['B:0', 'B:2'], []]],
['control: unlatch listed before latch',
[[['OTU', 'B:3', 'I:1'], ['OTL', 'B:3', 'I:0']], [{'I:0': True, 'I:1': True}, {}, {'I:1': True}]],
[['B:3'], ['B:3'], []]],
['regression: first-scan output then power cycle',
[[['OTE', 'B:2', 'S:FS'], ['OTL', 'B:0', 'S:FS']], [{}, {'power_cycle': True}, {}, {}]],
[['B:0', 'B:2'], ['B:0'], ['B:0', 'B:2'], ['B:0']]],
['control: latch then idle',
[[['OTL', 'B:1', 'I:2'], ['OTE', 'B:0', 'I:2']], [{'I:2': True}, {}, {'power_cycle': True}, {}]],
[['B:0', 'B:1'], ['B:1'], ['B:1'], ['B:1']]],
['control: scenario 1',
[[['OTE', 'B:3', 'S:FS'], ['OTL', 'B:0', 'S:FS'], ['OTL', 'B:0', 'I:0'], ['OTE', 'B:0', 'S:FS']],
[{'I:0': True, 'I:1': True, 'I:2': False},
{'I:0': False, 'I:1': True, 'I:2': False},
{'I:0': False, 'I:1': False, 'I:2': False},
{'I:0': False, 'I:1': False, 'I:2': True},
{'I:0': False, 'I:1': False, 'I:2': False},
{'I:0': False, 'I:1': False, 'I:2': False}]],
[['B:0', 'B:3'], [], [], [], [], []]],
['control: scenario 2',
[[['OTL', 'B:2', 'I:1'], ['OTL', 'B:3', 'I:2'], ['OTU', 'B:0', 'I:0'], ['OTL', 'B:0', 'S:FS']],
[{'I:0': False, 'I:1': False, 'I:2': True},
{'I:0': True, 'I:1': True, 'I:2': False},
{'I:0': True, 'I:1': False, 'I:2': False},
{'I:0': True, 'I:1': True, 'I:2': False},
{'power_cycle': True},
{'I:0': False, 'I:1': False, 'I:2': True},
{'I:0': False, 'I:1': True, 'I:2': False}]],
[['B:0', 'B:3'],
['B:2', 'B:3'],
['B:2', 'B:3'],
['B:2', 'B:3'],
['B:2', 'B:3'],
['B:0', 'B:2', 'B:3'],
['B:0', 'B:2', 'B:3']]]],
[['regression: scenario 3',
[[['OTU', 'B:0', 'I:0'], ['OTL', 'B:0', 'I:0'], ['OTE', 'B:3', 'I:0']],
[{'I:0': False, 'I:1': True, 'I:2': False},
{'I:0': False, 'I:1': False, 'I:2': False},
{'I:0': False, 'I:1': False, 'I:2': True},
{'power_cycle': True},
{'I:0': True, 'I:1': False, 'I:2': False},
{'power_cycle': True}]],
[[], [], [], [], ['B:0', 'B:3'], ['B:0']]],
['regression: first-scan output then power cycle',
[[['OTE', 'B:2', 'S:FS'], ['OTL', 'B:0', 'S:FS']], [{}, {'power_cycle': True}, {}, {}]],
[['B:0', 'B:2'], ['B:0'], ['B:0', 'B:2'], ['B:0']]],
['control: latched through power cycle',
[[['OTL', 'B:0', 'I:0'], ['OTU', 'B:0', 'I:1'], ['OTE', 'B:1', 'I:0'], ['OTE', 'B:2', 'S:FS']],
[{'I:0': True}, {}, {'power_cycle': True}, {}, {'I:1': True}]],
[['B:0', 'B:1', 'B:2'], ['B:0'], ['B:0'], ['B:0', 'B:2'], []]],
['control: unlatch listed before latch',
[[['OTU', 'B:3', 'I:1'], ['OTL', 'B:3', 'I:0']], [{'I:0': True, 'I:1': True}, {}, {'I:1': True}]],
[['B:3'], ['B:3'], []]],
['control: latch then idle',
[[['OTL', 'B:1', 'I:2'], ['OTE', 'B:0', 'I:2']], [{'I:2': True}, {}, {'power_cycle': True}, {}]],
[['B:0', 'B:1'], ['B:1'], ['B:1'], ['B:1']]],
['regression: scenario 1',
[[['OTL', 'B:3', 'I:2'], ['OTE', 'B:1', 'I:0'], ['OTL', 'B:1', 'I:0']],
[{'power_cycle': True},
{'power_cycle': True},
{'I:0': True, 'I:1': True, 'I:2': True},
{'I:0': True, 'I:1': False, 'I:2': False},
{'power_cycle': True},
{'I:0': False, 'I:1': False, 'I:2': True}]],
[[], [], ['B:1', 'B:3'], ['B:1', 'B:3'], ['B:3'], ['B:3']]],
['control: scenario 2',
[[['OTL', 'B:0', 'I:2'], ['OTL', 'B:2', 'S:FS'], ['OTU', 'B:0', 'I:2'], ['OTU', 'B:3', 'I:2']],
[{'I:0': True, 'I:1': False, 'I:2': False},
{'I:0': True, 'I:1': True, 'I:2': True},
{'power_cycle': True},
{'power_cycle': True},
{'I:0': False, 'I:1': False, 'I:2': True}]],
[['B:2'], ['B:2'], ['B:2'], ['B:2'], ['B:2']]],
['control: scenario 4',
[[['OTU', 'B:3', 'I:1'], ['OTU', 'B:0', 'S:FS'], ['OTE', 'B:3', 'I:1']],
[{'I:0': False, 'I:1': False, 'I:2': True},
{'I:0': False, 'I:1': True, 'I:2': True},
{'I:0': False, 'I:1': False, 'I:2': True},
{'I:0': False, 'I:1': False, 'I:2': False},
{'I:0': False, 'I:1': False, 'I:2': True}]],
[[], ['B:3'], [], [], []]]],
[['regression: scenario 11',
[[['OTL', 'B:1', 'I:2'], ['OTU', 'B:3', 'I:1'], ['OTE', 'B:0', 'I:2'], ['OTL', 'B:1', 'I:0']],
[{'I:0': True, 'I:1': False, 'I:2': False},
{'power_cycle': True},
{'I:0': False, 'I:1': False, 'I:2': True},
{'power_cycle': True},
{'power_cycle': True},
{'I:0': True, 'I:1': False, 'I:2': False}]],
[['B:1'], ['B:1'], ['B:0', 'B:1'], ['B:1'], ['B:1'], ['B:1']]],
['regression: scenario 53',
[[['OTE', 'B:1', 'S:FS'],
['OTU', 'B:0', 'S:FS'],
['OTL', 'B:1', 'I:0'],
['OTL', 'B:2', 'S:FS'],
['OTL', 'B:1', 'I:2'],
['OTU', 'B:0', 'I:1']],
[{'power_cycle': True},
{'I:0': False, 'I:1': False, 'I:2': True},
{'I:0': False, 'I:1': True, 'I:2': False},
{'I:0': False, 'I:1': False, 'I:2': False},
{'I:0': False, 'I:1': True, 'I:2': False},
{'I:0': False, 'I:1': True, 'I:2': False},
{'I:0': False, 'I:1': False, 'I:2': True},
{'I:0': True, 'I:1': False, 'I:2': True},
{'I:0': True, 'I:1': False, 'I:2': False},
{'power_cycle': True}]],
[[],
['B:1', 'B:2'],
['B:2'],
['B:2'],
['B:2'],
['B:2'],
['B:1', 'B:2'],
['B:1', 'B:2'],
['B:1', 'B:2'],
['B:2']]],
['control: latched through power cycle',
[[['OTL', 'B:0', 'I:0'], ['OTU', 'B:0', 'I:1'], ['OTE', 'B:1', 'I:0'], ['OTE', 'B:2', 'S:FS']],
[{'I:0': True}, {}, {'power_cycle': True}, {}, {'I:1': True}]],
[['B:0', 'B:1', 'B:2'], ['B:0'], ['B:0'], ['B:0', 'B:2'], []]],
['control: unlatch listed before latch',
[[['OTU', 'B:3', 'I:1'], ['OTL', 'B:3', 'I:0']], [{'I:0': True, 'I:1': True}, {}, {'I:1': True}]],
[['B:3'], ['B:3'], []]],
['regression: first-scan output then power cycle',
[[['OTE', 'B:2', 'S:FS'], ['OTL', 'B:0', 'S:FS']], [{}, {'power_cycle': True}, {}, {}]],
[['B:0', 'B:2'], ['B:0'], ['B:0', 'B:2'], ['B:0']]],
['control: latch then idle',
[[['OTL', 'B:1', 'I:2'], ['OTE', 'B:0', 'I:2']], [{'I:2': True}, {}, {'power_cycle': True}, {}]],
[['B:0', 'B:1'], ['B:1'], ['B:1'], ['B:1']]],
['regression: scenario 1',
[[['OTL', 'B:3', 'I:1'],
['OTL', 'B:1', 'S:FS'],
['OTU', 'B:1', 'S:FS'],
['OTL', 'B:0', 'S:FS'],
['OTE', 'B:2', 'I:0']],
[{'I:0': True, 'I:1': False, 'I:2': False},
{'I:0': False, 'I:1': True, 'I:2': False},
{'I:0': True, 'I:1': True, 'I:2': False},
{'power_cycle': True},
{'power_cycle': True}]],
[['B:0', 'B:2'], ['B:0', 'B:3'], ['B:0', 'B:2', 'B:3'], ['B:0', 'B:3'], ['B:0', 'B:3']]],
['control: scenario 2',
[[['OTE', 'B:1', 'I:1'],
['OTU', 'B:3', 'I:2'],
['OTL', 'B:1', 'I:0'],
['OTL', 'B:1', 'I:0'],
['OTL', 'B:3', 'I:2'],
['OTL', 'B:3', 'I:1']],
[{'I:0': False, 'I:1': True, 'I:2': False},
{'I:0': False, 'I:1': False, 'I:2': False},
{'I:0': False, 'I:1': True, 'I:2': False},
{'I:0': False, 'I:1': True, 'I:2': True},
{'I:0': True, 'I:1': True, 'I:2': True},
{'I:0': True, 'I:1': False, 'I:2': False}]],
[['B:1', 'B:3'], ['B:3'], ['B:1', 'B:3'], ['B:1', 'B:3'], ['B:1', 'B:3'], ['B:1', 'B:3']]]],
[['regression: scenario 17',
[[['OTL', 'B:2', 'I:2'],
['OTU', 'B:2', 'I:1'],
['OTL', 'B:2', 'S:FS'],
['OTL', 'B:3', 'I:2'],
['OTE', 'B:1', 'I:1']],
[{'I:0': True, 'I:1': False, 'I:2': False},
{'I:0': True, 'I:1': False, 'I:2': True},
{'I:0': False, 'I:1': False, 'I:2': False},
{'I:0': True, 'I:1': False, 'I:2': True},
{'I:0': True, 'I:1': True, 'I:2': False},
{'power_cycle': True},
{'power_cycle': True}]],
[['B:2'], ['B:2', 'B:3'], ['B:2', 'B:3'], ['B:2', 'B:3'], ['B:1', 'B:3'], ['B:3'], ['B:3']]],
['regression: scenario 37',
[[['OTU', 'B:2', 'I:2'], ['OTL', 'B:1', 'S:FS'], ['OTU', 'B:0', 'I:0'], ['OTE', 'B:0', 'S:FS']],
[{'I:0': False, 'I:1': False, 'I:2': False},
{'I:0': False, 'I:1': True, 'I:2': False},
{'I:0': False, 'I:1': False, 'I:2': True},
{'I:0': True, 'I:1': False, 'I:2': False},
{'power_cycle': True},
{'power_cycle': True},
{'I:0': True, 'I:1': True, 'I:2': False},
{'power_cycle': True}]],
[['B:0', 'B:1'], ['B:1'], ['B:1'], ['B:1'], ['B:1'], ['B:1'], ['B:0', 'B:1'], ['B:1']]],
['control: latched through power cycle',
[[['OTL', 'B:0', 'I:0'], ['OTU', 'B:0', 'I:1'], ['OTE', 'B:1', 'I:0'], ['OTE', 'B:2', 'S:FS']],
[{'I:0': True}, {}, {'power_cycle': True}, {}, {'I:1': True}]],
[['B:0', 'B:1', 'B:2'], ['B:0'], ['B:0'], ['B:0', 'B:2'], []]],
['control: unlatch listed before latch',
[[['OTU', 'B:3', 'I:1'], ['OTL', 'B:3', 'I:0']], [{'I:0': True, 'I:1': True}, {}, {'I:1': True}]],
[['B:3'], ['B:3'], []]],
['regression: first-scan output then power cycle',
[[['OTE', 'B:2', 'S:FS'], ['OTL', 'B:0', 'S:FS']], [{}, {'power_cycle': True}, {}, {}]],
[['B:0', 'B:2'], ['B:0'], ['B:0', 'B:2'], ['B:0']]],
['control: latch then idle',
[[['OTL', 'B:1', 'I:2'], ['OTE', 'B:0', 'I:2']], [{'I:2': True}, {}, {'power_cycle': True}, {}]],
[['B:0', 'B:1'], ['B:1'], ['B:1'], ['B:1']]],
['control: scenario 1',
[[['OTL', 'B:3', 'S:FS'],
['OTL', 'B:1', 'I:1'],
['OTL', 'B:2', 'S:FS'],
['OTL', 'B:1', 'I:0'],
['OTL', 'B:1', 'I:1']],
[{'power_cycle': True},
{'I:0': True, 'I:1': False, 'I:2': False},
{'I:0': True, 'I:1': True, 'I:2': False},
{'I:0': False, 'I:1': False, 'I:2': True},
{'I:0': False, 'I:1': True, 'I:2': False},
{'I:0': True, 'I:1': False, 'I:2': True},
{'I:0': False, 'I:1': False, 'I:2': False}]],
[[],
['B:1', 'B:2', 'B:3'],
['B:1', 'B:2', 'B:3'],
['B:1', 'B:2', 'B:3'],
['B:1', 'B:2', 'B:3'],
['B:1', 'B:2', 'B:3'],
['B:1', 'B:2', 'B:3']]],
['regression: scenario 2',
[[['OTU', 'B:0', 'I:2'], ['OTE', 'B:2', 'I:0'], ['OTL', 'B:1', 'I:2']],
[{'power_cycle': True},
{'I:0': False, 'I:1': False, 'I:2': False},
{'I:0': True, 'I:1': False, 'I:2': False},
{'I:0': True, 'I:1': True, 'I:2': False},
{'I:0': True, 'I:1': False, 'I:2': False},
{'I:0': True, 'I:1': False, 'I:2': True},
{'I:0': True, 'I:1': True, 'I:2': False},
{'power_cycle': True},
{'I:0': False, 'I:1': True, 'I:2': False}]],
[[], [], ['B:2'], ['B:2'], ['B:2'], ['B:1', 'B:2'], ['B:1', 'B:2'], ['B:1'], ['B:1']]]]]
for label, args, expected in fixtures[N-1]:
check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: first-scan output then power cycle | [['B:0', 'B:2'], ['B:0', 'B:2'], ['B:0', 'B:2'], ['B:0']] | [['B:0', 'B:2'], ['B:0'], ['B:0', 'B:2'], ['B:0']] | Failed |
| regression: scenario 19 | [['B:2'], ['B:2'], ['B:2'], ['B:2'], ['B:2'], ['B:2'], ['B:2', 'B:3'], [], [], ['B:2', 'B:3']] | [['B:2'], [], ['B:2'], [], [], [], ['B:2', 'B:3'], [], [], ['B:2', 'B:3']] | Failed |
| control: latched through power cycle | [['B:0', 'B:1', 'B:2'], ['B:0'], ['B:0'], ['B:0', 'B:2'], []] | [['B:0', 'B:1', 'B:2'], ['B:0'], ['B:0'], ['B:0', 'B:2'], []] | Passed |
| control: unlatch listed before latch | [['B:3'], ['B:3'], []] | [['B:3'], ['B:3'], []] | Passed |
| control: latch then idle | [['B:0', 'B:1'], ['B:1'], ['B:1'], ['B:1']] | [['B:0', 'B:1'], ['B:1'], ['B:1'], ['B:1']] | Passed |
| control: scenario 1 | [['B:0'], [], ['B:2', 'B:3'], ['B:3'], ['B:3'], ['B:3'], ['B:2', 'B:3'], ['B:2', 'B:3'], ['B:3']] | [['B:0'], [], ['B:2', 'B:3'], ['B:3'], ['B:3'], ['B:3'], ['B:2', 'B:3'], ['B:2', 'B:3'], ['B:3']] | Passed |
| control: scenario 2 | [['B:0'], ['B:0'], ['B:0', 'B:1'], ['B:0', 'B:1'], ['B:0', 'B:1'], ['B:0', 'B:1'], ['B:0', 'B:1'], ['B:0', 'B:1'], ['B:0', 'B:1']] | [['B:0'], ['B:0'], ['B:0', 'B:1'], ['B:0', 'B:1'], ['B:0', 'B:1'], ['B:0', 'B:1'], ['B:0', 'B:1'], ['B:0', 'B:1'], ['B:0', 'B:1']] | Passed |
| control: scenario 3 | [['B:1', 'B:2', 'B:3'], ['B:2', 'B:3'], ['B:1', 'B:2'], ['B:2'], ['B:2']] | [['B:1', 'B:2', 'B:3'], ['B:2', 'B:3'], ['B:1', 'B:2'], ['B:2'], ['B:2']] | Passed |
SHA-256 / fd8db8b51bc98172d6ad88f1730303a81245c1bb0ac074e3cd6827ad22c3b8d8
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(rungs, scans):
bits = {}
first = True
out = []
for scan in scans:
if scan.get('power_cycle'):
for instr, bit, cond in rungs:
if instr == 'OTE' and cond != 'S:FS':
bits[bit] = False
first = True
out.append(sorted(b for b, v in bits.items() if v))
continue
for instr, bit, cond in rungs:
rung = first if cond == 'S:FS' else bool(scan.get(cond, False))
if instr == 'OTE':
bits[bit] = rung
elif rung and instr == 'OTL':
bits[bit] = True
elif rung and instr == 'OTU':
bits[bit] = False
first = False
out.append(sorted(b for b, v in bits.items() if v))
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression: first-scan output then power cycle',
[[['OTE', 'B:2', 'S:FS'], ['OTL', 'B:0', 'S:FS']], [{}, {'power_cycle': True}, {}, {}]],
[['B:0', 'B:2'], ['B:0'], ['B:0', 'B:2'], ['B:0']]],
['regression: scenario 19',
[[['OTL', 'B:3', 'I:1'], ['OTU', 'B:3', 'I:0'], ['OTE', 'B:2', 'S:FS']],
[{'I:0': False, 'I:1': False, 'I:2': False},
{'power_cycle': True},
{'I:0': True, 'I:1': False, 'I:2': True},
{'power_cycle': True},
{'power_cycle': True},
{'power_cycle': True},
{'I:0': False, 'I:1': True, 'I:2': False},
{'I:0': True, 'I:1': False, 'I:2': True},
{'power_cycle': True},
{'I:0': False, 'I:1': True, 'I:2': False}]],
[['B:2'], [], ['B:2'], [], [], [], ['B:2', 'B:3'], [], [], ['B:2', 'B:3']]],
['control: latched through power cycle',
[[['OTL', 'B:0', 'I:0'], ['OTU', 'B:0', 'I:1'], ['OTE', 'B:1', 'I:0'], ['OTE', 'B:2', 'S:FS']],
[{'I:0': True}, {}, {'power_cycle': True}, {}, {'I:1': True}]],
[['B:0', 'B:1', 'B:2'], ['B:0'], ['B:0'], ['B:0', 'B:2'], []]],
['control: unlatch listed before latch',
[[['OTU', 'B:3', 'I:1'], ['OTL', 'B:3', 'I:0']], [{'I:0': True, 'I:1': True}, {}, {'I:1': True}]],
[['B:3'], ['B:3'], []]],
['control: latch then idle',
[[['OTL', 'B:1', 'I:2'], ['OTE', 'B:0', 'I:2']], [{'I:2': True}, {}, {'power_cycle': True}, {}]],
[['B:0', 'B:1'], ['B:1'], ['B:1'], ['B:1']]],
['control: scenario 1',
[[['OTL', 'B:3', 'I:2'],
['OTL', 'B:0', 'I:0'],
['OTE', 'B:0', 'S:FS'],
['OTL', 'B:1', 'S:FS'],
['OTU', 'B:1', 'S:FS'],
['OTE', 'B:2', 'I:1']],
[{'I:0': True, 'I:1': False, 'I:2': False},
{'I:0': False, 'I:1': False, 'I:2': False},
{'I:0': False, 'I:1': True, 'I:2': True},
{'I:0': False, 'I:1': False, 'I:2': False},
{'I:0': False, 'I:1': False, 'I:2': False},
{'I:0': True, 'I:1': False, 'I:2': False},
{'I:0': False, 'I:1': True, 'I:2': True},
{'I:0': False, 'I:1': True, 'I:2': False},
{'I:0': True, 'I:1': False, 'I:2': True}]],
[['B:0'], [], ['B:2', 'B:3'], ['B:3'], ['B:3'], ['B:3'], ['B:2', 'B:3'], ['B:2', 'B:3'], ['B:3']]],
['control: scenario 2',
[[['OTU', 'B:2', 'I:1'], ['OTL', 'B:1', 'I:1'], ['OTL', 'B:1', 'I:2'], ['OTL', 'B:0', 'I:0']],
[{'I:0': True, 'I:1': False, 'I:2': False},
{'power_cycle': True},
{'I:0': False, 'I:1': False, 'I:2': True},
{'I:0': True, 'I:1': True, 'I:2': True},
{'I:0': False, 'I:1': True, 'I:2': True},
{'power_cycle': True},
{'I:0': False, 'I:1': True, 'I:2': False},
{'I:0': False, 'I:1': False, 'I:2': True},
{'I:0': False, 'I:1': True, 'I:2': True}]],
[['B:0'],
['B:0'],
['B:0', 'B:1'],
['B:0', 'B:1'],
['B:0', 'B:1'],
['B:0', 'B:1'],
['B:0', 'B:1'],
['B:0', 'B:1'],
['B:0', 'B:1']]],
['control: scenario 3',
[[['OTE', 'B:3', 'I:2'],
['OTE', 'B:1', 'I:1'],
['OTL', 'B:2', 'I:0'],
['OTL', 'B:2', 'I:2'],
['OTL', 'B:2', 'I:0']],
[{'I:0': True, 'I:1': True, 'I:2': True},
{'I:0': False, 'I:1': False, 'I:2': True},
{'I:0': False, 'I:1': True, 'I:2': False},
{'I:0': True, 'I:1': False, 'I:2': False},
{'power_cycle': True}]],
[['B:1', 'B:2', 'B:3'], ['B:2', 'B:3'], ['B:1', 'B:2'], ['B:2'], ['B:2']]]],
[['regression: scenario 5',
[[['OTE', 'B:2', 'I:2'],
['OTE', 'B:0', 'I:0'],
['OTE', 'B:2', 'I:2'],
['OTU', 'B:2', 'I:1'],
['OTL', 'B:2', 'I:0']],
[{'I:0': True, 'I:1': True, 'I:2': True},
{'I:0': True, 'I:1': False, 'I:2': True},
{'power_cycle': True},
{'I:0': False, 'I:1': False, 'I:2': False},
{'I:0': True, 'I:1': True, 'I:2': True},
{'power_cycle': True},
{'power_cycle': True}]],
[['B:0', 'B:2'], ['B:0', 'B:2'], [], [], ['B:0', 'B:2'], [], []]],
['regression: scenario 7',
[[['OTU', 'B:2', 'I:0'], ['OTL', 'B:3', 'S:FS'], ['OTE', 'B:1', 'S:FS']],
[{'I:0': True, 'I:1': True, 'I:2': True},
{'I:0': False, 'I:1': True, 'I:2': False},
{'power_cycle': True},
{'power_cycle': True},
{'I:0': False, 'I:1': True, 'I:2': True},
{'I:0': False, 'I:1': False, 'I:2': False},
{'I:0': True, 'I:1': False, 'I:2': True},
{'power_cycle': True},
{'I:0': True, 'I:1': True, 'I:2': False},
{'power_cycle': True}]],
[['B:1', 'B:3'],
['B:3'],
['B:3'],
['B:3'],
['B:1', 'B:3'],
['B:3'],
['B:3'],
['B:3'],
['B:1', 'B:3'],
['B:3']]],
['control: latched through power cycle',
[[['OTL', 'B:0', 'I:0'], ['OTU', 'B:0', 'I:1'], ['OTE', 'B:1', 'I:0'], ['OTE', 'B:2', 'S:FS']],
[{'I:0': True}, {}, {'power_cycle': True}, {}, {'I:1': True}]],
[['B:0', 'B:1', 'B:2'], ['B:0'], ['B:0'], ['B:0', 'B:2'], []]],
['control: unlatch listed before latch',
[[['OTU', 'B:3', 'I:1'], ['OTL', 'B:3', 'I:0']], [{'I:0': True, 'I:1': True}, {}, {'I:1': True}]],
[['B:3'], ['B:3'], []]],
['regression: first-scan output then power cycle',
[[['OTE', 'B:2', 'S:FS'], ['OTL', 'B:0', 'S:FS']], [{}, {'power_cycle': True}, {}, {}]],
[['B:0', 'B:2'], ['B:0'], ['B:0', 'B:2'], ['B:0']]],
['control: latch then idle',
[[['OTL', 'B:1', 'I:2'], ['OTE', 'B:0', 'I:2']], [{'I:2': True}, {}, {'power_cycle': True}, {}]],
[['B:0', 'B:1'], ['B:1'], ['B:1'], ['B:1']]],
['control: scenario 1',
[[['OTE', 'B:3', 'S:FS'], ['OTL', 'B:0', 'S:FS'], ['OTL', 'B:0', 'I:0'], ['OTE', 'B:0', 'S:FS']],
[{'I:0': True, 'I:1': True, 'I:2': False},
{'I:0': False, 'I:1': True, 'I:2': False},
{'I:0': False, 'I:1': False, 'I:2': False},
{'I:0': False, 'I:1': False, 'I:2': True},
{'I:0': False, 'I:1': False, 'I:2': False},
{'I:0': False, 'I:1': False, 'I:2': False}]],
[['B:0', 'B:3'], [], [], [], [], []]],
['control: scenario 2',
[[['OTL', 'B:2', 'I:1'], ['OTL', 'B:3', 'I:2'], ['OTU', 'B:0', 'I:0'], ['OTL', 'B:0', 'S:FS']],
[{'I:0': False, 'I:1': False, 'I:2': True},
{'I:0': True, 'I:1': True, 'I:2': False},
{'I:0': True, 'I:1': False, 'I:2': False},
{'I:0': True, 'I:1': True, 'I:2': False},
{'power_cycle': True},
{'I:0': False, 'I:1': False, 'I:2': True},
{'I:0': False, 'I:1': True, 'I:2': False}]],
[['B:0', 'B:3'],
['B:2', 'B:3'],
['B:2', 'B:3'],
['B:2', 'B:3'],
['B:2', 'B:3'],
['B:0', 'B:2', 'B:3'],
['B:0', 'B:2', 'B:3']]]],
[['regression: scenario 3',
[[['OTU', 'B:0', 'I:0'], ['OTL', 'B:0', 'I:0'], ['OTE', 'B:3', 'I:0']],
[{'I:0': False, 'I:1': True, 'I:2': False},
{'I:0': False, 'I:1': False, 'I:2': False},
{'I:0': False, 'I:1': False, 'I:2': True},
{'power_cycle': True},
{'I:0': True, 'I:1': False, 'I:2': False},
{'power_cycle': True}]],
[[], [], [], [], ['B:0', 'B:3'], ['B:0']]],
['regression: first-scan output then power cycle',
[[['OTE', 'B:2', 'S:FS'], ['OTL', 'B:0', 'S:FS']], [{}, {'power_cycle': True}, {}, {}]],
[['B:0', 'B:2'], ['B:0'], ['B:0', 'B:2'], ['B:0']]],
['control: latched through power cycle',
[[['OTL', 'B:0', 'I:0'], ['OTU', 'B:0', 'I:1'], ['OTE', 'B:1', 'I:0'], ['OTE', 'B:2', 'S:FS']],
[{'I:0': True}, {}, {'power_cycle': True}, {}, {'I:1': True}]],
[['B:0', 'B:1', 'B:2'], ['B:0'], ['B:0'], ['B:0', 'B:2'], []]],
['control: unlatch listed before latch',
[[['OTU', 'B:3', 'I:1'], ['OTL', 'B:3', 'I:0']], [{'I:0': True, 'I:1': True}, {}, {'I:1': True}]],
[['B:3'], ['B:3'], []]],
['control: latch then idle',
[[['OTL', 'B:1', 'I:2'], ['OTE', 'B:0', 'I:2']], [{'I:2': True}, {}, {'power_cycle': True}, {}]],
[['B:0', 'B:1'], ['B:1'], ['B:1'], ['B:1']]],
['regression: scenario 1',
[[['OTL', 'B:3', 'I:2'], ['OTE', 'B:1', 'I:0'], ['OTL', 'B:1', 'I:0']],
[{'power_cycle': True},
{'power_cycle': True},
{'I:0': True, 'I:1': True, 'I:2': True},
{'I:0': True, 'I:1': False, 'I:2': False},
{'power_cycle': True},
{'I:0': False, 'I:1': False, 'I:2': True}]],
[[], [], ['B:1', 'B:3'], ['B:1', 'B:3'], ['B:3'], ['B:3']]],
['control: scenario 2',
[[['OTL', 'B:0', 'I:2'], ['OTL', 'B:2', 'S:FS'], ['OTU', 'B:0', 'I:2'], ['OTU', 'B:3', 'I:2']],
[{'I:0': True, 'I:1': False, 'I:2': False},
{'I:0': True, 'I:1': True, 'I:2': True},
{'power_cycle': True},
{'power_cycle': True},
{'I:0': False, 'I:1': False, 'I:2': True}]],
[['B:2'], ['B:2'], ['B:2'], ['B:2'], ['B:2']]],
['control: scenario 4',
[[['OTU', 'B:3', 'I:1'], ['OTU', 'B:0', 'S:FS'], ['OTE', 'B:3', 'I:1']],
[{'I:0': False, 'I:1': False, 'I:2': True},
{'I:0': False, 'I:1': True, 'I:2': True},
{'I:0': False, 'I:1': False, 'I:2': True},
{'I:0': False, 'I:1': False, 'I:2': False},
{'I:0': False, 'I:1': False, 'I:2': True}]],
[[], ['B:3'], [], [], []]]],
[['regression: scenario 11',
[[['OTL', 'B:1', 'I:2'], ['OTU', 'B:3', 'I:1'], ['OTE', 'B:0', 'I:2'], ['OTL', 'B:1', 'I:0']],
[{'I:0': True, 'I:1': False, 'I:2': False},
{'power_cycle': True},
{'I:0': False, 'I:1': False, 'I:2': True},
{'power_cycle': True},
{'power_cycle': True},
{'I:0': True, 'I:1': False, 'I:2': False}]],
[['B:1'], ['B:1'], ['B:0', 'B:1'], ['B:1'], ['B:1'], ['B:1']]],
['regression: scenario 53',
[[['OTE', 'B:1', 'S:FS'],
['OTU', 'B:0', 'S:FS'],
['OTL', 'B:1', 'I:0'],
['OTL', 'B:2', 'S:FS'],
['OTL', 'B:1', 'I:2'],
['OTU', 'B:0', 'I:1']],
[{'power_cycle': True},
{'I:0': False, 'I:1': False, 'I:2': True},
{'I:0': False, 'I:1': True, 'I:2': False},
{'I:0': False, 'I:1': False, 'I:2': False},
{'I:0': False, 'I:1': True, 'I:2': False},
{'I:0': False, 'I:1': True, 'I:2': False},
{'I:0': False, 'I:1': False, 'I:2': True},
{'I:0': True, 'I:1': False, 'I:2': True},
{'I:0': True, 'I:1': False, 'I:2': False},
{'power_cycle': True}]],
[[],
['B:1', 'B:2'],
['B:2'],
['B:2'],
['B:2'],
['B:2'],
['B:1', 'B:2'],
['B:1', 'B:2'],
['B:1', 'B:2'],
['B:2']]],
['control: latched through power cycle',
[[['OTL', 'B:0', 'I:0'], ['OTU', 'B:0', 'I:1'], ['OTE', 'B:1', 'I:0'], ['OTE', 'B:2', 'S:FS']],
[{'I:0': True}, {}, {'power_cycle': True}, {}, {'I:1': True}]],
[['B:0', 'B:1', 'B:2'], ['B:0'], ['B:0'], ['B:0', 'B:2'], []]],
['control: unlatch listed before latch',
[[['OTU', 'B:3', 'I:1'], ['OTL', 'B:3', 'I:0']], [{'I:0': True, 'I:1': True}, {}, {'I:1': True}]],
[['B:3'], ['B:3'], []]],
['regression: first-scan output then power cycle',
[[['OTE', 'B:2', 'S:FS'], ['OTL', 'B:0', 'S:FS']], [{}, {'power_cycle': True}, {}, {}]],
[['B:0', 'B:2'], ['B:0'], ['B:0', 'B:2'], ['B:0']]],
['control: latch then idle',
[[['OTL', 'B:1', 'I:2'], ['OTE', 'B:0', 'I:2']], [{'I:2': True}, {}, {'power_cycle': True}, {}]],
[['B:0', 'B:1'], ['B:1'], ['B:1'], ['B:1']]],
['regression: scenario 1',
[[['OTL', 'B:3', 'I:1'],
['OTL', 'B:1', 'S:FS'],
['OTU', 'B:1', 'S:FS'],
['OTL', 'B:0', 'S:FS'],
['OTE', 'B:2', 'I:0']],
[{'I:0': True, 'I:1': False, 'I:2': False},
{'I:0': False, 'I:1': True, 'I:2': False},
{'I:0': True, 'I:1': True, 'I:2': False},
{'power_cycle': True},
{'power_cycle': True}]],
[['B:0', 'B:2'], ['B:0', 'B:3'], ['B:0', 'B:2', 'B:3'], ['B:0', 'B:3'], ['B:0', 'B:3']]],
['control: scenario 2',
[[['OTE', 'B:1', 'I:1'],
['OTU', 'B:3', 'I:2'],
['OTL', 'B:1', 'I:0'],
['OTL', 'B:1', 'I:0'],
['OTL', 'B:3', 'I:2'],
['OTL', 'B:3', 'I:1']],
[{'I:0': False, 'I:1': True, 'I:2': False},
{'I:0': False, 'I:1': False, 'I:2': False},
{'I:0': False, 'I:1': True, 'I:2': False},
{'I:0': False, 'I:1': True, 'I:2': True},
{'I:0': True, 'I:1': True, 'I:2': True},
{'I:0': True, 'I:1': False, 'I:2': False}]],
[['B:1', 'B:3'], ['B:3'], ['B:1', 'B:3'], ['B:1', 'B:3'], ['B:1', 'B:3'], ['B:1', 'B:3']]]],
[['regression: scenario 17',
[[['OTL', 'B:2', 'I:2'],
['OTU', 'B:2', 'I:1'],
['OTL', 'B:2', 'S:FS'],
['OTL', 'B:3', 'I:2'],
['OTE', 'B:1', 'I:1']],
[{'I:0': True, 'I:1': False, 'I:2': False},
{'I:0': True, 'I:1': False, 'I:2': True},
{'I:0': False, 'I:1': False, 'I:2': False},
{'I:0': True, 'I:1': False, 'I:2': True},
{'I:0': True, 'I:1': True, 'I:2': False},
{'power_cycle': True},
{'power_cycle': True}]],
[['B:2'], ['B:2', 'B:3'], ['B:2', 'B:3'], ['B:2', 'B:3'], ['B:1', 'B:3'], ['B:3'], ['B:3']]],
['regression: scenario 37',
[[['OTU', 'B:2', 'I:2'], ['OTL', 'B:1', 'S:FS'], ['OTU', 'B:0', 'I:0'], ['OTE', 'B:0', 'S:FS']],
[{'I:0': False, 'I:1': False, 'I:2': False},
{'I:0': False, 'I:1': True, 'I:2': False},
{'I:0': False, 'I:1': False, 'I:2': True},
{'I:0': True, 'I:1': False, 'I:2': False},
{'power_cycle': True},
{'power_cycle': True},
{'I:0': True, 'I:1': True, 'I:2': False},
{'power_cycle': True}]],
[['B:0', 'B:1'], ['B:1'], ['B:1'], ['B:1'], ['B:1'], ['B:1'], ['B:0', 'B:1'], ['B:1']]],
['control: latched through power cycle',
[[['OTL', 'B:0', 'I:0'], ['OTU', 'B:0', 'I:1'], ['OTE', 'B:1', 'I:0'], ['OTE', 'B:2', 'S:FS']],
[{'I:0': True}, {}, {'power_cycle': True}, {}, {'I:1': True}]],
[['B:0', 'B:1', 'B:2'], ['B:0'], ['B:0'], ['B:0', 'B:2'], []]],
['control: unlatch listed before latch',
[[['OTU', 'B:3', 'I:1'], ['OTL', 'B:3', 'I:0']], [{'I:0': True, 'I:1': True}, {}, {'I:1': True}]],
[['B:3'], ['B:3'], []]],
['regression: first-scan output then power cycle',
[[['OTE', 'B:2', 'S:FS'], ['OTL', 'B:0', 'S:FS']], [{}, {'power_cycle': True}, {}, {}]],
[['B:0', 'B:2'], ['B:0'], ['B:0', 'B:2'], ['B:0']]],
['control: latch then idle',
[[['OTL', 'B:1', 'I:2'], ['OTE', 'B:0', 'I:2']], [{'I:2': True}, {}, {'power_cycle': True}, {}]],
[['B:0', 'B:1'], ['B:1'], ['B:1'], ['B:1']]],
['control: scenario 1',
[[['OTL', 'B:3', 'S:FS'],
['OTL', 'B:1', 'I:1'],
['OTL', 'B:2', 'S:FS'],
['OTL', 'B:1', 'I:0'],
['OTL', 'B:1', 'I:1']],
[{'power_cycle': True},
{'I:0': True, 'I:1': False, 'I:2': False},
{'I:0': True, 'I:1': True, 'I:2': False},
{'I:0': False, 'I:1': False, 'I:2': True},
{'I:0': False, 'I:1': True, 'I:2': False},
{'I:0': True, 'I:1': False, 'I:2': True},
{'I:0': False, 'I:1': False, 'I:2': False}]],
[[],
['B:1', 'B:2', 'B:3'],
['B:1', 'B:2', 'B:3'],
['B:1', 'B:2', 'B:3'],
['B:1', 'B:2', 'B:3'],
['B:1', 'B:2', 'B:3'],
['B:1', 'B:2', 'B:3']]],
['regression: scenario 2',
[[['OTU', 'B:0', 'I:2'], ['OTE', 'B:2', 'I:0'], ['OTL', 'B:1', 'I:2']],
[{'power_cycle': True},
{'I:0': False, 'I:1': False, 'I:2': False},
{'I:0': True, 'I:1': False, 'I:2': False},
{'I:0': True, 'I:1': True, 'I:2': False},
{'I:0': True, 'I:1': False, 'I:2': False},
{'I:0': True, 'I:1': False, 'I:2': True},
{'I:0': True, 'I:1': True, 'I:2': False},
{'power_cycle': True},
{'I:0': False, 'I:1': True, 'I:2': False}]],
[[], [], ['B:2'], ['B:2'], ['B:2'], ['B:1', 'B:2'], ['B:1', 'B:2'], ['B:1'], ['B:1']]]]]
for label, args, expected in fixtures[N-1]:
check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: first-scan output then power cycle | [['B:0', 'B:2'], ['B:0', 'B:2'], ['B:0', 'B:2'], ['B:0']] | [['B:0', 'B:2'], ['B:0'], ['B:0', 'B:2'], ['B:0']] | Failed |
| regression: scenario 19 | [['B:2'], ['B:2'], ['B:2'], ['B:2'], ['B:2'], ['B:2'], ['B:2', 'B:3'], [], [], ['B:2', 'B:3']] | [['B:2'], [], ['B:2'], [], [], [], ['B:2', 'B:3'], [], [], ['B:2', 'B:3']] | Failed |
| control: latched through power cycle | [['B:0', 'B:1', 'B:2'], ['B:0'], ['B:0'], ['B:0', 'B:2'], []] | [['B:0', 'B:1', 'B:2'], ['B:0'], ['B:0'], ['B:0', 'B:2'], []] | Passed |
| control: unlatch listed before latch | [['B:3'], ['B:3'], []] | [['B:3'], ['B:3'], []] | Passed |
| control: latch then idle | [['B:0', 'B:1'], ['B:1'], ['B:1'], ['B:1']] | [['B:0', 'B:1'], ['B:1'], ['B:1'], ['B:1']] | Passed |
| control: scenario 1 | [['B:0'], [], ['B:2', 'B:3'], ['B:3'], ['B:3'], ['B:3'], ['B:2', 'B:3'], ['B:2', 'B:3'], ['B:3']] | [['B:0'], [], ['B:2', 'B:3'], ['B:3'], ['B:3'], ['B:3'], ['B:2', 'B:3'], ['B:2', 'B:3'], ['B:3']] | Passed |
| control: scenario 2 | [['B:0'], ['B:0'], ['B:0', 'B:1'], ['B:0', 'B:1'], ['B:0', 'B:1'], ['B:0', 'B:1'], ['B:0', 'B:1'], ['B:0', 'B:1'], ['B:0', 'B:1']] | [['B:0'], ['B:0'], ['B:0', 'B:1'], ['B:0', 'B:1'], ['B:0', 'B:1'], ['B:0', 'B:1'], ['B:0', 'B:1'], ['B:0', 'B:1'], ['B:0', 'B:1']] | Passed |
| control: scenario 3 | [['B:1', 'B:2', 'B:3'], ['B:2', 'B:3'], ['B:1', 'B:2'], ['B:2'], ['B:2']] | [['B:1', 'B:2', 'B:3'], ['B:2', 'B:3'], ['B:1', 'B:2'], ['B:2'], ['B:2']] | Passed |
SHA-256 / df29c82969428b670a45435eff8719e878a4494598cf835e19ab72a061c41685
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(rungs, scans):
bits = {}
first = True
out = []
for scan in scans:
if scan.get('power_cycle'):
for instr, bit, cond in rungs:
if instr == 'OTE':
bits[bit] = False
first = True
out.append(sorted(b for b, v in bits.items() if v))
continue
for instr, bit, cond in rungs:
rung = first if cond == 'S:FS' else bool(scan.get(cond, False))
if instr == 'OTE':
bits[bit] = rung
elif rung and instr == 'OTL':
bits[bit] = True
elif rung and instr == 'OTU':
bits[bit] = False
first = False
out.append(sorted(b for b, v in bits.items() if v))
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression: first-scan output then power cycle',
[[['OTE', 'B:2', 'S:FS'], ['OTL', 'B:0', 'S:FS']], [{}, {'power_cycle': True}, {}, {}]],
[['B:0', 'B:2'], ['B:0'], ['B:0', 'B:2'], ['B:0']]],
['regression: scenario 19',
[[['OTL', 'B:3', 'I:1'], ['OTU', 'B:3', 'I:0'], ['OTE', 'B:2', 'S:FS']],
[{'I:0': False, 'I:1': False, 'I:2': False},
{'power_cycle': True},
{'I:0': True, 'I:1': False, 'I:2': True},
{'power_cycle': True},
{'power_cycle': True},
{'power_cycle': True},
{'I:0': False, 'I:1': True, 'I:2': False},
{'I:0': True, 'I:1': False, 'I:2': True},
{'power_cycle': True},
{'I:0': False, 'I:1': True, 'I:2': False}]],
[['B:2'], [], ['B:2'], [], [], [], ['B:2', 'B:3'], [], [], ['B:2', 'B:3']]],
['control: latched through power cycle',
[[['OTL', 'B:0', 'I:0'], ['OTU', 'B:0', 'I:1'], ['OTE', 'B:1', 'I:0'], ['OTE', 'B:2', 'S:FS']],
[{'I:0': True}, {}, {'power_cycle': True}, {}, {'I:1': True}]],
[['B:0', 'B:1', 'B:2'], ['B:0'], ['B:0'], ['B:0', 'B:2'], []]],
['control: unlatch listed before latch',
[[['OTU', 'B:3', 'I:1'], ['OTL', 'B:3', 'I:0']], [{'I:0': True, 'I:1': True}, {}, {'I:1': True}]],
[['B:3'], ['B:3'], []]],
['control: latch then idle',
[[['OTL', 'B:1', 'I:2'], ['OTE', 'B:0', 'I:2']], [{'I:2': True}, {}, {'power_cycle': True}, {}]],
[['B:0', 'B:1'], ['B:1'], ['B:1'], ['B:1']]],
['control: scenario 1',
[[['OTL', 'B:3', 'I:2'],
['OTL', 'B:0', 'I:0'],
['OTE', 'B:0', 'S:FS'],
['OTL', 'B:1', 'S:FS'],
['OTU', 'B:1', 'S:FS'],
['OTE', 'B:2', 'I:1']],
[{'I:0': True, 'I:1': False, 'I:2': False},
{'I:0': False, 'I:1': False, 'I:2': False},
{'I:0': False, 'I:1': True, 'I:2': True},
{'I:0': False, 'I:1': False, 'I:2': False},
{'I:0': False, 'I:1': False, 'I:2': False},
{'I:0': True, 'I:1': False, 'I:2': False},
{'I:0': False, 'I:1': True, 'I:2': True},
{'I:0': False, 'I:1': True, 'I:2': False},
{'I:0': True, 'I:1': False, 'I:2': True}]],
[['B:0'], [], ['B:2', 'B:3'], ['B:3'], ['B:3'], ['B:3'], ['B:2', 'B:3'], ['B:2', 'B:3'], ['B:3']]],
['control: scenario 2',
[[['OTU', 'B:2', 'I:1'], ['OTL', 'B:1', 'I:1'], ['OTL', 'B:1', 'I:2'], ['OTL', 'B:0', 'I:0']],
[{'I:0': True, 'I:1': False, 'I:2': False},
{'power_cycle': True},
{'I:0': False, 'I:1': False, 'I:2': True},
{'I:0': True, 'I:1': True, 'I:2': True},
{'I:0': False, 'I:1': True, 'I:2': True},
{'power_cycle': True},
{'I:0': False, 'I:1': True, 'I:2': False},
{'I:0': False, 'I:1': False, 'I:2': True},
{'I:0': False, 'I:1': True, 'I:2': True}]],
[['B:0'],
['B:0'],
['B:0', 'B:1'],
['B:0', 'B:1'],
['B:0', 'B:1'],
['B:0', 'B:1'],
['B:0', 'B:1'],
['B:0', 'B:1'],
['B:0', 'B:1']]],
['control: scenario 3',
[[['OTE', 'B:3', 'I:2'],
['OTE', 'B:1', 'I:1'],
['OTL', 'B:2', 'I:0'],
['OTL', 'B:2', 'I:2'],
['OTL', 'B:2', 'I:0']],
[{'I:0': True, 'I:1': True, 'I:2': True},
{'I:0': False, 'I:1': False, 'I:2': True},
{'I:0': False, 'I:1': True, 'I:2': False},
{'I:0': True, 'I:1': False, 'I:2': False},
{'power_cycle': True}]],
[['B:1', 'B:2', 'B:3'], ['B:2', 'B:3'], ['B:1', 'B:2'], ['B:2'], ['B:2']]]],
[['regression: scenario 5',
[[['OTE', 'B:2', 'I:2'],
['OTE', 'B:0', 'I:0'],
['OTE', 'B:2', 'I:2'],
['OTU', 'B:2', 'I:1'],
['OTL', 'B:2', 'I:0']],
[{'I:0': True, 'I:1': True, 'I:2': True},
{'I:0': True, 'I:1': False, 'I:2': True},
{'power_cycle': True},
{'I:0': False, 'I:1': False, 'I:2': False},
{'I:0': True, 'I:1': True, 'I:2': True},
{'power_cycle': True},
{'power_cycle': True}]],
[['B:0', 'B:2'], ['B:0', 'B:2'], [], [], ['B:0', 'B:2'], [], []]],
['regression: scenario 7',
[[['OTU', 'B:2', 'I:0'], ['OTL', 'B:3', 'S:FS'], ['OTE', 'B:1', 'S:FS']],
[{'I:0': True, 'I:1': True, 'I:2': True},
{'I:0': False, 'I:1': True, 'I:2': False},
{'power_cycle': True},
{'power_cycle': True},
{'I:0': False, 'I:1': True, 'I:2': True},
{'I:0': False, 'I:1': False, 'I:2': False},
{'I:0': True, 'I:1': False, 'I:2': True},
{'power_cycle': True},
{'I:0': True, 'I:1': True, 'I:2': False},
{'power_cycle': True}]],
[['B:1', 'B:3'],
['B:3'],
['B:3'],
['B:3'],
['B:1', 'B:3'],
['B:3'],
['B:3'],
['B:3'],
['B:1', 'B:3'],
['B:3']]],
['control: latched through power cycle',
[[['OTL', 'B:0', 'I:0'], ['OTU', 'B:0', 'I:1'], ['OTE', 'B:1', 'I:0'], ['OTE', 'B:2', 'S:FS']],
[{'I:0': True}, {}, {'power_cycle': True}, {}, {'I:1': True}]],
[['B:0', 'B:1', 'B:2'], ['B:0'], ['B:0'], ['B:0', 'B:2'], []]],
['control: unlatch listed before latch',
[[['OTU', 'B:3', 'I:1'], ['OTL', 'B:3', 'I:0']], [{'I:0': True, 'I:1': True}, {}, {'I:1': True}]],
[['B:3'], ['B:3'], []]],
['regression: first-scan output then power cycle',
[[['OTE', 'B:2', 'S:FS'], ['OTL', 'B:0', 'S:FS']], [{}, {'power_cycle': True}, {}, {}]],
[['B:0', 'B:2'], ['B:0'], ['B:0', 'B:2'], ['B:0']]],
['control: latch then idle',
[[['OTL', 'B:1', 'I:2'], ['OTE', 'B:0', 'I:2']], [{'I:2': True}, {}, {'power_cycle': True}, {}]],
[['B:0', 'B:1'], ['B:1'], ['B:1'], ['B:1']]],
['control: scenario 1',
[[['OTE', 'B:3', 'S:FS'], ['OTL', 'B:0', 'S:FS'], ['OTL', 'B:0', 'I:0'], ['OTE', 'B:0', 'S:FS']],
[{'I:0': True, 'I:1': True, 'I:2': False},
{'I:0': False, 'I:1': True, 'I:2': False},
{'I:0': False, 'I:1': False, 'I:2': False},
{'I:0': False, 'I:1': False, 'I:2': True},
{'I:0': False, 'I:1': False, 'I:2': False},
{'I:0': False, 'I:1': False, 'I:2': False}]],
[['B:0', 'B:3'], [], [], [], [], []]],
['control: scenario 2',
[[['OTL', 'B:2', 'I:1'], ['OTL', 'B:3', 'I:2'], ['OTU', 'B:0', 'I:0'], ['OTL', 'B:0', 'S:FS']],
[{'I:0': False, 'I:1': False, 'I:2': True},
{'I:0': True, 'I:1': True, 'I:2': False},
{'I:0': True, 'I:1': False, 'I:2': False},
{'I:0': True, 'I:1': True, 'I:2': False},
{'power_cycle': True},
{'I:0': False, 'I:1': False, 'I:2': True},
{'I:0': False, 'I:1': True, 'I:2': False}]],
[['B:0', 'B:3'],
['B:2', 'B:3'],
['B:2', 'B:3'],
['B:2', 'B:3'],
['B:2', 'B:3'],
['B:0', 'B:2', 'B:3'],
['B:0', 'B:2', 'B:3']]]],
[['regression: scenario 3',
[[['OTU', 'B:0', 'I:0'], ['OTL', 'B:0', 'I:0'], ['OTE', 'B:3', 'I:0']],
[{'I:0': False, 'I:1': True, 'I:2': False},
{'I:0': False, 'I:1': False, 'I:2': False},
{'I:0': False, 'I:1': False, 'I:2': True},
{'power_cycle': True},
{'I:0': True, 'I:1': False, 'I:2': False},
{'power_cycle': True}]],
[[], [], [], [], ['B:0', 'B:3'], ['B:0']]],
['regression: first-scan output then power cycle',
[[['OTE', 'B:2', 'S:FS'], ['OTL', 'B:0', 'S:FS']], [{}, {'power_cycle': True}, {}, {}]],
[['B:0', 'B:2'], ['B:0'], ['B:0', 'B:2'], ['B:0']]],
['control: latched through power cycle',
[[['OTL', 'B:0', 'I:0'], ['OTU', 'B:0', 'I:1'], ['OTE', 'B:1', 'I:0'], ['OTE', 'B:2', 'S:FS']],
[{'I:0': True}, {}, {'power_cycle': True}, {}, {'I:1': True}]],
[['B:0', 'B:1', 'B:2'], ['B:0'], ['B:0'], ['B:0', 'B:2'], []]],
['control: unlatch listed before latch',
[[['OTU', 'B:3', 'I:1'], ['OTL', 'B:3', 'I:0']], [{'I:0': True, 'I:1': True}, {}, {'I:1': True}]],
[['B:3'], ['B:3'], []]],
['control: latch then idle',
[[['OTL', 'B:1', 'I:2'], ['OTE', 'B:0', 'I:2']], [{'I:2': True}, {}, {'power_cycle': True}, {}]],
[['B:0', 'B:1'], ['B:1'], ['B:1'], ['B:1']]],
['regression: scenario 1',
[[['OTL', 'B:3', 'I:2'], ['OTE', 'B:1', 'I:0'], ['OTL', 'B:1', 'I:0']],
[{'power_cycle': True},
{'power_cycle': True},
{'I:0': True, 'I:1': True, 'I:2': True},
{'I:0': True, 'I:1': False, 'I:2': False},
{'power_cycle': True},
{'I:0': False, 'I:1': False, 'I:2': True}]],
[[], [], ['B:1', 'B:3'], ['B:1', 'B:3'], ['B:3'], ['B:3']]],
['control: scenario 2',
[[['OTL', 'B:0', 'I:2'], ['OTL', 'B:2', 'S:FS'], ['OTU', 'B:0', 'I:2'], ['OTU', 'B:3', 'I:2']],
[{'I:0': True, 'I:1': False, 'I:2': False},
{'I:0': True, 'I:1': True, 'I:2': True},
{'power_cycle': True},
{'power_cycle': True},
{'I:0': False, 'I:1': False, 'I:2': True}]],
[['B:2'], ['B:2'], ['B:2'], ['B:2'], ['B:2']]],
['control: scenario 4',
[[['OTU', 'B:3', 'I:1'], ['OTU', 'B:0', 'S:FS'], ['OTE', 'B:3', 'I:1']],
[{'I:0': False, 'I:1': False, 'I:2': True},
{'I:0': False, 'I:1': True, 'I:2': True},
{'I:0': False, 'I:1': False, 'I:2': True},
{'I:0': False, 'I:1': False, 'I:2': False},
{'I:0': False, 'I:1': False, 'I:2': True}]],
[[], ['B:3'], [], [], []]]],
[['regression: scenario 11',
[[['OTL', 'B:1', 'I:2'], ['OTU', 'B:3', 'I:1'], ['OTE', 'B:0', 'I:2'], ['OTL', 'B:1', 'I:0']],
[{'I:0': True, 'I:1': False, 'I:2': False},
{'power_cycle': True},
{'I:0': False, 'I:1': False, 'I:2': True},
{'power_cycle': True},
{'power_cycle': True},
{'I:0': True, 'I:1': False, 'I:2': False}]],
[['B:1'], ['B:1'], ['B:0', 'B:1'], ['B:1'], ['B:1'], ['B:1']]],
['regression: scenario 53',
[[['OTE', 'B:1', 'S:FS'],
['OTU', 'B:0', 'S:FS'],
['OTL', 'B:1', 'I:0'],
['OTL', 'B:2', 'S:FS'],
['OTL', 'B:1', 'I:2'],
['OTU', 'B:0', 'I:1']],
[{'power_cycle': True},
{'I:0': False, 'I:1': False, 'I:2': True},
{'I:0': False, 'I:1': True, 'I:2': False},
{'I:0': False, 'I:1': False, 'I:2': False},
{'I:0': False, 'I:1': True, 'I:2': False},
{'I:0': False, 'I:1': True, 'I:2': False},
{'I:0': False, 'I:1': False, 'I:2': True},
{'I:0': True, 'I:1': False, 'I:2': True},
{'I:0': True, 'I:1': False, 'I:2': False},
{'power_cycle': True}]],
[[],
['B:1', 'B:2'],
['B:2'],
['B:2'],
['B:2'],
['B:2'],
['B:1', 'B:2'],
['B:1', 'B:2'],
['B:1', 'B:2'],
['B:2']]],
['control: latched through power cycle',
[[['OTL', 'B:0', 'I:0'], ['OTU', 'B:0', 'I:1'], ['OTE', 'B:1', 'I:0'], ['OTE', 'B:2', 'S:FS']],
[{'I:0': True}, {}, {'power_cycle': True}, {}, {'I:1': True}]],
[['B:0', 'B:1', 'B:2'], ['B:0'], ['B:0'], ['B:0', 'B:2'], []]],
['control: unlatch listed before latch',
[[['OTU', 'B:3', 'I:1'], ['OTL', 'B:3', 'I:0']], [{'I:0': True, 'I:1': True}, {}, {'I:1': True}]],
[['B:3'], ['B:3'], []]],
['regression: first-scan output then power cycle',
[[['OTE', 'B:2', 'S:FS'], ['OTL', 'B:0', 'S:FS']], [{}, {'power_cycle': True}, {}, {}]],
[['B:0', 'B:2'], ['B:0'], ['B:0', 'B:2'], ['B:0']]],
['control: latch then idle',
[[['OTL', 'B:1', 'I:2'], ['OTE', 'B:0', 'I:2']], [{'I:2': True}, {}, {'power_cycle': True}, {}]],
[['B:0', 'B:1'], ['B:1'], ['B:1'], ['B:1']]],
['regression: scenario 1',
[[['OTL', 'B:3', 'I:1'],
['OTL', 'B:1', 'S:FS'],
['OTU', 'B:1', 'S:FS'],
['OTL', 'B:0', 'S:FS'],
['OTE', 'B:2', 'I:0']],
[{'I:0': True, 'I:1': False, 'I:2': False},
{'I:0': False, 'I:1': True, 'I:2': False},
{'I:0': True, 'I:1': True, 'I:2': False},
{'power_cycle': True},
{'power_cycle': True}]],
[['B:0', 'B:2'], ['B:0', 'B:3'], ['B:0', 'B:2', 'B:3'], ['B:0', 'B:3'], ['B:0', 'B:3']]],
['control: scenario 2',
[[['OTE', 'B:1', 'I:1'],
['OTU', 'B:3', 'I:2'],
['OTL', 'B:1', 'I:0'],
['OTL', 'B:1', 'I:0'],
['OTL', 'B:3', 'I:2'],
['OTL', 'B:3', 'I:1']],
[{'I:0': False, 'I:1': True, 'I:2': False},
{'I:0': False, 'I:1': False, 'I:2': False},
{'I:0': False, 'I:1': True, 'I:2': False},
{'I:0': False, 'I:1': True, 'I:2': True},
{'I:0': True, 'I:1': True, 'I:2': True},
{'I:0': True, 'I:1': False, 'I:2': False}]],
[['B:1', 'B:3'], ['B:3'], ['B:1', 'B:3'], ['B:1', 'B:3'], ['B:1', 'B:3'], ['B:1', 'B:3']]]],
[['regression: scenario 17',
[[['OTL', 'B:2', 'I:2'],
['OTU', 'B:2', 'I:1'],
['OTL', 'B:2', 'S:FS'],
['OTL', 'B:3', 'I:2'],
['OTE', 'B:1', 'I:1']],
[{'I:0': True, 'I:1': False, 'I:2': False},
{'I:0': True, 'I:1': False, 'I:2': True},
{'I:0': False, 'I:1': False, 'I:2': False},
{'I:0': True, 'I:1': False, 'I:2': True},
{'I:0': True, 'I:1': True, 'I:2': False},
{'power_cycle': True},
{'power_cycle': True}]],
[['B:2'], ['B:2', 'B:3'], ['B:2', 'B:3'], ['B:2', 'B:3'], ['B:1', 'B:3'], ['B:3'], ['B:3']]],
['regression: scenario 37',
[[['OTU', 'B:2', 'I:2'], ['OTL', 'B:1', 'S:FS'], ['OTU', 'B:0', 'I:0'], ['OTE', 'B:0', 'S:FS']],
[{'I:0': False, 'I:1': False, 'I:2': False},
{'I:0': False, 'I:1': True, 'I:2': False},
{'I:0': False, 'I:1': False, 'I:2': True},
{'I:0': True, 'I:1': False, 'I:2': False},
{'power_cycle': True},
{'power_cycle': True},
{'I:0': True, 'I:1': True, 'I:2': False},
{'power_cycle': True}]],
[['B:0', 'B:1'], ['B:1'], ['B:1'], ['B:1'], ['B:1'], ['B:1'], ['B:0', 'B:1'], ['B:1']]],
['control: latched through power cycle',
[[['OTL', 'B:0', 'I:0'], ['OTU', 'B:0', 'I:1'], ['OTE', 'B:1', 'I:0'], ['OTE', 'B:2', 'S:FS']],
[{'I:0': True}, {}, {'power_cycle': True}, {}, {'I:1': True}]],
[['B:0', 'B:1', 'B:2'], ['B:0'], ['B:0'], ['B:0', 'B:2'], []]],
['control: unlatch listed before latch',
[[['OTU', 'B:3', 'I:1'], ['OTL', 'B:3', 'I:0']], [{'I:0': True, 'I:1': True}, {}, {'I:1': True}]],
[['B:3'], ['B:3'], []]],
['regression: first-scan output then power cycle',
[[['OTE', 'B:2', 'S:FS'], ['OTL', 'B:0', 'S:FS']], [{}, {'power_cycle': True}, {}, {}]],
[['B:0', 'B:2'], ['B:0'], ['B:0', 'B:2'], ['B:0']]],
['control: latch then idle',
[[['OTL', 'B:1', 'I:2'], ['OTE', 'B:0', 'I:2']], [{'I:2': True}, {}, {'power_cycle': True}, {}]],
[['B:0', 'B:1'], ['B:1'], ['B:1'], ['B:1']]],
['control: scenario 1',
[[['OTL', 'B:3', 'S:FS'],
['OTL', 'B:1', 'I:1'],
['OTL', 'B:2', 'S:FS'],
['OTL', 'B:1', 'I:0'],
['OTL', 'B:1', 'I:1']],
[{'power_cycle': True},
{'I:0': True, 'I:1': False, 'I:2': False},
{'I:0': True, 'I:1': True, 'I:2': False},
{'I:0': False, 'I:1': False, 'I:2': True},
{'I:0': False, 'I:1': True, 'I:2': False},
{'I:0': True, 'I:1': False, 'I:2': True},
{'I:0': False, 'I:1': False, 'I:2': False}]],
[[],
['B:1', 'B:2', 'B:3'],
['B:1', 'B:2', 'B:3'],
['B:1', 'B:2', 'B:3'],
['B:1', 'B:2', 'B:3'],
['B:1', 'B:2', 'B:3'],
['B:1', 'B:2', 'B:3']]],
['regression: scenario 2',
[[['OTU', 'B:0', 'I:2'], ['OTE', 'B:2', 'I:0'], ['OTL', 'B:1', 'I:2']],
[{'power_cycle': True},
{'I:0': False, 'I:1': False, 'I:2': False},
{'I:0': True, 'I:1': False, 'I:2': False},
{'I:0': True, 'I:1': True, 'I:2': False},
{'I:0': True, 'I:1': False, 'I:2': False},
{'I:0': True, 'I:1': False, 'I:2': True},
{'I:0': True, 'I:1': True, 'I:2': False},
{'power_cycle': True},
{'I:0': False, 'I:1': True, 'I:2': False}]],
[[], [], ['B:2'], ['B:2'], ['B:2'], ['B:1', 'B:2'], ['B:1', 'B:2'], ['B:1'], ['B:1']]]]]
for label, args, expected in fixtures[N-1]:
check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: first-scan output then power cycle | [['B:0', 'B:2'], ['B:0'], ['B:0', 'B:2'], ['B:0']] | [['B:0', 'B:2'], ['B:0'], ['B:0', 'B:2'], ['B:0']] | Passed |
| regression: scenario 19 | [['B:2'], [], ['B:2'], [], [], [], ['B:2', 'B:3'], [], [], ['B:2', 'B:3']] | [['B:2'], [], ['B:2'], [], [], [], ['B:2', 'B:3'], [], [], ['B:2', 'B:3']] | Passed |
| control: latched through power cycle | [['B:0', 'B:1', 'B:2'], ['B:0'], ['B:0'], ['B:0', 'B:2'], []] | [['B:0', 'B:1', 'B:2'], ['B:0'], ['B:0'], ['B:0', 'B:2'], []] | Passed |
| control: unlatch listed before latch | [['B:3'], ['B:3'], []] | [['B:3'], ['B:3'], []] | Passed |
| control: latch then idle | [['B:0', 'B:1'], ['B:1'], ['B:1'], ['B:1']] | [['B:0', 'B:1'], ['B:1'], ['B:1'], ['B:1']] | Passed |
| control: scenario 1 | [['B:0'], [], ['B:2', 'B:3'], ['B:3'], ['B:3'], ['B:3'], ['B:2', 'B:3'], ['B:2', 'B:3'], ['B:3']] | [['B:0'], [], ['B:2', 'B:3'], ['B:3'], ['B:3'], ['B:3'], ['B:2', 'B:3'], ['B:2', 'B:3'], ['B:3']] | Passed |
| control: scenario 2 | [['B:0'], ['B:0'], ['B:0', 'B:1'], ['B:0', 'B:1'], ['B:0', 'B:1'], ['B:0', 'B:1'], ['B:0', 'B:1'], ['B:0', 'B:1'], ['B:0', 'B:1']] | [['B:0'], ['B:0'], ['B:0', 'B:1'], ['B:0', 'B:1'], ['B:0', 'B:1'], ['B:0', 'B:1'], ['B:0', 'B:1'], ['B:0', 'B:1'], ['B:0', 'B:1']] | Passed |
| control: scenario 3 | [['B:1', 'B:2', 'B:3'], ['B:2', 'B:3'], ['B:1', 'B:2'], ['B:2'], ['B:2']] | [['B:1', 'B:2', 'B:3'], ['B:2', 'B:3'], ['B:1', 'B:2'], ['B:2'], ['B:2']] | Passed |
SHA-256 / ac6a0a7891d9d7bff53e03e2389ca8ce801d471142f70fbe13573258ec1e2b98
Verification & scope
A deterministic bounded teaching model of one PLC instruction or rung pattern evaluated scan by scan. The stated contract is a stipulated toy convention, not a claim of conformance to any vendor controller or IEC 61131-3 runtime. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.
Observations recorded using Python 3.12.14 at 2026-09-29T14:51:41.912480+00:00.
Case digest / aac15a790e0fe8b0ab32e12a92694178d5211b6e21171037ac2316b1ff7d638d