broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(d):
    return {'lower-clamp':(min(d['new'],d['hi']) if d['lock'] and d['hi'] is not None else d['new']), 'upper-clamp':(max(d['new'],d['lo']) if d['lo'] is not None else d['new']), 'linked-upper':(d['hi']+d['new']-d['lo'] if d['linked'] and d['hi'] is not None and d['lo'] is not None else d['hi']), 'linked-lower':(d['lo']+d['new']-d['hi'] if d['linked'] and d['hi'] is not None and d['lo'] is not None else d['lo']), 'link-enabled':(d['lo'] is not None and d['hi'] is not None), 'reversal-warning':(d['lo'] is not None and d['hi'] is not None and d['lo']>d['hi'])}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'lo': 0, 'hi': None, 'new': -1, 'lock': False, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': None, 'linked-lower': 0, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': -1, 'lock': True, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': 0, 'linked-upper': 1, 'linked-lower': -3, 'link-enabled': True, 'reversal-warning': False}), ({'lo': None, 'hi': None, 'new': 1, 'lock': True, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': None, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': None, 'hi': 2, 'new': 1, 'lock': False, 'linked': False}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 2, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': None, 'hi': 5, 'new': -1, 'lock': False, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': 5, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': None, 'hi': 5, 'new': 7, 'lock': True, 'linked': False}, {'lower-clamp': 5, 'upper-clamp': 7, 'linked-upper': 5, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': None, 'new': 1, 'lock': True, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': None, 'linked-lower': 0, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': 1, 'lock': False, 'linked': False}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 2, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': -1, 'lock': False, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': 4, 'linked-lower': -6, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': 7, 'lock': True, 'linked': False}, {'lower-clamp': 5, 'upper-clamp': 7, 'linked-upper': 5, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False})], 2: [({'lo': 0, 'hi': None, 'new': -1, 'lock': False, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': None, 'linked-lower': 0, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 5, 'hi': None, 'new': -1, 'lock': True, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': 5, 'linked-upper': None, 'linked-lower': 5, 'link-enabled': False, 'reversal-warning': False}), ({'lo': None, 'hi': 2, 'new': -1, 'lock': True, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': 2, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': None, 'hi': 2, 'new': 7, 'lock': True, 'linked': True}, {'lower-clamp': 2, 'upper-clamp': 7, 'linked-upper': 2, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': None, 'hi': 5, 'new': 7, 'lock': False, 'linked': False}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': 5, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': None, 'new': 1, 'lock': False, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': None, 'linked-lower': 0, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': -1, 'lock': True, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': 0, 'linked-upper': 2, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': 7, 'lock': True, 'linked': True}, {'lower-clamp': 2, 'upper-clamp': 7, 'linked-upper': 9, 'linked-lower': 5, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': 7, 'lock': False, 'linked': False}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': 5, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 5, 'hi': None, 'new': 1, 'lock': False, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': None, 'linked-lower': 5, 'link-enabled': False, 'reversal-warning': False})], 3: [({'lo': 0, 'hi': 2, 'new': -1, 'lock': False, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': 2, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 5, 'hi': None, 'new': 1, 'lock': True, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 5, 'linked-upper': None, 'linked-lower': 5, 'link-enabled': False, 'reversal-warning': False}), ({'lo': None, 'hi': 2, 'new': 7, 'lock': False, 'linked': True}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': 2, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': None, 'hi': 5, 'new': 1, 'lock': True, 'linked': False}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 5, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': None, 'new': -1, 'lock': True, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': 0, 'linked-upper': None, 'linked-lower': 0, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': 7, 'lock': False, 'linked': True}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': 9, 'linked-lower': 5, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': 1, 'lock': True, 'linked': False}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 5, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 5, 'hi': None, 'new': -1, 'lock': True, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': 5, 'linked-upper': None, 'linked-lower': 5, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 5, 'hi': 2, 'new': -1, 'lock': False, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': 2, 'linked-lower': 5, 'link-enabled': True, 'reversal-warning': True}), ({'lo': 5, 'hi': 2, 'new': 7, 'lock': False, 'linked': True}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': 4, 'linked-lower': 10, 'link-enabled': True, 'reversal-warning': True})], 4: [({'lo': 0, 'hi': 2, 'new': -1, 'lock': False, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': 1, 'linked-lower': -3, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 5, 'hi': 2, 'new': 1, 'lock': True, 'linked': False}, {'lower-clamp': 1, 'upper-clamp': 5, 'linked-upper': 2, 'linked-lower': 5, 'link-enabled': True, 'reversal-warning': True}), ({'lo': None, 'hi': 5, 'new': 1, 'lock': False, 'linked': False}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 5, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': None, 'new': -1, 'lock': False, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': None, 'linked-lower': 0, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': None, 'new': 7, 'lock': True, 'linked': False}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': None, 'linked-lower': 0, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': 1, 'lock': True, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 3, 'linked-lower': -1, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': 1, 'lock': False, 'linked': False}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 5, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 5, 'hi': None, 'new': -1, 'lock': False, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': None, 'linked-lower': 5, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 5, 'hi': None, 'new': 7, 'lock': True, 'linked': False}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': None, 'linked-lower': 5, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 5, 'hi': 2, 'new': 1, 'lock': True, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 5, 'linked-upper': -2, 'linked-lower': 4, 'link-enabled': True, 'reversal-warning': True})], 5: [({'lo': 0, 'hi': 5, 'new': -1, 'lock': False, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': 5, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 5, 'hi': 5, 'new': -1, 'lock': True, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': 5, 'linked-upper': -1, 'linked-lower': -1, 'link-enabled': True, 'reversal-warning': False}), ({'lo': None, 'hi': 5, 'new': 7, 'lock': True, 'linked': True}, {'lower-clamp': 5, 'upper-clamp': 7, 'linked-upper': 5, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': None, 'new': 7, 'lock': False, 'linked': False}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': None, 'linked-lower': 0, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': 1, 'lock': False, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 3, 'linked-lower': -1, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': -1, 'lock': True, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': 0, 'linked-upper': 5, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': 7, 'lock': True, 'linked': True}, {'lower-clamp': 5, 'upper-clamp': 7, 'linked-upper': 12, 'linked-lower': 2, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 5, 'hi': None, 'new': 7, 'lock': False, 'linked': False}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': None, 'linked-lower': 5, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 5, 'hi': 2, 'new': 1, 'lock': False, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': -2, 'linked-lower': 4, 'link-enabled': True, 'reversal-warning': True}), ({'lo': 5, 'hi': 5, 'new': -1, 'lock': True, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': 5, 'linked-upper': 5, 'linked-lower': 5, 'link-enabled': True, 'reversal-warning': False})]}
for index, (data, expected) in enumerate(fixtures[N]):
    check("contract fixture " + str(index), solve(data), 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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(d):
    return {'lower-clamp':(min(d['new'],d['hi']) if d['lock'] and d['hi'] is not None else d['new']), 'upper-clamp':(d['new']), 'linked-upper':(d['hi']+d['new']-d['lo'] if d['linked'] and d['hi'] is not None and d['lo'] is not None else d['hi']), 'linked-lower':(d['lo']+d['new']-d['hi'] if d['linked'] and d['hi'] is not None and d['lo'] is not None else d['lo']), 'link-enabled':(d['lo'] is not None and d['hi'] is not None), 'reversal-warning':(d['lo'] is not None and d['hi'] is not None and d['lo']>d['hi'])}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'lo': 0, 'hi': None, 'new': -1, 'lock': False, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': None, 'linked-lower': 0, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': -1, 'lock': True, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': 0, 'linked-upper': 1, 'linked-lower': -3, 'link-enabled': True, 'reversal-warning': False}), ({'lo': None, 'hi': None, 'new': 1, 'lock': True, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': None, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': None, 'hi': 2, 'new': 1, 'lock': False, 'linked': False}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 2, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': None, 'hi': 5, 'new': -1, 'lock': False, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': 5, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': None, 'hi': 5, 'new': 7, 'lock': True, 'linked': False}, {'lower-clamp': 5, 'upper-clamp': 7, 'linked-upper': 5, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': None, 'new': 1, 'lock': True, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': None, 'linked-lower': 0, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': 1, 'lock': False, 'linked': False}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 2, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': -1, 'lock': False, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': 4, 'linked-lower': -6, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': 7, 'lock': True, 'linked': False}, {'lower-clamp': 5, 'upper-clamp': 7, 'linked-upper': 5, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False})], 2: [({'lo': 0, 'hi': None, 'new': -1, 'lock': False, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': None, 'linked-lower': 0, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 5, 'hi': None, 'new': -1, 'lock': True, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': 5, 'linked-upper': None, 'linked-lower': 5, 'link-enabled': False, 'reversal-warning': False}), ({'lo': None, 'hi': 2, 'new': -1, 'lock': True, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': 2, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': None, 'hi': 2, 'new': 7, 'lock': True, 'linked': True}, {'lower-clamp': 2, 'upper-clamp': 7, 'linked-upper': 2, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': None, 'hi': 5, 'new': 7, 'lock': False, 'linked': False}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': 5, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': None, 'new': 1, 'lock': False, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': None, 'linked-lower': 0, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': -1, 'lock': True, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': 0, 'linked-upper': 2, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': 7, 'lock': True, 'linked': True}, {'lower-clamp': 2, 'upper-clamp': 7, 'linked-upper': 9, 'linked-lower': 5, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': 7, 'lock': False, 'linked': False}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': 5, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 5, 'hi': None, 'new': 1, 'lock': False, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': None, 'linked-lower': 5, 'link-enabled': False, 'reversal-warning': False})], 3: [({'lo': 0, 'hi': 2, 'new': -1, 'lock': False, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': 2, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 5, 'hi': None, 'new': 1, 'lock': True, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 5, 'linked-upper': None, 'linked-lower': 5, 'link-enabled': False, 'reversal-warning': False}), ({'lo': None, 'hi': 2, 'new': 7, 'lock': False, 'linked': True}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': 2, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': None, 'hi': 5, 'new': 1, 'lock': True, 'linked': False}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 5, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': None, 'new': -1, 'lock': True, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': 0, 'linked-upper': None, 'linked-lower': 0, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': 7, 'lock': False, 'linked': True}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': 9, 'linked-lower': 5, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': 1, 'lock': True, 'linked': False}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 5, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 5, 'hi': None, 'new': -1, 'lock': True, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': 5, 'linked-upper': None, 'linked-lower': 5, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 5, 'hi': 2, 'new': -1, 'lock': False, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': 2, 'linked-lower': 5, 'link-enabled': True, 'reversal-warning': True}), ({'lo': 5, 'hi': 2, 'new': 7, 'lock': False, 'linked': True}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': 4, 'linked-lower': 10, 'link-enabled': True, 'reversal-warning': True})], 4: [({'lo': 0, 'hi': 2, 'new': -1, 'lock': False, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': 1, 'linked-lower': -3, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 5, 'hi': 2, 'new': 1, 'lock': True, 'linked': False}, {'lower-clamp': 1, 'upper-clamp': 5, 'linked-upper': 2, 'linked-lower': 5, 'link-enabled': True, 'reversal-warning': True}), ({'lo': None, 'hi': 5, 'new': 1, 'lock': False, 'linked': False}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 5, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': None, 'new': -1, 'lock': False, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': None, 'linked-lower': 0, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': None, 'new': 7, 'lock': True, 'linked': False}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': None, 'linked-lower': 0, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': 1, 'lock': True, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 3, 'linked-lower': -1, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': 1, 'lock': False, 'linked': False}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 5, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 5, 'hi': None, 'new': -1, 'lock': False, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': None, 'linked-lower': 5, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 5, 'hi': None, 'new': 7, 'lock': True, 'linked': False}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': None, 'linked-lower': 5, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 5, 'hi': 2, 'new': 1, 'lock': True, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 5, 'linked-upper': -2, 'linked-lower': 4, 'link-enabled': True, 'reversal-warning': True})], 5: [({'lo': 0, 'hi': 5, 'new': -1, 'lock': False, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': 5, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 5, 'hi': 5, 'new': -1, 'lock': True, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': 5, 'linked-upper': -1, 'linked-lower': -1, 'link-enabled': True, 'reversal-warning': False}), ({'lo': None, 'hi': 5, 'new': 7, 'lock': True, 'linked': True}, {'lower-clamp': 5, 'upper-clamp': 7, 'linked-upper': 5, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': None, 'new': 7, 'lock': False, 'linked': False}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': None, 'linked-lower': 0, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': 1, 'lock': False, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 3, 'linked-lower': -1, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': -1, 'lock': True, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': 0, 'linked-upper': 5, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': 7, 'lock': True, 'linked': True}, {'lower-clamp': 5, 'upper-clamp': 7, 'linked-upper': 12, 'linked-lower': 2, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 5, 'hi': None, 'new': 7, 'lock': False, 'linked': False}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': None, 'linked-lower': 5, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 5, 'hi': 2, 'new': 1, 'lock': False, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': -2, 'linked-lower': 4, 'link-enabled': True, 'reversal-warning': True}), ({'lo': 5, 'hi': 5, 'new': -1, 'lock': True, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': 5, 'linked-upper': 5, 'linked-lower': 5, 'link-enabled': True, 'reversal-warning': False})]}
for index, (data, expected) in enumerate(fixtures[N]):
    check("contract fixture " + str(index), solve(data), 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)

prompt:
Upper-bound crossing is clamped only under range lock is violated by the widget projection.

Editing one numeric endpoint clamps only when the range lock is enabled; linked-width edits translate the opposite endpoint, and unbounded sides remain unbounded. This example checks: Upper-bound crossing is clamped only under range lock.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(d):
    return {'lower-clamp':(min(d['new'],d['hi']) if d['lock'] and d['hi'] is not None else d['new']), 'upper-clamp':(max(d['new'],d['lo']) if d['lock'] and d['lo'] is not None else d['new']), 'linked-upper':(d['new'] if d['linked'] else d['hi']), 'linked-lower':(d['lo']+d['new']-d['hi'] if d['linked'] and d['hi'] is not None and d['lo'] is not None else d['lo']), 'link-enabled':(d['lo'] is not None and d['hi'] is not None), 'reversal-warning':(d['lo'] is not None and d['hi'] is not None and d['lo']>d['hi'])}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'lo': None, 'hi': None, 'new': -1, 'lock': False, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': None, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': 1, 'lock': True, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 3, 'linked-lower': -1, 'link-enabled': True, 'reversal-warning': False}), ({'lo': None, 'hi': None, 'new': 1, 'lock': True, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': None, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': None, 'hi': 2, 'new': 1, 'lock': False, 'linked': False}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 2, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': None, 'hi': 5, 'new': -1, 'lock': False, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': 5, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': None, 'hi': 5, 'new': 7, 'lock': True, 'linked': False}, {'lower-clamp': 5, 'upper-clamp': 7, 'linked-upper': 5, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': None, 'new': 1, 'lock': True, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': None, 'linked-lower': 0, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': 1, 'lock': False, 'linked': False}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 2, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': -1, 'lock': False, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': 4, 'linked-lower': -6, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': 7, 'lock': True, 'linked': False}, {'lower-clamp': 5, 'upper-clamp': 7, 'linked-upper': 5, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False})], 2: [({'lo': None, 'hi': None, 'new': -1, 'lock': True, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': None, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': -1, 'lock': False, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': 4, 'linked-lower': -6, 'link-enabled': True, 'reversal-warning': False}), ({'lo': None, 'hi': 2, 'new': -1, 'lock': True, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': 2, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': None, 'hi': 2, 'new': 7, 'lock': True, 'linked': True}, {'lower-clamp': 2, 'upper-clamp': 7, 'linked-upper': 2, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': None, 'hi': 5, 'new': 7, 'lock': False, 'linked': False}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': 5, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': None, 'new': 1, 'lock': False, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': None, 'linked-lower': 0, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': -1, 'lock': True, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': 0, 'linked-upper': 2, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': 7, 'lock': True, 'linked': True}, {'lower-clamp': 2, 'upper-clamp': 7, 'linked-upper': 9, 'linked-lower': 5, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': 7, 'lock': False, 'linked': False}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': 5, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 5, 'hi': None, 'new': 1, 'lock': False, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': None, 'linked-lower': 5, 'link-enabled': False, 'reversal-warning': False})], 3: [({'lo': None, 'hi': None, 'new': 1, 'lock': False, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': None, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': 1, 'lock': True, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 6, 'linked-lower': -4, 'link-enabled': True, 'reversal-warning': False}), ({'lo': None, 'hi': 2, 'new': 7, 'lock': False, 'linked': True}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': 2, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': None, 'hi': 5, 'new': 1, 'lock': True, 'linked': False}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 5, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': None, 'new': -1, 'lock': True, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': 0, 'linked-upper': None, 'linked-lower': 0, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': -1, 'lock': False, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': 2, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': 7, 'lock': False, 'linked': True}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': 9, 'linked-lower': 5, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': 1, 'lock': True, 'linked': False}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 5, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 5, 'hi': None, 'new': -1, 'lock': True, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': 5, 'linked-upper': None, 'linked-lower': 5, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 5, 'hi': 2, 'new': -1, 'lock': False, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': 2, 'linked-lower': 5, 'link-enabled': True, 'reversal-warning': True})], 4: [({'lo': None, 'hi': None, 'new': 1, 'lock': True, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': None, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 5, 'hi': 2, 'new': -1, 'lock': False, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': -4, 'linked-lower': 2, 'link-enabled': True, 'reversal-warning': True}), ({'lo': None, 'hi': 5, 'new': 1, 'lock': False, 'linked': False}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 5, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': None, 'new': -1, 'lock': False, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': None, 'linked-lower': 0, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': None, 'new': 7, 'lock': True, 'linked': False}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': None, 'linked-lower': 0, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': 1, 'lock': True, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 3, 'linked-lower': -1, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': 1, 'lock': False, 'linked': False}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 5, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 5, 'hi': None, 'new': -1, 'lock': False, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': None, 'linked-lower': 5, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 5, 'hi': None, 'new': 7, 'lock': True, 'linked': False}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': None, 'linked-lower': 5, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 5, 'hi': 2, 'new': 1, 'lock': True, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 5, 'linked-upper': -2, 'linked-lower': 4, 'link-enabled': True, 'reversal-warning': True})], 5: [({'lo': None, 'hi': None, 'new': 7, 'lock': False, 'linked': True}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': None, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 5, 'hi': 2, 'new': 1, 'lock': True, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 5, 'linked-upper': -2, 'linked-lower': 4, 'link-enabled': True, 'reversal-warning': True}), ({'lo': None, 'hi': 5, 'new': 7, 'lock': True, 'linked': True}, {'lower-clamp': 5, 'upper-clamp': 7, 'linked-upper': 5, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': None, 'new': 7, 'lock': False, 'linked': False}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': None, 'linked-lower': 0, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': 1, 'lock': False, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 3, 'linked-lower': -1, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': -1, 'lock': True, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': 0, 'linked-upper': 5, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': 7, 'lock': True, 'linked': True}, {'lower-clamp': 5, 'upper-clamp': 7, 'linked-upper': 12, 'linked-lower': 2, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 5, 'hi': None, 'new': 7, 'lock': False, 'linked': False}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': None, 'linked-lower': 5, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 5, 'hi': 2, 'new': 1, 'lock': False, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': -2, 'linked-lower': 4, 'link-enabled': True, 'reversal-warning': True}), ({'lo': 5, 'hi': 5, 'new': -1, 'lock': True, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': 5, 'linked-upper': 5, 'linked-lower': 5, 'link-enabled': True, 'reversal-warning': False})]}
for index, (data, expected) in enumerate(fixtures[N]):
    check("contract fixture " + str(index), solve(data), 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)

meaning: Fixture-count band, not measured model difficulty

deps: stdlib

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(d):
    return {'lower-clamp':(min(d['new'],d['hi']) if d['lock'] and d['hi'] is not None else d['new']), 'upper-clamp':(max(d['new'],d['lo']) if d['lock'] and d['lo'] is not None else d['new']), 'linked-upper':(d['hi']), 'linked-lower':(d['lo']+d['new']-d['hi'] if d['linked'] and d['hi'] is not None and d['lo'] is not None else d['lo']), 'link-enabled':(d['lo'] is not None and d['hi'] is not None), 'reversal-warning':(d['lo'] is not None and d['hi'] is not None and d['lo']>d['hi'])}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'lo': None, 'hi': None, 'new': -1, 'lock': False, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': None, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': 1, 'lock': True, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 3, 'linked-lower': -1, 'link-enabled': True, 'reversal-warning': False}), ({'lo': None, 'hi': None, 'new': 1, 'lock': True, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': None, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': None, 'hi': 2, 'new': 1, 'lock': False, 'linked': False}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 2, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': None, 'hi': 5, 'new': -1, 'lock': False, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': 5, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': None, 'hi': 5, 'new': 7, 'lock': True, 'linked': False}, {'lower-clamp': 5, 'upper-clamp': 7, 'linked-upper': 5, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': None, 'new': 1, 'lock': True, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': None, 'linked-lower': 0, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': 1, 'lock': False, 'linked': False}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 2, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': -1, 'lock': False, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': 4, 'linked-lower': -6, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': 7, 'lock': True, 'linked': False}, {'lower-clamp': 5, 'upper-clamp': 7, 'linked-upper': 5, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False})], 2: [({'lo': None, 'hi': None, 'new': -1, 'lock': True, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': None, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': -1, 'lock': False, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': 4, 'linked-lower': -6, 'link-enabled': True, 'reversal-warning': False}), ({'lo': None, 'hi': 2, 'new': -1, 'lock': True, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': 2, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': None, 'hi': 2, 'new': 7, 'lock': True, 'linked': True}, {'lower-clamp': 2, 'upper-clamp': 7, 'linked-upper': 2, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': None, 'hi': 5, 'new': 7, 'lock': False, 'linked': False}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': 5, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': None, 'new': 1, 'lock': False, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': None, 'linked-lower': 0, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': -1, 'lock': True, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': 0, 'linked-upper': 2, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': 7, 'lock': True, 'linked': True}, {'lower-clamp': 2, 'upper-clamp': 7, 'linked-upper': 9, 'linked-lower': 5, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': 7, 'lock': False, 'linked': False}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': 5, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 5, 'hi': None, 'new': 1, 'lock': False, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': None, 'linked-lower': 5, 'link-enabled': False, 'reversal-warning': False})], 3: [({'lo': None, 'hi': None, 'new': 1, 'lock': False, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': None, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': 1, 'lock': True, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 6, 'linked-lower': -4, 'link-enabled': True, 'reversal-warning': False}), ({'lo': None, 'hi': 2, 'new': 7, 'lock': False, 'linked': True}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': 2, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': None, 'hi': 5, 'new': 1, 'lock': True, 'linked': False}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 5, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': None, 'new': -1, 'lock': True, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': 0, 'linked-upper': None, 'linked-lower': 0, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': -1, 'lock': False, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': 2, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': 7, 'lock': False, 'linked': True}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': 9, 'linked-lower': 5, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': 1, 'lock': True, 'linked': False}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 5, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 5, 'hi': None, 'new': -1, 'lock': True, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': 5, 'linked-upper': None, 'linked-lower': 5, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 5, 'hi': 2, 'new': -1, 'lock': False, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': 2, 'linked-lower': 5, 'link-enabled': True, 'reversal-warning': True})], 4: [({'lo': None, 'hi': None, 'new': 1, 'lock': True, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': None, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 5, 'hi': 2, 'new': -1, 'lock': False, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': -4, 'linked-lower': 2, 'link-enabled': True, 'reversal-warning': True}), ({'lo': None, 'hi': 5, 'new': 1, 'lock': False, 'linked': False}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 5, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': None, 'new': -1, 'lock': False, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': None, 'linked-lower': 0, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': None, 'new': 7, 'lock': True, 'linked': False}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': None, 'linked-lower': 0, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': 1, 'lock': True, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 3, 'linked-lower': -1, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': 1, 'lock': False, 'linked': False}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 5, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 5, 'hi': None, 'new': -1, 'lock': False, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': None, 'linked-lower': 5, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 5, 'hi': None, 'new': 7, 'lock': True, 'linked': False}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': None, 'linked-lower': 5, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 5, 'hi': 2, 'new': 1, 'lock': True, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 5, 'linked-upper': -2, 'linked-lower': 4, 'link-enabled': True, 'reversal-warning': True})], 5: [({'lo': None, 'hi': None, 'new': 7, 'lock': False, 'linked': True}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': None, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 5, 'hi': 2, 'new': 1, 'lock': True, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 5, 'linked-upper': -2, 'linked-lower': 4, 'link-enabled': True, 'reversal-warning': True}), ({'lo': None, 'hi': 5, 'new': 7, 'lock': True, 'linked': True}, {'lower-clamp': 5, 'upper-clamp': 7, 'linked-upper': 5, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': None, 'new': 7, 'lock': False, 'linked': False}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': None, 'linked-lower': 0, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': 1, 'lock': False, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 3, 'linked-lower': -1, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': -1, 'lock': True, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': 0, 'linked-upper': 5, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': 7, 'lock': True, 'linked': True}, {'lower-clamp': 5, 'upper-clamp': 7, 'linked-upper': 12, 'linked-lower': 2, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 5, 'hi': None, 'new': 7, 'lock': False, 'linked': False}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': None, 'linked-lower': 5, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 5, 'hi': 2, 'new': 1, 'lock': False, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': -2, 'linked-lower': 4, 'link-enabled': True, 'reversal-warning': True}), ({'lo': 5, 'hi': 5, 'new': -1, 'lock': True, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': 5, 'linked-upper': 5, 'linked-lower': 5, 'link-enabled': True, 'reversal-warning': False})]}
for index, (data, expected) in enumerate(fixtures[N]):
    check("contract fixture " + str(index), solve(data), 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)

prompt:
Moving a linked lower bound translates the upper bound by the same delta is violated by the widget projection.

Editing one numeric endpoint clamps only when the range lock is enabled; linked-width edits translate the opposite endpoint, and unbounded sides remain unbounded. This example checks: Moving a linked lower bound translates the upper bound by the same delta.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(d):
    return {'lower-clamp':(min(d['new'],d['hi']) if d['lock'] and d['hi'] is not None else d['new']), 'upper-clamp':(max(d['new'],d['lo']) if d['lock'] and d['lo'] is not None else d['new']), 'linked-upper':(d['hi']+d['new']-d['lo'] if d['linked'] and d['hi'] is not None and d['lo'] is not None else d['hi']), 'linked-lower':(d['new'] if d['linked'] else d['lo']), 'link-enabled':(d['lo'] is not None and d['hi'] is not None), 'reversal-warning':(d['lo'] is not None and d['hi'] is not None and d['lo']>d['hi'])}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'lo': None, 'hi': None, 'new': -1, 'lock': False, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': None, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': 1, 'lock': True, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 3, 'linked-lower': -1, 'link-enabled': True, 'reversal-warning': False}), ({'lo': None, 'hi': None, 'new': 1, 'lock': True, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': None, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': None, 'hi': 2, 'new': 1, 'lock': False, 'linked': False}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 2, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': None, 'hi': 5, 'new': -1, 'lock': False, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': 5, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': None, 'hi': 5, 'new': 7, 'lock': True, 'linked': False}, {'lower-clamp': 5, 'upper-clamp': 7, 'linked-upper': 5, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': None, 'new': 1, 'lock': True, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': None, 'linked-lower': 0, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': 1, 'lock': False, 'linked': False}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 2, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': -1, 'lock': False, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': 4, 'linked-lower': -6, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': 7, 'lock': True, 'linked': False}, {'lower-clamp': 5, 'upper-clamp': 7, 'linked-upper': 5, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False})], 2: [({'lo': None, 'hi': None, 'new': -1, 'lock': True, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': None, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': -1, 'lock': False, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': 4, 'linked-lower': -6, 'link-enabled': True, 'reversal-warning': False}), ({'lo': None, 'hi': 2, 'new': -1, 'lock': True, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': 2, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': None, 'hi': 2, 'new': 7, 'lock': True, 'linked': True}, {'lower-clamp': 2, 'upper-clamp': 7, 'linked-upper': 2, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': None, 'hi': 5, 'new': 7, 'lock': False, 'linked': False}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': 5, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': None, 'new': 1, 'lock': False, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': None, 'linked-lower': 0, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': -1, 'lock': True, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': 0, 'linked-upper': 2, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': 7, 'lock': True, 'linked': True}, {'lower-clamp': 2, 'upper-clamp': 7, 'linked-upper': 9, 'linked-lower': 5, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': 7, 'lock': False, 'linked': False}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': 5, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 5, 'hi': None, 'new': 1, 'lock': False, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': None, 'linked-lower': 5, 'link-enabled': False, 'reversal-warning': False})], 3: [({'lo': None, 'hi': None, 'new': 1, 'lock': False, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': None, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': 1, 'lock': True, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 6, 'linked-lower': -4, 'link-enabled': True, 'reversal-warning': False}), ({'lo': None, 'hi': 2, 'new': 7, 'lock': False, 'linked': True}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': 2, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': None, 'hi': 5, 'new': 1, 'lock': True, 'linked': False}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 5, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': None, 'new': -1, 'lock': True, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': 0, 'linked-upper': None, 'linked-lower': 0, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': -1, 'lock': False, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': 2, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': 7, 'lock': False, 'linked': True}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': 9, 'linked-lower': 5, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': 1, 'lock': True, 'linked': False}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 5, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 5, 'hi': None, 'new': -1, 'lock': True, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': 5, 'linked-upper': None, 'linked-lower': 5, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 5, 'hi': 2, 'new': -1, 'lock': False, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': 2, 'linked-lower': 5, 'link-enabled': True, 'reversal-warning': True})], 4: [({'lo': None, 'hi': None, 'new': 1, 'lock': True, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': None, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 5, 'hi': 2, 'new': -1, 'lock': False, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': -4, 'linked-lower': 2, 'link-enabled': True, 'reversal-warning': True}), ({'lo': None, 'hi': 5, 'new': 1, 'lock': False, 'linked': False}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 5, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': None, 'new': -1, 'lock': False, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': None, 'linked-lower': 0, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': None, 'new': 7, 'lock': True, 'linked': False}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': None, 'linked-lower': 0, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': 1, 'lock': True, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 3, 'linked-lower': -1, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': 1, 'lock': False, 'linked': False}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 5, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 5, 'hi': None, 'new': -1, 'lock': False, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': None, 'linked-lower': 5, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 5, 'hi': None, 'new': 7, 'lock': True, 'linked': False}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': None, 'linked-lower': 5, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 5, 'hi': 2, 'new': 1, 'lock': True, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 5, 'linked-upper': -2, 'linked-lower': 4, 'link-enabled': True, 'reversal-warning': True})], 5: [({'lo': None, 'hi': None, 'new': 7, 'lock': False, 'linked': True}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': None, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 5, 'hi': 2, 'new': 1, 'lock': True, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 5, 'linked-upper': -2, 'linked-lower': 4, 'link-enabled': True, 'reversal-warning': True}), ({'lo': None, 'hi': 5, 'new': 7, 'lock': True, 'linked': True}, {'lower-clamp': 5, 'upper-clamp': 7, 'linked-upper': 5, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': None, 'new': 7, 'lock': False, 'linked': False}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': None, 'linked-lower': 0, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': 1, 'lock': False, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 3, 'linked-lower': -1, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': -1, 'lock': True, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': 0, 'linked-upper': 5, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': 7, 'lock': True, 'linked': True}, {'lower-clamp': 5, 'upper-clamp': 7, 'linked-upper': 12, 'linked-lower': 2, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 5, 'hi': None, 'new': 7, 'lock': False, 'linked': False}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': None, 'linked-lower': 5, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 5, 'hi': 2, 'new': 1, 'lock': False, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': -2, 'linked-lower': 4, 'link-enabled': True, 'reversal-warning': True}), ({'lo': 5, 'hi': 5, 'new': -1, 'lock': True, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': 5, 'linked-upper': 5, 'linked-lower': 5, 'link-enabled': True, 'reversal-warning': False})]}
for index, (data, expected) in enumerate(fixtures[N]):
    check("contract fixture " + str(index), solve(data), 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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(d):
    return {'lower-clamp':(min(d['new'],d['hi']) if d['lock'] and d['hi'] is not None else d['new']), 'upper-clamp':(max(d['new'],d['lo']) if d['lock'] and d['lo'] is not None else d['new']), 'linked-upper':(d['hi']+d['new']-d['lo'] if d['linked'] and d['hi'] is not None and d['lo'] is not None else d['hi']), 'linked-lower':(d['lo']), 'link-enabled':(d['lo'] is not None and d['hi'] is not None), 'reversal-warning':(d['lo'] is not None and d['hi'] is not None and d['lo']>d['hi'])}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'lo': None, 'hi': None, 'new': -1, 'lock': False, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': None, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': 1, 'lock': True, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 3, 'linked-lower': -1, 'link-enabled': True, 'reversal-warning': False}), ({'lo': None, 'hi': None, 'new': 1, 'lock': True, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': None, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': None, 'hi': 2, 'new': 1, 'lock': False, 'linked': False}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 2, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': None, 'hi': 5, 'new': -1, 'lock': False, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': 5, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': None, 'hi': 5, 'new': 7, 'lock': True, 'linked': False}, {'lower-clamp': 5, 'upper-clamp': 7, 'linked-upper': 5, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': None, 'new': 1, 'lock': True, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': None, 'linked-lower': 0, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': 1, 'lock': False, 'linked': False}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 2, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': -1, 'lock': False, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': 4, 'linked-lower': -6, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': 7, 'lock': True, 'linked': False}, {'lower-clamp': 5, 'upper-clamp': 7, 'linked-upper': 5, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False})], 2: [({'lo': None, 'hi': None, 'new': -1, 'lock': True, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': None, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': -1, 'lock': False, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': 4, 'linked-lower': -6, 'link-enabled': True, 'reversal-warning': False}), ({'lo': None, 'hi': 2, 'new': -1, 'lock': True, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': 2, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': None, 'hi': 2, 'new': 7, 'lock': True, 'linked': True}, {'lower-clamp': 2, 'upper-clamp': 7, 'linked-upper': 2, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': None, 'hi': 5, 'new': 7, 'lock': False, 'linked': False}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': 5, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': None, 'new': 1, 'lock': False, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': None, 'linked-lower': 0, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': -1, 'lock': True, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': 0, 'linked-upper': 2, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': 7, 'lock': True, 'linked': True}, {'lower-clamp': 2, 'upper-clamp': 7, 'linked-upper': 9, 'linked-lower': 5, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': 7, 'lock': False, 'linked': False}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': 5, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 5, 'hi': None, 'new': 1, 'lock': False, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': None, 'linked-lower': 5, 'link-enabled': False, 'reversal-warning': False})], 3: [({'lo': None, 'hi': None, 'new': 1, 'lock': False, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': None, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': 1, 'lock': True, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 6, 'linked-lower': -4, 'link-enabled': True, 'reversal-warning': False}), ({'lo': None, 'hi': 2, 'new': 7, 'lock': False, 'linked': True}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': 2, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': None, 'hi': 5, 'new': 1, 'lock': True, 'linked': False}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 5, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': None, 'new': -1, 'lock': True, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': 0, 'linked-upper': None, 'linked-lower': 0, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': -1, 'lock': False, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': 2, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': 7, 'lock': False, 'linked': True}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': 9, 'linked-lower': 5, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': 1, 'lock': True, 'linked': False}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 5, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 5, 'hi': None, 'new': -1, 'lock': True, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': 5, 'linked-upper': None, 'linked-lower': 5, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 5, 'hi': 2, 'new': -1, 'lock': False, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': 2, 'linked-lower': 5, 'link-enabled': True, 'reversal-warning': True})], 4: [({'lo': None, 'hi': None, 'new': 1, 'lock': True, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': None, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 5, 'hi': 2, 'new': -1, 'lock': False, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': -4, 'linked-lower': 2, 'link-enabled': True, 'reversal-warning': True}), ({'lo': None, 'hi': 5, 'new': 1, 'lock': False, 'linked': False}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 5, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': None, 'new': -1, 'lock': False, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': None, 'linked-lower': 0, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': None, 'new': 7, 'lock': True, 'linked': False}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': None, 'linked-lower': 0, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': 1, 'lock': True, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 3, 'linked-lower': -1, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': 1, 'lock': False, 'linked': False}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 5, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 5, 'hi': None, 'new': -1, 'lock': False, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': None, 'linked-lower': 5, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 5, 'hi': None, 'new': 7, 'lock': True, 'linked': False}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': None, 'linked-lower': 5, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 5, 'hi': 2, 'new': 1, 'lock': True, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 5, 'linked-upper': -2, 'linked-lower': 4, 'link-enabled': True, 'reversal-warning': True})], 5: [({'lo': None, 'hi': None, 'new': 7, 'lock': False, 'linked': True}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': None, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 5, 'hi': 2, 'new': 1, 'lock': True, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 5, 'linked-upper': -2, 'linked-lower': 4, 'link-enabled': True, 'reversal-warning': True}), ({'lo': None, 'hi': 5, 'new': 7, 'lock': True, 'linked': True}, {'lower-clamp': 5, 'upper-clamp': 7, 'linked-upper': 5, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': None, 'new': 7, 'lock': False, 'linked': False}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': None, 'linked-lower': 0, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': 1, 'lock': False, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 3, 'linked-lower': -1, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': -1, 'lock': True, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': 0, 'linked-upper': 5, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': 7, 'lock': True, 'linked': True}, {'lower-clamp': 5, 'upper-clamp': 7, 'linked-upper': 12, 'linked-lower': 2, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 5, 'hi': None, 'new': 7, 'lock': False, 'linked': False}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': None, 'linked-lower': 5, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 5, 'hi': 2, 'new': 1, 'lock': False, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': -2, 'linked-lower': 4, 'link-enabled': True, 'reversal-warning': True}), ({'lo': 5, 'hi': 5, 'new': -1, 'lock': True, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': 5, 'linked-upper': 5, 'linked-lower': 5, 'link-enabled': True, 'reversal-warning': False})]}
for index, (data, expected) in enumerate(fixtures[N]):
    check("contract fixture " + str(index), solve(data), 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)

prompt:
Moving a linked upper bound translates the lower bound by the same delta is violated by the widget projection.

Editing one numeric endpoint clamps only when the range lock is enabled; linked-width edits translate the opposite endpoint, and unbounded sides remain unbounded. This example checks: Moving a linked upper bound translates the lower bound by the same delta.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(d):
    return {'lower-clamp':(min(d['new'],d['hi']) if d['lock'] and d['hi'] is not None else d['new']), 'upper-clamp':(max(d['new'],d['lo']) if d['lock'] and d['lo'] is not None else d['new']), 'linked-upper':(d['hi']+d['new']-d['lo'] if d['linked'] and d['hi'] is not None and d['lo'] is not None else d['hi']), 'linked-lower':(d['lo']+d['new']-d['hi'] if d['linked'] and d['hi'] is not None and d['lo'] is not None else d['lo']), 'link-enabled':(bool(d['lo']) and bool(d['hi'])), 'reversal-warning':(d['lo'] is not None and d['hi'] is not None and d['lo']>d['hi'])}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'lo': 0, 'hi': 2, 'new': -1, 'lock': False, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': 2, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': None, 'hi': 2, 'new': -1, 'lock': True, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': 2, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': None, 'hi': None, 'new': 1, 'lock': True, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': None, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': None, 'hi': 2, 'new': 1, 'lock': False, 'linked': False}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 2, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': None, 'hi': 5, 'new': -1, 'lock': False, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': 5, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': None, 'hi': 5, 'new': 7, 'lock': True, 'linked': False}, {'lower-clamp': 5, 'upper-clamp': 7, 'linked-upper': 5, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': None, 'new': 1, 'lock': True, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': None, 'linked-lower': 0, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': 1, 'lock': False, 'linked': False}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 2, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': -1, 'lock': False, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': 4, 'linked-lower': -6, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': 7, 'lock': True, 'linked': False}, {'lower-clamp': 5, 'upper-clamp': 7, 'linked-upper': 5, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False})], 2: [({'lo': 0, 'hi': 2, 'new': -1, 'lock': False, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': 1, 'linked-lower': -3, 'link-enabled': True, 'reversal-warning': False}), ({'lo': None, 'hi': 2, 'new': 1, 'lock': True, 'linked': False}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 2, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': None, 'hi': 2, 'new': -1, 'lock': True, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': 2, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': None, 'hi': 2, 'new': 7, 'lock': True, 'linked': True}, {'lower-clamp': 2, 'upper-clamp': 7, 'linked-upper': 2, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': None, 'hi': 5, 'new': 7, 'lock': False, 'linked': False}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': 5, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': None, 'new': 1, 'lock': False, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': None, 'linked-lower': 0, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': -1, 'lock': True, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': 0, 'linked-upper': 2, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': 7, 'lock': True, 'linked': True}, {'lower-clamp': 2, 'upper-clamp': 7, 'linked-upper': 9, 'linked-lower': 5, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': 7, 'lock': False, 'linked': False}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': 5, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 5, 'hi': None, 'new': 1, 'lock': False, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': None, 'linked-lower': 5, 'link-enabled': False, 'reversal-warning': False})], 3: [({'lo': 0, 'hi': 2, 'new': -1, 'lock': True, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': 0, 'linked-upper': 2, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': None, 'hi': 2, 'new': 7, 'lock': False, 'linked': True}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': 2, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': None, 'hi': 5, 'new': 1, 'lock': True, 'linked': False}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 5, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': None, 'new': -1, 'lock': True, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': 0, 'linked-upper': None, 'linked-lower': 0, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': -1, 'lock': False, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': 2, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': 7, 'lock': False, 'linked': True}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': 9, 'linked-lower': 5, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': 1, 'lock': True, 'linked': False}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 5, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 5, 'hi': None, 'new': -1, 'lock': True, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': 5, 'linked-upper': None, 'linked-lower': 5, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 5, 'hi': 2, 'new': -1, 'lock': False, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': 2, 'linked-lower': 5, 'link-enabled': True, 'reversal-warning': True}), ({'lo': 5, 'hi': 2, 'new': 7, 'lock': False, 'linked': True}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': 4, 'linked-lower': 10, 'link-enabled': True, 'reversal-warning': True})], 4: [({'lo': 0, 'hi': 2, 'new': -1, 'lock': True, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': 0, 'linked-upper': 1, 'linked-lower': -3, 'link-enabled': True, 'reversal-warning': False}), ({'lo': None, 'hi': 5, 'new': -1, 'lock': False, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': 5, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': None, 'hi': 5, 'new': 1, 'lock': False, 'linked': False}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 5, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': None, 'new': -1, 'lock': False, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': None, 'linked-lower': 0, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': None, 'new': 7, 'lock': True, 'linked': False}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': None, 'linked-lower': 0, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': 1, 'lock': True, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 3, 'linked-lower': -1, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': 1, 'lock': False, 'linked': False}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 5, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 5, 'hi': None, 'new': -1, 'lock': False, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': None, 'linked-lower': 5, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 5, 'hi': None, 'new': 7, 'lock': True, 'linked': False}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': None, 'linked-lower': 5, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 5, 'hi': 2, 'new': 1, 'lock': True, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 5, 'linked-upper': -2, 'linked-lower': 4, 'link-enabled': True, 'reversal-warning': True})], 5: [({'lo': 0, 'hi': 2, 'new': 1, 'lock': False, 'linked': False}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 2, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': None, 'hi': 5, 'new': -1, 'lock': True, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': 5, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': None, 'hi': 5, 'new': 7, 'lock': True, 'linked': True}, {'lower-clamp': 5, 'upper-clamp': 7, 'linked-upper': 5, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': None, 'new': 7, 'lock': False, 'linked': False}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': None, 'linked-lower': 0, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': 1, 'lock': False, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 3, 'linked-lower': -1, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': -1, 'lock': True, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': 0, 'linked-upper': 5, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': 7, 'lock': True, 'linked': True}, {'lower-clamp': 5, 'upper-clamp': 7, 'linked-upper': 12, 'linked-lower': 2, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 5, 'hi': None, 'new': 7, 'lock': False, 'linked': False}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': None, 'linked-lower': 5, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 5, 'hi': 2, 'new': 1, 'lock': False, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': -2, 'linked-lower': 4, 'link-enabled': True, 'reversal-warning': True}), ({'lo': 5, 'hi': 5, 'new': -1, 'lock': True, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': 5, 'linked-upper': 5, 'linked-lower': 5, 'link-enabled': True, 'reversal-warning': False})]}
