← Validation Lab Bench 1 · Temperature monitor I2CUARTPython simulator
Clean run STR-TMP-002: ready

Stage 04 · STD

One test case, followed from the requirement to the CI run.

The STD entry and the pytest code carry the same ID. Every case below links to its requirement, its matrix dot, its code and its last result.

STD entry

P1 · automated

TC-TMP04-BND-01

Rising edge: LED off at 80.0 °C, on at 80.1 °C

Requirement
TMP-04 v1.1
Class
BND · boundary
Technique
Boundary values + state transition
Level
regression
Precondition
LED off, UART stream running
Test conditions
supply 5.0 V · start temperature 25 °C · settle window 2 messages
Points
rising: 79.9 · 80.0 · 80.1 °C
Steps
  1. Set the sensor to 79.9 °C
  2. Set 80.0 °C
  3. Set 80.1 °C
Expected
  1. TEMP 80, LED off
  2. TEMP 80, LED off
  3. TEMP 80, LED on within 1.5 s (Q9 assumed: the LED compares the raw value, Q16 assumed)
Pass criteria
All three steps, no ERR message during the run
Open questions
Q9, Q16

The same case in code

benches/bench1_temp/tests/test_tmp04.py
@tc("TC-TMP04-BND-01")
@pytest.mark.regression
@each("rising")
def test_tc_tmp04_bnd_01(dut: TempMonitor, case: Case) -> None:
    """Rising edge: the LED stays off at the threshold and turns on one step above it.

    Questions: Q9 assumed (the LED compares the raw value) and Q16 assumed
    (the LED follows within 1.5 s), stp.yaml.
    """
    point = case.input
    stream_running(dut)
    led_off(dut)
    on = point.value > dut.params.led_on_c  # TMP-04: on above the threshold, raw value (Q9)
    check_led_step(dut, point.value, on, wait=on)
    check_no_errors(dut)

@tc

The STD ID in the code, read by the plugin for the STR and the RTM.

@each

Points come from std.yaml, never typed twice. One result per point.

dut

The TempMonitor device model. The target, simulator or board, sits below it.

waits

A timeout from the spec, never a sleep.

STD · all 30 cases

Generated from std.yaml v1.0, the same file the tests read
IDTitleClassPrioLevelLast result
TC-TMP01-FUN-0125 °C reads 24 to 26FUNP1smokePASSED 1 / 1
TC-TMP01-BND-01Accuracy at the -20 °C edgeBNDP1regressionPASSED 3 / 3
TC-TMP01-BND-02Accuracy at the 85 °C edgeBNDP1regressionPASSED 3 / 3
TC-TMP01-PRF-01Linearity sweep, 5 pointsPRFP2regressionPASSED 5 / 5
TC-TMP01-STR-0112 h at 25 °C, error stays within ±1 °CSTRP2soakPASSED 1 / 1
TC-TMP02-FUN-0160 consecutive messages, none missingFUNP1smokePASSED 1 / 1
TC-TMP02-PRF-01Period 1000 ± 50 ms over 300 messagesPRFP1regressionPASSED 1 / 1
TC-TMP02-STR-01Period stable over 12 hSTRP3soakPASSED 1 / 1
TC-TMP03-FUN-01Format TEMP <integer> on all messagesFUNP1smokePASSED 61 / 61
TC-TMP03-BND-01Rounding at the half degree, never TEMP -0BNDP2regressionPASSED 6 / 6
TC-TMP03-CPL-01Negative values sent as TEMP -5CPLP2regressionPASSED 3 / 3
TC-TMP04-FUN-01LED on at 82 °C, off at 25 °CFUNP1smokePASSED 1 / 1
TC-TMP04-NEG-01No flicker under 79 ↔ 81 oscillationNEGP1regressionPASSED 1 / 1
TC-TMP04-BND-01Rising edge: LED off at 80.0 °C, on at 80.1 °CBNDP1regressionPASSED 3 / 3
TC-TMP04-BND-02Falling edge: LED on at 78.0 °C, off at 77.9 °CBNDP1regressionPASSED 3 / 3
TC-TMP05-BND-01Outside the band: no corrupt UART outputBNDP2regressionPASSED 6 / 6
TC-TMP05-CFG-01Smoke set at three supply levelsCFGP2regressionPASSED 3 / 3
TC-TMP05-FI-01Brownout: clean restart, first message within 2 sFIP2regressionPASSED 1 / 1
TC-TMP06-NEG-01120 °C → ERR RANGENEGP1regressionPASSED 1 / 1
TC-TMP06-BND-0185.1 °C → ERR RANGEBNDP1regressionPASSED 3 / 3
TC-TMP06-BND-02-20.1 °C → ERR RANGEBNDP1regressionPASSED 3 / 3
TC-TMP06-UPG-01Back in range: the first message is a reading within 1000 ± 50 msUPGP1regressionPASSED 1 / 1
TC-TMP06-OBS-01Range error names its cause on the UARTOBSP3regressionPASSED 1 / 1
TC-TMP07-NEG-01NACK on read: no stale value sentNEGP1regressionPASSED 1 / 1
TC-TMP07-PRF-01ERR SENSOR latency within 2 s over repeated NACK faultsPRFP1regressionPASSED 2 / 2
TC-TMP07-FI-01NACK → ERR SENSOR within 2 sFIP1regressionPASSED 1 / 1
TC-TMP07-FI-02Stuck SDA → ERR SENSOR, no hangFIP1regressionPASSED 1 / 1
TC-TMP07-FI-03Single failed read → ERR SENSOR on that messageFIP2regressionPASSED 1 / 1
TC-TMP07-UPG-01Sensor returns: readings resume within 2 sUPGP1regressionPASSED 1 / 1
TC-TMP07-OBS-01Sensor fault names its cause on the UARTOBSP3regressionPASSED 1 / 1

TC-TMP01-FUN-01

P1 · automated

25 °C reads 24 to 26

Requirement
TMP-01 v1.0
Class
FUN · functional
Technique
Equivalence class: one value inside the range
Level
smoke
Precondition
UART stream running
Test conditions
supply 5.0 V · start temperature 25 °C · settle window 2 messages · temperature 25 °C
Steps
  1. Set the sensor to 25 °C
Expected
  1. TEMP 24, TEMP 25 or TEMP 26 (±1 °C)
Pass criteria
The second message after the change is within ±1 °C of 25 °C

Matrix: TMP-01 × FUN · Last result: PASSED 1 / 1

Code: benches/bench1_temp/tests/test_tmp01.py::test_tc_tmp01_fun_01
@tc("TC-TMP01-FUN-01")
@pytest.mark.smoke
def test_tc_tmp01_fun_01(dut: TempMonitor, case: Case) -> None:
    """One value inside the range reads within the TMP-01 accuracy of the set value."""
    tmp01_fun_01(dut, case)

TC-TMP01-BND-01

P1 · automated

Accuracy at the -20 °C edge

Requirement
TMP-01 v1.0
Class
BND · boundary
Technique
Boundary values on the lower range edge
Level
regression
Precondition
UART stream running
Test conditions
supply 5.0 V · start temperature 25 °C · settle window 2 messages
Points
lower edge: -19.9 · -20.0 · -20.1 °C
Steps
  1. Set the sensor to -19.9 °C
  2. Set -20.0 °C
  3. Set -20.1 °C
Expected
  1. A reading within ±1 °C of the set value (TMP-01). Q9 assumed: -19.9 °C reads as TEMP -20.
  2. A reading within ±1 °C of the set value (TMP-01). Q9 assumed: -20.0 °C reads as TEMP -20. Q10 assumed: -20.0 °C is inside the range.
  3. ERR RANGE, no TEMP message (TMP-06, Q10 assumed: the range check compares the raw value)
Pass criteria
All three steps
Open questions
Q9, Q10

Matrix: TMP-01 × BND · Last result: PASSED 3 / 3

Code: benches/bench1_temp/tests/test_tmp01.py::test_tc_tmp01_bnd_01
@tc("TC-TMP01-BND-01")
@pytest.mark.regression
@each("lower edge")
def test_tc_tmp01_bnd_01(dut: TempMonitor, case: Case) -> None:
    """Accuracy at the lower range edge, one point per test.

    Questions: Q9 and Q10 assumed (stp.yaml).
    """
    check_range_point(dut, case, exact=False)

TC-TMP01-BND-02

P1 · automated

Accuracy at the 85 °C edge

Requirement
TMP-01 v1.0
Class
BND · boundary
Technique
Boundary values on the upper range edge
Level
regression
Precondition
UART stream running
Test conditions
supply 5.0 V · start temperature 25 °C · settle window 2 messages
Points
upper edge: 84.9 · 85.0 · 85.1 °C
Steps
  1. Set the sensor to 84.9 °C
  2. Set 85.0 °C
  3. Set 85.1 °C
Expected
  1. A reading within ±1 °C of the set value (TMP-01). Q9 assumed: 84.9 °C reads as TEMP 85.
  2. A reading within ±1 °C of the set value (TMP-01). Q9 assumed: 85.0 °C reads as TEMP 85. Q10 assumed: 85.0 °C is inside the range.
  3. ERR RANGE, no TEMP message (TMP-06, Q10 assumed: the range check compares the raw value)
Pass criteria
All three steps
Open questions
Q9, Q10

Matrix: TMP-01 × BND · Last result: PASSED 3 / 3

Code: benches/bench1_temp/tests/test_tmp01.py::test_tc_tmp01_bnd_02
@tc("TC-TMP01-BND-02")
@pytest.mark.regression
@each("upper edge")
def test_tc_tmp01_bnd_02(dut: TempMonitor, case: Case) -> None:
    """Accuracy at the upper range edge, one point per test.

    Questions: Q9 and Q10 assumed (stp.yaml).
    """
    check_range_point(dut, case, exact=False)

TC-TMP01-PRF-01

P2 · automated

Linearity sweep, 5 points

Requirement
TMP-01 v1.0
Class
PRF · performance
Technique
Sweep across the range against the set value
Level
regression
Precondition
UART stream running
Test conditions
supply 5.0 V · start temperature 25 °C · settle window 2 messages · sweep cold 0 °C · sweep room 25 °C · sweep warm 50 °C
Points
sweep edges: -20 · 85 °C
Steps
  1. For each point, edges and test conditions, set the sensor
Expected
  1. A reading within ±1 °C of each set value (TMP-01). The points read as TEMP -20, TEMP 0, TEMP 25, TEMP 50 and TEMP 85.
Pass criteria
All 5 points within ±1 °C
Open questions
Q10

Matrix: TMP-01 × PRF · Last result: PASSED 5 / 5

Code: benches/bench1_temp/tests/test_tmp01.py::test_tc_tmp01_prf_01
@tc("TC-TMP01-PRF-01")
@pytest.mark.regression
@each("sweep edges", "sweep cold", "sweep room", "sweep warm")
def test_tc_tmp01_prf_01(dut: TempMonitor, case: Case) -> None:
    """Linearity sweep: the range edges and the sweep test conditions, one point per test.

    Questions: Q10 assumed (stp.yaml).
    """
    point = case.input
    stream_running(dut)
    dut.set_temperature(float(point.value))
    check_accuracy(point.value, settle(dut)[-1], dut.params.accuracy_c)

TC-TMP01-STR-01

P2 · automated

12 h at 25 °C, error stays within ±1 °C

Requirement
TMP-01 v1.0
Class
STR · stress and soak
Technique
Soak at a constant temperature
Level
soak
Precondition
UART stream running, virtual clock
Test conditions
supply 5.0 V · start temperature 25 °C · settle window 2 messages · soak duration 12 h
Steps
  1. Hold the sensor at 25 °C for 12 h of device time, record every message
Expected
  1. Every reading is TEMP 24, TEMP 25 or TEMP 26 for 12 h
Pass criteria
No reading outside ±1 °C, no ERR message during the run

Matrix: TMP-01 × STR · Last result: PASSED 1 / 1

Code: benches/bench1_temp/tests/test_tmp01.py::test_tc_tmp01_str_01
@tc("TC-TMP01-STR-01")
@pytest.mark.soak
def test_tc_tmp01_str_01(dut: TempMonitor, case: Case) -> None:
    """Soak at the start temperature on the virtual clock: every reading within the accuracy."""
    stream_running(dut)
    celsius = start_temperature(dut, case)
    soak = case.condition("soak duration")
    dut.wait_ms(case.ms("soak duration"))
    received = dut.read_received()
    accuracy = dut.params.accuracy_c
    assert received, f"During the {soak.value} {soak.unit} soak the device sent nothing."
    errors = [m for m in received if m.kind in (MessageKind.ERR_RANGE, MessageKind.ERR_SENSOR)]
    assert not errors, (
        f"During the {soak.value} {soak.unit} soak at {celsius} °C the device sent {len(errors)} "
        f"ERR lines, first {describe(errors[:1])}. Expected no ERR message."
    )
    wrong = [
        m
        for m in received
        if m.kind is MessageKind.READING
        and m.value is not None
        and abs(m.value - celsius) > accuracy
    ]
    assert not wrong, (
        f"During the {soak.value} {soak.unit} soak at {celsius} °C, {len(wrong)} of "
        f"{len(received)} readings were outside ±{accuracy:g} °C, first {describe(wrong[:1])}. "
        f"Expected every reading within ±{accuracy:g} °C of {celsius} °C (TMP-01)."
    )

TC-TMP02-FUN-01

P1 · automated

60 consecutive messages, none missing

Requirement
TMP-02 v1.1
Class
FUN · functional
Technique
Count messages over a fixed window
Level
smoke
Precondition
UART stream running
Test conditions
supply 5.0 V · start temperature 25 °C · settle window 2 messages · window 60 messages
Points
period limits: 950 · 1050 ms
Steps
  1. Start the window at a message, count 60 messages
Expected
  1. 60 messages, each 950 to 1050 ms after the one before, so none is missing
Pass criteria
60 messages, no gap longer than 1050 ms

Matrix: TMP-02 × FUN · Last result: PASSED 1 / 1

Code: benches/bench1_temp/tests/test_tmp02.py::test_tc_tmp02_fun_01
@tc("TC-TMP02-FUN-01")
@pytest.mark.smoke
def test_tc_tmp02_fun_01(dut: TempMonitor, case: Case) -> None:
    """A window of consecutive messages, none missing."""
    tmp02_fun_01(dut, case)

TC-TMP02-PRF-01

P1 · automated

Period 1000 ± 50 ms over 300 messages