for index, (data, expected) in enumerate(fixtures[N]):
    check("contract fixture " + str(index), solve(data), 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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(d):
    return {'lower-clamp':(min(d['new'],d['hi']) if d['lock'] and d['hi'] is not None else d['new']), 'upper-clamp':(max(d['new'],d['lo']) if d['lock'] and d['lo'] is not None else d['new']), 'linked-upper':(d['hi']+d['new']-d['lo'] if d['linked'] and d['hi'] is not None and d['lo'] is not None else d['hi']), 'linked-lower':(d['lo']+d['new']-d['hi'] if d['linked'] and d['hi'] is not None and d['lo'] is not None else d['lo']), 'link-enabled':(d['lo'] is not None or d['hi'] is not None), 'reversal-warning':(d['lo'] is not None and d['hi'] is not None and d['lo']>d['hi'])}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'lo': 0, 'hi': 2, 'new': -1, 'lock': False, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': 2, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': None, 'hi': 2, 'new': -1, 'lock': True, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': 2, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': None, 'hi': None, 'new': 1, 'lock': True, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': None, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': None, 'hi': 2, 'new': 1, 'lock': False, 'linked': False}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 2, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': None, 'hi': 5, 'new': -1, 'lock': False, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': 5, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': None, 'hi': 5, 'new': 7, 'lock': True, 'linked': False}, {'lower-clamp': 5, 'upper-clamp': 7, 'linked-upper': 5, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': None, 'new': 1, 'lock': True, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': None, 'linked-lower': 0, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': 1, 'lock': False, 'linked': False}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 2, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': -1, 'lock': False, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': 4, 'linked-lower': -6, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': 7, 'lock': True, 'linked': False}, {'lower-clamp': 5, 'upper-clamp': 7, 'linked-upper': 5, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False})], 2: [({'lo': 0, 'hi': 2, 'new': -1, 'lock': False, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': 1, 'linked-lower': -3, 'link-enabled': True, 'reversal-warning': False}), ({'lo': None, 'hi': 2, 'new': 1, 'lock': True, 'linked': False}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 2, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': None, 'hi': 2, 'new': -1, 'lock': True, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': 2, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': None, 'hi': 2, 'new': 7, 'lock': True, 'linked': True}, {'lower-clamp': 2, 'upper-clamp': 7, 'linked-upper': 2, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': None, 'hi': 5, 'new': 7, 'lock': False, 'linked': False}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': 5, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': None, 'new': 1, 'lock': False, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': None, 'linked-lower': 0, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': -1, 'lock': True, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': 0, 'linked-upper': 2, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': 7, 'lock': True, 'linked': True}, {'lower-clamp': 2, 'upper-clamp': 7, 'linked-upper': 9, 'linked-lower': 5, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': 7, 'lock': False, 'linked': False}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': 5, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 5, 'hi': None, 'new': 1, 'lock': False, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': None, 'linked-lower': 5, 'link-enabled': False, 'reversal-warning': False})], 3: [({'lo': 0, 'hi': 2, 'new': -1, 'lock': True, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': 0, 'linked-upper': 2, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': None, 'hi': 2, 'new': 7, 'lock': False, 'linked': True}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': 2, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': None, 'hi': 5, 'new': 1, 'lock': True, 'linked': False}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 5, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': None, 'new': -1, 'lock': True, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': 0, 'linked-upper': None, 'linked-lower': 0, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': -1, 'lock': False, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': 2, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': 7, 'lock': False, 'linked': True}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': 9, 'linked-lower': 5, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': 1, 'lock': True, 'linked': False}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 5, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 5, 'hi': None, 'new': -1, 'lock': True, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': 5, 'linked-upper': None, 'linked-lower': 5, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 5, 'hi': 2, 'new': -1, 'lock': False, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': 2, 'linked-lower': 5, 'link-enabled': True, 'reversal-warning': True}), ({'lo': 5, 'hi': 2, 'new': 7, 'lock': False, 'linked': True}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': 4, 'linked-lower': 10, 'link-enabled': True, 'reversal-warning': True})], 4: [({'lo': 0, 'hi': 2, 'new': -1, 'lock': True, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': 0, 'linked-upper': 1, 'linked-lower': -3, 'link-enabled': True, 'reversal-warning': False}), ({'lo': None, 'hi': 5, 'new': -1, 'lock': False, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': 5, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': None, 'hi': 5, 'new': 1, 'lock': False, 'linked': False}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 5, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': None, 'new': -1, 'lock': False, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': None, 'linked-lower': 0, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': None, 'new': 7, 'lock': True, 'linked': False}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': None, 'linked-lower': 0, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': 1, 'lock': True, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 3, 'linked-lower': -1, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': 1, 'lock': False, 'linked': False}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 5, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 5, 'hi': None, 'new': -1, 'lock': False, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': None, 'linked-lower': 5, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 5, 'hi': None, 'new': 7, 'lock': True, 'linked': False}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': None, 'linked-lower': 5, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 5, 'hi': 2, 'new': 1, 'lock': True, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 5, 'linked-upper': -2, 'linked-lower': 4, 'link-enabled': True, 'reversal-warning': True})], 5: [({'lo': 0, 'hi': 2, 'new': 1, 'lock': False, 'linked': False}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 2, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': None, 'hi': 5, 'new': -1, 'lock': True, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': 5, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': None, 'hi': 5, 'new': 7, 'lock': True, 'linked': True}, {'lower-clamp': 5, 'upper-clamp': 7, 'linked-upper': 5, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': None, 'new': 7, 'lock': False, 'linked': False}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': None, 'linked-lower': 0, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': 1, 'lock': False, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 3, 'linked-lower': -1, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': -1, 'lock': True, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': 0, 'linked-upper': 5, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': 7, 'lock': True, 'linked': True}, {'lower-clamp': 5, 'upper-clamp': 7, 'linked-upper': 12, 'linked-lower': 2, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 5, 'hi': None, 'new': 7, 'lock': False, 'linked': False}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': None, 'linked-lower': 5, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 5, 'hi': 2, 'new': 1, 'lock': False, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': -2, 'linked-lower': 4, 'link-enabled': True, 'reversal-warning': True}), ({'lo': 5, 'hi': 5, 'new': -1, 'lock': True, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': 5, 'linked-upper': 5, 'linked-lower': 5, 'link-enabled': True, 'reversal-warning': False})]}
for index, (data, expected) in enumerate(fixtures[N]):
    check("contract fixture " + str(index), solve(data), 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)

prompt:
Width linking requires two finite endpoints including zero is violated by the widget projection.

Editing one numeric endpoint clamps only when the range lock is enabled; linked-width edits translate the opposite endpoint, and unbounded sides remain unbounded. This example checks: Width linking requires two finite endpoints including zero.

split: open-access