Requirement
TMP-02 v1.1
Class
PRF · performance
Technique
Timestamp consecutive messages
Level
regression
Precondition
UART stream running
Test conditions
supply 5.0 V · start temperature 25 °C · settle window 2 messages · window 300 messages
Points
period limits: 950 · 1050 ms
Steps
  1. Timestamp 300 consecutive messages
Expected
  1. Each of the 299 intervals is 950 to 1050 ms
Pass criteria
No interval outside 950 to 1050 ms

Matrix: TMP-02 × PRF · Last result: PASSED 1 / 1

Code: benches/bench1_temp/tests/test_tmp02.py::test_tc_tmp02_prf_01
@tc("TC-TMP02-PRF-01")
@pytest.mark.regression
def test_tc_tmp02_prf_01(dut: TempMonitor, case: Case) -> None:
    """Every interval of a long window within the period limits."""
    check_intervals(case, message_window(dut, case))

TC-TMP02-STR-01

P3 · automated

Period stable over 12 h

Requirement
TMP-02 v1.1
Class
STR · stress and soak
Technique
Soak with a histogram of periods
Level
soak
Precondition
UART stream running, virtual clock
Test conditions
supply 5.0 V · start temperature 25 °C · settle window 2 messages · soak duration 12 h
Points
period limits: 950 · 1050 ms
Steps
  1. Run 12 h of device time, timestamp every message, store the histogram
Expected
  1. Every interval is 950 to 1050 ms for 12 h (Q11 open: no long-term limit checked)
Pass criteria
No interval outside 950 to 1050 ms, histogram attached to the result
Open questions
Q11

Matrix: TMP-02 × STR · Last result: PASSED 1 / 1

Code: benches/bench1_temp/tests/test_tmp02.py::test_tc_tmp02_str_01
@tc("TC-TMP02-STR-01")
@pytest.mark.soak
def test_tc_tmp02_str_01(
    dut: TempMonitor, case: Case, record_property: Callable[[str, object], None]
) -> None:
    """Soak on the virtual clock: every interval within the period limits, histogram attached.

    Questions: Q11 assumed (stp.yaml), so no long-term limit is checked.
    """
    first = stream_running(dut)
    soak = case.condition("soak duration")
    dut.wait_ms(case.ms("soak duration"))
    messages = [first, *dut.read_received()]
    histogram = Counter(b.t_ms - a.t_ms for a, b in pairwise(messages))
    record_property("period_histogram_ms", {str(ms): histogram[ms] for ms in sorted(histogram)})
    check_intervals(case, messages)
    low, high = case.limits_ms("period limits")
    silent = dut.now_ms() - messages[-1].t_ms
    assert silent <= high, (
        f"The last message of the {soak.value} {soak.unit} soak was {messages[-1]}, "
        f"{silent} ms before its end. Expected a message every {low} to {high} ms (TMP-02)."
    )

TC-TMP03-FUN-01

P1 · automated

Format TEMP <integer> on all messages

Requirement
TMP-03 v1.1
Class
FUN · functional
Technique
A regex runs on every message of every test
Level
smoke
Precondition
Any case of the run, UART stream running
Test conditions
supply 5.0 V · start temperature 25 °C · settle window 2 messages
Inputs from
Every message of every case in the run
Steps
  1. Match every received line against the format
Expected
  1. Every line is TEMP <integer>, ERR RANGE or ERR SENSOR, ends with LF, has no decimal point and is never TEMP -0 (Q14 assumed)
Pass criteria
No line fails the match
Open questions
Q14

Matrix: TMP-03 × FUN · Last result: PASSED 61 / 61

Code: benches/bench1_temp/tests/test_tmp03.py::test_tc_tmp03_fun_01
@tc("TC-TMP03-FUN-01")
@pytest.mark.smoke
def test_tc_tmp03_fun_01(dut: TempMonitor, case: Case) -> None:
    """The format of every line: here on the stream of this case, and on every other case.

    The card's points are every message of every case in the run. The
    conftest runs the same check after every other bench test and records
    it as a result of this card, `<host nodeid>::TC-TMP03-FUN-01` (ADR-022).
    This test checks the stream from the reset through the settle window at
    the start temperature.

    Questions: Q14 assumed (stp.yaml): LF ending, never `TEMP -0`.
    """
    tmp03_fun_01(dut, case)

TC-TMP03-BND-01

P2 · automated

Rounding at the half degree, never TEMP -0

Requirement
TMP-03 v1.1
Class
BND · boundary
Technique
Boundary values on the rounding edges
Level
regression
Precondition
UART stream running
Test conditions
supply 5.0 V · start temperature 25 °C · settle window 2 messages
Points
half degree: 80.4 · 80.5 · 80.6 °C · half degree below zero: -0.6 · -0.5 · -0.4 °C
Steps
  1. Set the sensor to 80.4 °C, then 80.5 °C, then 80.6 °C
  2. Set the sensor to -0.6 °C, then -0.5 °C, then -0.4 °C
Expected
  1. TEMP 80, TEMP 81, TEMP 81 (Q9 assumed: half away from zero)
  2. TEMP -1, TEMP -1, TEMP 0, and no TEMP -0 (Q9 and Q14 assumed)
Pass criteria
All six messages match exactly, no TEMP -0 during the run
Open questions
Q9, Q14

Matrix: TMP-03 × BND · Last result: PASSED 6 / 6

Code: benches/bench1_temp/tests/test_tmp03.py::test_tc_tmp03_bnd_01
@tc("TC-TMP03-BND-01")
@pytest.mark.regression
@each("half degree", "half degree below zero")
def test_tc_tmp03_bnd_01(dut: TempMonitor, case: Case) -> None:
    """Rounding at the half degree, one point per test, never `TEMP -0`.

    Questions: Q9 and Q14 assumed (stp.yaml): half away from zero, -0.4 °C is `TEMP 0`.
    """
    point = case.input
    stream_running(dut)
    dut.set_temperature(float(point.value))
    last = settle(dut)[-1]
    want = reading_text(reading(point.value))
    assert last.kind is MessageKind.READING and last.text == want, (
        f"After setting {point} the second message was {last}. "
        f"Expected exactly `{want}` (Q9 assumed: rounded half away from zero)."
    )
    check_format(dut, "received in this case, so no `TEMP -0`,")

TC-TMP03-CPL-01

P2 · automated

Negative values sent as TEMP -5

Requirement
TMP-03 v1.1
Class
CPL · compliance
Technique
Clause check against the spec text
Level
regression
Precondition
UART stream running
Test conditions
supply 5.0 V · start temperature 25 °C · settle window 2 messages · negative example -5 °C · zero 0 °C
Points
lower edge: -20 °C
Steps
  1. Set the sensor to -20 °C
  2. Set -5 °C
  3. Set 0 °C
Expected
  1. TEMP -20 (Q10 assumed: -20 °C is inside the range)
  2. TEMP -5
  3. TEMP 0
Pass criteria
All three messages match exactly
Open questions
Q10

Matrix: TMP-03 × CPL · Last result: PASSED 3 / 3

Code: benches/bench1_temp/tests/test_tmp03.py::test_tc_tmp03_cpl_01
@tc("TC-TMP03-CPL-01")
@pytest.mark.regression
@each("lower edge", "negative example", "zero")
def test_tc_tmp03_cpl_01(dut: TempMonitor, case: Case) -> None:
    """Negative values on the line as the spec text writes them, one value per test.

    Questions: Q10 assumed (stp.yaml): the lower edge is inside the range.
    """
    point = case.input
    stream_running(dut)
    dut.set_temperature(float(point.value))
    last = settle(dut)[-1]
    want = reading_text(reading(point.value))
    assert last.text == want, (
        f"After setting {point} the second message was {last}. Expected exactly `{want}` (TMP-03)."
    )

TC-TMP04-FUN-01

P1 · automated

LED on at 82 °C, off at 25 °C

Requirement
TMP-04 v1.1
Class
FUN · functional
Technique
One value above the threshold inside the range, one far below
Level
smoke
Precondition
LED off, UART stream running
Test conditions
supply 5.0 V · start temperature 25 °C · settle window 2 messages · high temperature 82 °C
Steps
  1. Set the sensor to 82 °C
  2. Set 25 °C
Expected
  1. TEMP 82, LED on within 1.5 s (Q16 assumed)
  2. TEMP 25, LED off within 1.5 s (Q16 assumed)
Pass criteria
Both steps, no ERR message during the run
Open questions
Q16

Matrix: TMP-04 × FUN · Last result: PASSED 1 / 1

Code: benches/bench1_temp/tests/test_tmp04.py::test_tc_tmp04_fun_01
@tc("TC-TMP04-FUN-01")
@pytest.mark.smoke
def test_tc_tmp04_fun_01(dut: TempMonitor, case: Case) -> None:
    """LED on at a value above the threshold inside the range, off again far below.

    Questions: Q16 assumed (stp.yaml): the LED follows within 1.5 s.
    """
    tmp04_fun_01(dut, case)

TC-TMP04-NEG-01

P1 · automated

No flicker under 79 ↔ 81 oscillation

Requirement
TMP-04 v1.1
Class
NEG · negative
Technique
Error guessing: oscillate the input around the threshold
Level
regression
Precondition
LED off, UART stream running
Test conditions
supply 5.0 V · start temperature 25 °C · settle window 2 messages · oscillation low 79 °C · oscillation high 81 °C · toggle every 200 ms · window 60 messages
Steps
  1. Toggle the sensor between 79 °C and 81 °C every 200 ms for 60 messages
Expected
  1. LED off until the first TEMP 81, then on for the rest of the run (79 °C is not below 78 °C)
Pass criteria
The LED changes state at most once in 60 messages

Matrix: TMP-04 × NEG · Last result: PASSED 1 / 1

Code: benches/bench1_temp/tests/test_tmp04.py::test_tc_tmp04_neg_01
@tc("TC-TMP04-NEG-01")
@pytest.mark.regression
def test_tc_tmp04_neg_01(dut: TempMonitor, case: Case) -> None:
    """No flicker while the input oscillates around the threshold, inside the hysteresis.

    The LED is read at every time step of the simulator resolution, so no
    change can hide between two reads.
    """
    stream_running(dut)
    led_off(dut)
    low, high = case.value("oscillation low"), case.value("oscillation high")
    toggle_ms = case.ms("toggle every")
    size = int(case.value("window"))
    res = case.resolution("time")
    step_ms = to_ms(res.step, res.unit)
    start = dut.now_ms()
    # TMP-02: every message comes within max_interval_ms, so the window is
    # over by this time. A device that falls silent fails here, it can't hang.
    deadline = start + size * dut.max_interval_ms
    samples: list[tuple[int, bool]] = [(start, dut.led_on())]
    received: list[Message] = []
    go_high = False
    while len(received) < size and dut.now_ms() < deadline:
        dut.set_temperature(float(high if go_high else low))
        go_high = not go_high
        for _ in range(toggle_ms // step_ms):
            dut.wait_ms(step_ms)
            samples.append((dut.now_ms(), dut.led_on()))
        received += dut.read_received()
    assert len(received) >= size, (
        f"Only {len(received)} messages came in {dut.now_ms() - start} ms of oscillation. "
        f"Expected {size} messages, one every period (TMP-02)."
    )
    end = received[size - 1].t_ms
    seen = [(t, on) for t, on in samples if t <= end]
    changes = [t for (_, a), (t, b) in pairwise(seen) if a is not b]
    assert len(changes) <= 1, (
        f"The LED changed state {len(changes)} times in {size} messages, at "
        f"{', '.join(f'{t} ms' for t in changes[:5])}. Expected at most once: {low} °C is "
        f"not below {dut.params.led_off_c:g} °C (TMP-04)."
    )
    high_text = reading_text(reading(high))
    first_high = next((m.t_ms for m in received[:size] if m.text == high_text), None)
    wrong = [(t, on) for t, on in seen if (first_high is None or t < first_high) is on]
    assert not wrong, (
        f"The LED was {state(wrong[0][1])} at {wrong[0][0]} ms. Expected it off until the first "
        f"`{high_text}`"
        + (f" at {first_high} ms, then on for the rest of the run." if first_high else ".")
    )

TC-TMP04-BND-01

P1 · automated

Rising edge: LED off at 80.0 °C, on at 80.1 °C

Requirement
TMP-04 v1.1
Class
BND · boundary
Technique
Boundary values + state transition
Level
regression
Precondition
LED off, UART stream running
Test conditions
supply 5.0 V · start temperature 25 °C · settle window 2 messages
Points
rising: 79.9 · 80.0 · 80.1 °C
Steps
  1. Set the sensor to 79.9 °C
  2. Set 80.0 °C
  3. Set 80.1 °C
Expected
  1. TEMP 80, LED off
  2. TEMP 80, LED off
  3. TEMP 80, LED on within 1.5 s (Q9 assumed: the LED compares the raw value, Q16 assumed)
Pass criteria
All three steps, no ERR message during the run
Open questions
Q9, Q16

Matrix: TMP-04 × BND · Last result: PASSED 3 / 3

Code: benches/bench1_temp/tests/test_tmp04.py::test_tc_tmp04_bnd_01
@tc("TC-TMP04-BND-01")
@pytest.mark.regression
@each("rising")
def test_tc_tmp04_bnd_01(dut: TempMonitor, case: Case) -> None:
    """Rising edge: the LED stays off at the threshold and turns on one step above it.

    Questions: Q9 assumed (the LED compares the raw value) and Q16 assumed
    (the LED follows within 1.5 s), stp.yaml.
    """
    point = case.input
    stream_running(dut)
    led_off(dut)
    on = point.value > dut.params.led_on_c  # TMP-04: on above the threshold, raw value (Q9)
    check_led_step(dut, point.value, on, wait=on)
    check_no_errors(dut)

TC-TMP04-BND-02

P1 · automated

Falling edge: LED on at 78.0 °C, off at 77.9 °C

Requirement
TMP-04 v1.1
Class
BND · boundary
Technique
Boundary values + state transition
Level
regression
Precondition
LED on, UART stream running
Test conditions
supply 5.0 V · settle window 2 messages · start temperature 81 °C
Points
falling: 78.1 · 78.0 · 77.9 °C
Steps
  1. Set the sensor to 78.1 °C
  2. Set 78.0 °C
  3. Set 77.9 °C
Expected
  1. TEMP 78, LED on
  2. TEMP 78, LED on
  3. TEMP 78, LED off within 1.5 s (Q9 assumed: the LED compares the raw value, Q16 assumed)
Pass criteria
All three steps, no ERR message during the run
Open questions
Q9, Q16

Matrix: TMP-04 × BND · Last result: PASSED 3 / 3

Code: benches/bench1_temp/tests/test_tmp04.py::test_tc_tmp04_bnd_02
@tc("TC-TMP04-BND-02")
@pytest.mark.regression
@each("falling")
def test_tc_tmp04_bnd_02(dut: TempMonitor, case: Case) -> None:
    """Falling edge: the LED stays on at the off threshold and turns off one step below it.

    Questions: Q9 assumed (the LED compares the raw value) and Q16 assumed
    (the LED follows within 1.5 s), stp.yaml.
    """
    point = case.input
    stream_running(dut)
    with precondition("LED on"):
        start_temperature(dut, case)
        dut.wait_led(True)
    off = point.value < dut.params.led_off_c  # TMP-04: off below the threshold, raw value (Q9)
    check_led_step(dut, point.value, not off, wait=off)
    check_no_errors(dut)

TC-TMP05-BND-01

P2 · automated

Outside the band: no corrupt UART output

Requirement
TMP-05 v1.1
Class
BND · boundary
Technique
Boundary values on voltage
Level
regression
Precondition
UART stream running
Test conditions
supply 5.0 V · start temperature 25 °C · settle window 2 messages
Points
low edge: 4.8 · 4.75 · 4.7 V · high edge: 5.2 · 5.25 · 5.3 V
Steps
  1. Set the supply to 4.80 V, then 4.75 V
  2. Set the supply to 4.70 V
  3. Set the supply to 5.20 V, then 5.25 V
  4. Set the supply to 5.30 V
Expected
  1. TEMP 25 at 4.80 V and 4.75 V
  2. No wrong reading at 4.70 V: any TEMP message is within ±1 °C of the 25 °C start temperature (TMP-01), every line passes TC-TMP03-FUN-01 (Q15 assumed: silence or an ERR line accepted)
  3. TEMP 25 at 5.20 V and 5.25 V
  4. No wrong reading at 5.30 V: any TEMP message is within ±1 °C of the 25 °C start temperature (TMP-01), every line passes TC-TMP03-FUN-01 (Q15 assumed: silence or an ERR line accepted)
Pass criteria
All four steps
Open questions
Q15

Matrix: TMP-05 × BND · Last result: PASSED 6 / 6

Code: benches/bench1_temp/tests/test_tmp05.py::test_tc_tmp05_bnd_01
@tc("TC-TMP05-BND-01")
@pytest.mark.regression
@requires(POWER_CONTROL)
@each("low edge", "high edge")
def test_tc_tmp05_bnd_01(dut: TempMonitor, case: Case) -> None:
    """Supply at the band edges and one step outside, one point per test.

    Inside the band the reading is the start temperature. Outside it any
    line is allowed but a wrong reading or a corrupt line.

    Questions: Q15 assumed (stp.yaml): silence or an ERR line outside the band.
    """
    point = case.input
    stream_running(dut)
    dut.set_supply(float(point.value))
    p = dut.params
    if p.supply_min_v <= point.value <= p.supply_max_v:
        last = settle(dut)[-1]
        want = reading_text(int(case.value("start temperature")))
        assert last.text == want, (
            f"At {point} the second message was {last}. Expected exactly `{want}` (TMP-05)."
        )
        return
    # Q15 assumed: silence is allowed, so read for as long as the settle
    # window lasts at most (TMP-02), and judge every line that came.
    seen: list[Message] = []
    end = dut.now_ms() + p.conditions.settle_messages * dut.max_interval_ms
    while (left := end - dut.now_ms()) > 0 and (message := dut.read_message(left)) is not None:
        seen.append(message)
    wrong = wrong_readings(dut, case, seen)
    assert not wrong, (
        f"At {point} the device sent {describe(wrong)}. Expected no wrong reading: any `TEMP` "
        f"message within ±{p.accuracy_c:g} °C of {case.value('start temperature')} °C "
        f"(TMP-01, Q15)."
    )
    check_format(dut, f"received at {point}")

TC-TMP05-CFG-01

P2 · automated

Smoke set at three supply levels

Requirement
TMP-05 v1.1
Class
CFG · configuration
Technique
Run the smoke set at each supply level
Level
regression
Precondition
UART stream running
Test conditions
supply 5.0 V · start temperature 25 °C · settle window 2 messages
Points
supply band edges: 4.75 · 5.25 V
Steps
  1. For each band edge and the nominal supply, run every smoke-level case of this STD
Expected
  1. Every smoke case passes at 4.75 V, 5.00 V and 5.25 V
Pass criteria
All smoke cases pass at all three levels

Matrix: TMP-05 × CFG · Last result: PASSED 3 / 3

Code: benches/bench1_temp/tests/test_tmp05.py::test_tc_tmp05_cfg_01
@tc("TC-TMP05-CFG-01")
@pytest.mark.regression
@requires(POWER_CONTROL)
@each("supply band edges", "supply")
def test_tc_tmp05_cfg_01(dut: TempMonitor, case: Case) -> None:
    """The smoke set at one supply level per test: both band edges and the nominal supply.

    The smoke set is every card of level smoke in std.yaml. Each runs its
    registered steps from a reset at this supply level, then the format of
    its lines is checked (ADR-022).
    """
    level = case.input
    cards = [c for c in case.std.cases if c.level == "smoke" and c.automation == "automated"]
    failures: list[str] = []
    for card in cards:
        steps = SMOKE_STEPS.get(card.id)
        if steps is None:
            raise ConfigError(f"{card.id} is a smoke card with no @smoke_steps in steps.py")
        dut.reset()
        dut.set_supply(float(level.value))
        try:
            steps(dut, Case(case.std, card))
            check_format(dut, f"received in {card.id}")
        except AssertionError as exc:
            failures.append(f"{card.id}: {exc}")
    assert not failures, (
        f"At {level}, {len(failures)} of {len(cards)} smoke cases failed. Expected every "
        f"smoke case to pass. " + " | ".join(failures)
    )

TC-TMP05-FI-01

P2 · automated

Brownout: clean restart, first message within 2 s

Requirement
TMP-05 v1.1
Class
FI · fault injection and power loss
Technique
Fault injection: short supply dip
Level
regression
Precondition
UART stream running
Test conditions
supply 5.0 V · start temperature 25 °C · settle window 2 messages · dip level 4.2 V · dip length 50 ms
Steps
  1. Drop the supply to 4.2 V for 50 ms, then back to 5.00 V
Expected
  1. No corrupt line and no wrong reading, first TEMP 25 within 2 s after the supply returns (Q15 assumed)
Pass criteria
Every line passes TC-TMP03-FUN-01, readings resume within 2 s
Open questions
Q15

Matrix: TMP-05 × FI · Last result: PASSED 1 / 1

Code: benches/bench1_temp/tests/test_tmp05.py::test_tc_tmp05_fi_01
@tc("TC-TMP05-FI-01")
@pytest.mark.regression
@requires(POWER_CONTROL)
def test_tc_tmp05_fi_01(dut: TempMonitor, case: Case) -> None:
    """Brownout: a short dip, then a clean restart with the first reading in time.

    Questions: Q15 assumed (stp.yaml): first reading within 2 s after the supply returns.
    """
    stream_running(dut)
    dip = dut.now_ms()
    dut.set_supply(float(case.value("dip level")))
    dut.wait_ms(case.ms("dip length"))
    dut.set_supply(float(case.value("supply")))
    returned = dut.now_ms()
    limit = dut.timeouts.first_reading_ms
    first = dut.wait_message(
        MessageKind.READING,
        within_ms=limit,
        reason=f"Q15 assumed: first reading within {limit} ms after the supply returns",
    )
    want = reading_text(int(case.value("start temperature")))
    assert first.text == want, (
        f"The first reading after the supply returned at {returned} ms was {first}. "
        f"Expected exactly `{want}`."
    )
    wrong = wrong_readings(dut, case, [m for m in dut.messages if m.t_ms > dip])
    assert not wrong, (
        f"After the dip the device sent {describe(wrong)}. Expected no wrong reading (TMP-01)."
    )
    check_format(dut, "received around the dip")

TC-TMP06-NEG-01

P1 · automated

120 °C → ERR RANGE

Requirement
TMP-06 v1.1
Class
NEG · negative
Technique
Equivalence class outside the range
Level
regression
Precondition
UART stream running
Test conditions
supply 5.0 V · start temperature 25 °C · settle window 2 messages · out-of-range temperature 120 °C
Steps
  1. Set the sensor to 120 °C
Expected
  1. ERR RANGE within 2 messages, no TEMP message while at 120 °C (Q13 open: one ERR RANGE or one per message both accepted)
Pass criteria
At least one ERR RANGE, no TEMP 120 or any other TEMP message
Open questions
Q13

Matrix: TMP-06 × NEG · Last result: PASSED 1 / 1

Code: benches/bench1_temp/tests/test_tmp06.py::test_tc_tmp06_neg_01
@tc("TC-TMP06-NEG-01")
@pytest.mark.regression
def test_tc_tmp06_neg_01(dut: TempMonitor, case: Case) -> None:
    """Far outside the range: `ERR RANGE` and never a reading.

    Questions: Q13 open (stp.yaml): one `ERR RANGE` or one per message both pass.
    """
    stream_running(dut)
    where = out_of_range(dut, case)
    window = error_window(dut)
    assert of_kind(window, MessageKind.ERR_RANGE), (
        f"After setting {where} the device sent {describe(window)}. "
        f"Expected `ERR RANGE` within {dut.params.conditions.settle_messages} messages (TMP-06)."
    )
    readings = of_kind(window, MessageKind.READING)
    assert not readings, (
        f"At {where} the device sent {describe(readings)}. Expected no `TEMP` message (TMP-06)."
    )

TC-TMP06-BND-01

P1 · automated

85.1 °C → ERR RANGE

Requirement
TMP-06 v1.1
Class
BND · boundary
Technique
Boundary values on the upper range edge
Level
regression
Precondition
UART stream running
Test conditions
supply 5.0 V · start temperature 25 °C · settle window 2 messages
Points
upper edge: 84.9 · 85.0 · 85.1 °C
Steps
  1. Set the sensor to 84.9 °C
  2. Set 85.0 °C
  3. Set 85.1 °C
Expected
  1. TEMP 85 (Q9 assumed: 84.9 °C rounds to 85)
  2. TEMP 85 (Q10 assumed: 85.0 °C is inside the range)
  3. ERR RANGE, no TEMP message (Q10 assumed: the range check compares the raw value)
Pass criteria
All three steps
Open questions
Q9, Q10

Matrix: TMP-06 × BND · Last result: PASSED 3 / 3

Code: benches/bench1_temp/tests/test_tmp06.py::test_tc_tmp06_bnd_01
@tc("TC-TMP06-BND-01")
@pytest.mark.regression
@each("upper edge")
def test_tc_tmp06_bnd_01(dut: TempMonitor, case: Case) -> None:
    """Upper range edge, one point per test: readings up to the edge, `ERR RANGE` one step above.

    Questions: Q9 and Q10 assumed (stp.yaml).
    """
    check_range_point(dut, case, exact=True)

TC-TMP06-BND-02

P1 · automated

-20.1 °C → ERR RANGE

Requirement
TMP-06 v1.1
Class
BND · boundary
Technique
Boundary values on the lower range edge
Level
regression
Precondition
UART stream running
Test conditions
supply 5.0 V · start temperature 25 °C · settle window 2 messages
Points
lower edge: -19.9 · -20.0 · -20.1 °C
Steps
  1. Set the sensor to -19.9 °C
  2. Set -20.0 °C
  3. Set -20.1 °C
Expected
  1. TEMP -20 (Q9 assumed: -19.9 °C rounds to -20)
  2. TEMP -20 (Q10 assumed: -20.0 °C is inside the range)
  3. ERR RANGE, no TEMP message (Q10 assumed: the range check compares the raw value)
Pass criteria
All three steps
Open questions
Q9, Q10

Matrix: TMP-06 × BND · Last result: PASSED 3 / 3

Code: benches/bench1_temp/tests/test_tmp06.py::test_tc_tmp06_bnd_02
@tc("TC-TMP06-BND-02")
@pytest.mark.regression
@each("lower edge")
def test_tc_tmp06_bnd_02(dut: TempMonitor, case: Case) -> None:
    """Lower range edge, one point per test: readings down to the edge, `ERR RANGE` one step below.

    Questions: Q9 and Q10 assumed (stp.yaml).
    """
    check_range_point(dut, case, exact=True)

TC-TMP06-UPG-01

P1 · automated

Back in range: the first message is a reading within 1000 ± 50 ms

Requirement
TMP-06 v1.1
Class
UPG · upgrade and recovery
Technique
State transition ERR RANGE to reading
Level
regression
Precondition
UART stream running
Test conditions
supply 5.0 V · start temperature 25 °C · settle window 2 messages · out-of-range temperature 120 °C · return after the last error line 1 ms
Points
period limits: 950 · 1050 ms
Steps
  1. Set the sensor to 120 °C
  2. 1 ms after the next ERR RANGE, set 25 °C (the start temperature)
Expected
  1. ERR RANGE within 2 messages
  2. The next message is TEMP 25, 950 to 1050 ms after that ERR RANGE (TMP-02: 1000 ± 50 ms)
Pass criteria
The first message after the return is a reading on time, and no ERR RANGE follows it
Open questions
Q13

Matrix: TMP-06 × UPG · Last result: PASSED 1 / 1

Code: benches/bench1_temp/tests/test_tmp06.py::test_tc_tmp06_upg_01
@tc("TC-TMP06-UPG-01")
@pytest.mark.regression
def test_tc_tmp06_upg_01(dut: TempMonitor, case: Case) -> None:
    """Back in range: the first message after the return is a reading, on the TMP-02 period.

    Questions: Q13 open (stp.yaml): one `ERR RANGE` or one per message both pass.
    """
    stream_running(dut)
    changed = dut.now_ms()
    where = out_of_range(dut, case)
    count = dut.params.conditions.settle_messages
    err = dut.wait_message(
        MessageKind.ERR_RANGE,
        within_ms=count * dut.max_interval_ms,
        reason=f"TMP-06: `ERR RANGE` within the settle window, {count} messages of at most "
        f"{dut.max_interval_ms} ms each (TMP-02)",
    )
    before = since(dut, changed, err)
    assert len(before) <= count, (
        f"After setting {where} the device sent {describe(before)}. "
        f"Expected `ERR RANGE` within {count} messages (TMP-06)."
    )
    # The step: 1 ms after that `ERR RANGE`, back to the start temperature.
    dut.wait_ms(err.t_ms + case.ms("return after the last error line") - dut.now_ms())
    celsius = case.value("start temperature")
    dut.set_temperature(float(celsius))
    first = dut.next_message()
    low, high = case.limits_ms("period limits")
    want = reading_text(int(celsius))
    assert first.text == want and low <= first.t_ms - err.t_ms <= high, (
        f"After the return to {celsius} °C the first message was {first}, "
        f"{first.t_ms - err.t_ms} ms after {err}. Expected `{want}` {low} to {high} ms after "
        f"that `ERR RANGE` (TMP-02)."
    )
    after = dut.next_message()
    assert after.kind is not MessageKind.ERR_RANGE, (
        f"After {first} the device sent {after}. Expected no `ERR RANGE` once back in range."
    )

TC-TMP06-OBS-01

P3 · automated

Range error names its cause on the UART

Requirement
TMP-06 v1.1
Class
OBS · observability
Technique
Error line on the UART
Level
regression
Precondition
UART stream running
Test conditions
supply 5.0 V · start temperature 25 °C · settle window 2 messages · out-of-range temperature 120 °C
Steps
  1. Set the sensor to 120 °C
Expected
  1. ERR RANGE within 2 messages and no ERR SENSOR, so the line tells a range error from a sensor fault (Q17 assumed: no other diagnostics)
Pass criteria
The error line names the injected cause
Open questions
Q17

Matrix: TMP-06 × OBS · Last result: PASSED 1 / 1

Code: benches/bench1_temp/tests/test_tmp06.py::test_tc_tmp06_obs_01
@tc("TC-TMP06-OBS-01")
@pytest.mark.regression
def test_tc_tmp06_obs_01(dut: TempMonitor, case: Case) -> None:
    """A range error names its cause: `ERR RANGE`, not `ERR SENSOR`.

    Questions: Q17 assumed (stp.yaml): no diagnostics beyond the UART lines and the LED.
    """
    stream_running(dut)
    where = out_of_range(dut, case)
    window = error_window(dut)
    assert of_kind(window, MessageKind.ERR_RANGE) and not of_kind(window, MessageKind.ERR_SENSOR), (
        f"After setting {where} the device sent {describe(window)}. Expected `ERR RANGE` "
        f"within {dut.params.conditions.settle_messages} messages and no `ERR SENSOR`."
    )

TC-TMP07-NEG-01

P1 · automated

NACK on read: no stale value sent

Requirement
TMP-07 v1.1
Class
NEG · negative
Technique
Error guessing from field experience
Level
regression
Precondition
UART stream running
Test conditions
supply 5.0 V · start temperature 25 °C · settle window 2 messages · last good reading 25 °C
Steps
  1. Wait for TEMP 25, then make the sensor NACK every read
Expected
  1. No TEMP 25 (the last good value) and no other TEMP message after the first NACK
Pass criteria
No TEMP message while the sensor NACKs

Matrix: TMP-07 × NEG · Last result: PASSED 1 / 1

Code: benches/bench1_temp/tests/test_tmp07.py::test_tc_tmp07_neg_01
@tc("TC-TMP07-NEG-01")
@pytest.mark.regression
@requires(Fault.I2C_NACK)
def test_tc_tmp07_neg_01(dut: TempMonitor, case: Case) -> None:
    """A NACK on read leaves no stale value on the line."""
    good = last_good_reading(dut, case)
    dut.inject_fault(Fault.I2C_NACK)
    onset = dut.now_ms()
    window = error_window(dut)
    readings = of_kind(window, MessageKind.READING)
    assert not readings, (
        f"While the sensor NACKed every read from {onset} ms, the device sent "
        f"{describe(readings)}. Expected no `TEMP` message, not even {good.text!r}, the last "
        f"good value."
    )

TC-TMP07-PRF-01

P1 · automated

ERR SENSOR latency within 2 s over repeated NACK faults

Requirement
TMP-07 v1.1
Class
PRF · performance
Technique
Inject NACK faults at known moments, measure the time to ERR SENSOR
Level
regression
Precondition
UART stream running
Test conditions
supply 5.0 V · start temperature 25 °C · settle window 2 messages · early fault onset after a message 1 ms · late fault onset after a message 999 ms
Points
latency limit: 2 s
Steps
  1. For each onset, start NACK on every read, measure the time to the first ERR SENSOR, then release the fault and wait for TEMP 25
Expected
  1. ERR SENSOR at most 2 s after the onset, for both onsets
Pass criteria
Every latency at most 2 s

Matrix: TMP-07 × PRF · Last result: PASSED 2 / 2

Code: benches/bench1_temp/tests/test_tmp07.py::test_tc_tmp07_prf_01
@tc("TC-TMP07-PRF-01")
@pytest.mark.regression
@requires(Fault.I2C_NACK)
@each("early fault onset after a message", "late fault onset after a message")
def test_tc_tmp07_prf_01(dut: TempMonitor, case: Case) -> None:
    """`ERR SENSOR` latency for one fault onset per test, then recovery."""
    onset_after = case.input
    message = stream_running(dut)
    dut.wait_ms(message.t_ms + onset_after.ms() - dut.now_ms())
    dut.inject_fault(Fault.I2C_NACK)
    onset = dut.now_ms()
    err = err_sensor(dut)
    check_latency(
        case, "latency limit", onset, err, f"the NACK onset {onset_after} after {message}"
    )
    dut.clear_faults()
    readings_resume(dut, case)

TC-TMP07-FI-01

P1 · automated

NACK → ERR SENSOR within 2 s

Requirement
TMP-07 v1.1
Class
FI · fault injection and power loss
Technique
Simulator fault: NACK on every read
Level
regression
Precondition
UART stream running
Test conditions
supply 5.0 V · start temperature 25 °C · settle window 2 messages · last good reading 25 °C
Points
latency limit: 2 s
Steps
  1. Make the sensor NACK every read
Expected
  1. ERR SENSOR within 2 s (Q13 open: one ERR SENSOR or one per message both accepted)
Pass criteria
ERR SENSOR within 2 s, no TEMP message after it
Open questions
Q13, Q19

Matrix: TMP-07 × FI · Last result: PASSED 1 / 1

Code: benches/bench1_temp/tests/test_tmp07.py::test_tc_tmp07_fi_01
@tc("TC-TMP07-FI-01")
@pytest.mark.regression
@requires(Fault.I2C_NACK)
def test_tc_tmp07_fi_01(dut: TempMonitor, case: Case) -> None:
    """NACK on every read: `ERR SENSOR` in time, and no reading after it.

    Questions: Q13 open (one `ERR SENSOR` or one per message both pass) and
    Q19 assumed (the first failed read triggers it), stp.yaml.
    """
    last_good_reading(dut, case)
    dut.inject_fault(Fault.I2C_NACK)
    onset = dut.now_ms()
    err = err_sensor(dut)
    check_latency(case, "latency limit", onset, err, "the NACK onset")
    after = error_window(dut)
    readings = of_kind(after, MessageKind.READING)
    assert not readings, (
        f"After {err} the sensor still NACKed and the device sent {describe(readings)}. "
        f"Expected no `TEMP` message."
    )

TC-TMP07-FI-02

P1 · automated

Stuck SDA → ERR SENSOR, no hang

Requirement
TMP-07 v1.1
Class
FI · fault injection and power loss
Technique
Simulator fault: SDA held low
Level
regression
Precondition
UART stream running
Test conditions
supply 5.0 V · start temperature 25 °C · settle window 2 messages
Points
latency limit: 2 s
Steps
  1. Hold SDA low
  2. Release SDA
Expected
  1. ERR SENSOR within 2 s (Q13 open: one ERR SENSOR or one per message both accepted)
  2. TEMP 25 within 2 s of the release, so the firmware did not hang (Q8 assumed)
Pass criteria
Both steps
Open questions
Q8, Q13, Q19

Matrix: TMP-07 × FI · Last result: PASSED 1 / 1

Code: benches/bench1_temp/tests/test_tmp07.py::test_tc_tmp07_fi_02
@tc("TC-TMP07-FI-02")
@pytest.mark.regression
@requires(Fault.STUCK_SDA)
def test_tc_tmp07_fi_02(dut: TempMonitor, case: Case) -> None:
    """SDA held low: `ERR SENSOR` in time, and readings again after the release, so no hang.

    Questions: Q8 assumed (readings resume within 2 s), Q13 open and Q19
    assumed, stp.yaml.
    """
    stream_running(dut)
    dut.inject_fault(Fault.STUCK_SDA)
    onset = dut.now_ms()
    err = err_sensor(dut)
    check_latency(case, "latency limit", onset, err, "holding SDA low")
    dut.clear_faults()
    released = dut.now_ms()
    back = readings_resume(dut, case)
    check_latency(case, "latency limit", released, back, "the SDA release")

TC-TMP07-FI-03

P2 · automated

Single failed read → ERR SENSOR on that message

Requirement
TMP-07 v1.1
Class
FI · fault injection and power loss
Technique
Simulator fault: NACK on exactly one read
Level
regression
Precondition
UART stream running
Test conditions
supply 5.0 V · start temperature 25 °C · settle window 2 messages · failed reads 1 NACK
Steps
  1. Make the sensor NACK exactly one read, then answer again at 25 °C
Expected
  1. ERR SENSOR in place of the reading of the failed read, then TEMP 25 on the next message (Q19 assumed: the first failed read triggers it)
Pass criteria
Exactly one ERR SENSOR, on the message of the failed read, with readings before and after it
Open questions
Q13, Q19

Matrix: TMP-07 × FI · Last result: PASSED 1 / 1

Code: benches/bench1_temp/tests/test_tmp07.py::test_tc_tmp07_fi_03
@tc("TC-TMP07-FI-03")
@pytest.mark.regression
@requires(Fault.I2C_NACK)
def test_tc_tmp07_fi_03(dut: TempMonitor, case: Case) -> None:
    """Exactly one failed read: `ERR SENSOR` on that message only, readings before and after.

    Questions: Q13 open and Q19 assumed (stp.yaml): the first failed read triggers it.
    """
    before = stream_running(dut)
    failed = int(case.value("failed reads"))
    dut.inject_fault(Fault.I2C_NACK, count=failed)
    onset = dut.now_ms()
    got = [dut.next_message() for _ in range(failed + 1)]
    want = reading_text(int(case.value("start temperature")))
    expected = ["ERR SENSOR"] * failed + [want]
    assert before.kind is MessageKind.READING and [m.text for m in got] == expected, (
        f"Before the fault the device sent {before}. After {failed} failed read at {onset} ms "
        f"it sent {describe(got)}. Expected {', '.join(f'`{t}`' for t in expected)}: "
        f"`ERR SENSOR` in place of each failed read, then a reading."
    )
    errors = of_kind(since(dut, onset), MessageKind.ERR_SENSOR)
    assert len(errors) == failed, (
        f"The device sent {len(errors)} `ERR SENSOR` lines: {describe(errors)}. "
        f"Expected exactly {failed}."
    )

TC-TMP07-UPG-01

P1 · automated

Sensor returns: readings resume within 2 s

Requirement
TMP-07 v1.1
Class
UPG · upgrade and recovery
Technique
State transition ERROR → NORMAL
Level
regression
Precondition
Sensor NACKing every read, ERR SENSOR received
Test conditions
supply 5.0 V · start temperature 25 °C · settle window 2 messages
Points
resume limit: 2 s
Steps
  1. Make the sensor answer again at 25 °C
Expected
  1. TEMP 25 within 2 s, no ERR SENSOR after it (Q8 assumed)
Pass criteria
Readings resume within 2 s without a restart
Open questions
Q8

Matrix: TMP-07 × UPG · Last result: PASSED 1 / 1

Code: benches/bench1_temp/tests/test_tmp07.py::test_tc_tmp07_upg_01
@tc("TC-TMP07-UPG-01")
@pytest.mark.regression
@requires(Fault.I2C_NACK)
def test_tc_tmp07_upg_01(dut: TempMonitor, case: Case) -> None:
    """The sensor answers again: readings resume in time without a restart.

    Questions: Q8 assumed (stp.yaml): readings resume within 2 s.
    """
    stream_running(dut)
    with precondition("sensor NACKing every read, `ERR SENSOR` received"):
        dut.inject_fault(Fault.I2C_NACK)
        err_sensor(dut)
    dut.clear_faults()
    dut.set_temperature(float(case.value("start temperature")))
    answered = dut.now_ms()
    back = readings_resume(dut, case)
    check_latency(case, "resume limit", answered, back, "the sensor answering again")
    after = dut.next_message()
    assert after.kind is not MessageKind.ERR_SENSOR, (
        f"After {back} the device sent {after}. Expected no `ERR SENSOR` once the sensor answers."
    )

TC-TMP07-OBS-01

P3 · automated

Sensor fault names its cause on the UART

Requirement
TMP-07 v1.1
Class
OBS · observability
Technique
Error line on the UART
Level
regression
Precondition
UART stream running
Test conditions
supply 5.0 V · start temperature 25 °C · settle window 2 messages · last good reading 25 °C
Steps
  1. Make the sensor NACK every read
Expected
  1. ERR SENSOR within 2 s and no ERR RANGE, so the line tells a sensor fault from a range error (Q17 assumed: no other diagnostics)
Pass criteria
The error line names the injected cause
Open questions
Q17

Matrix: TMP-07 × OBS · Last result: PASSED 1 / 1

Code: benches/bench1_temp/tests/test_tmp07.py::test_tc_tmp07_obs_01
@tc("TC-TMP07-OBS-01")
@pytest.mark.regression
@requires(Fault.I2C_NACK)
def test_tc_tmp07_obs_01(dut: TempMonitor, case: Case) -> None:
    """A sensor fault names its cause: `ERR SENSOR`, not `ERR RANGE`.

    Questions: Q17 assumed (stp.yaml): no diagnostics beyond the UART lines and the LED.
    """
    last_good_reading(dut, case)
    dut.inject_fault(Fault.I2C_NACK)
    onset = dut.now_ms()
    err = err_sensor(dut)
    wrong = of_kind(since(dut, onset, err), MessageKind.ERR_RANGE)
    assert not wrong, (
        f"While the sensor NACKed, the device sent {describe(wrong)} before {err}. "
        f"Expected `ERR SENSOR` and no `ERR RANGE`."
    )
Next: the automation →