EV-59: test_ev13 T26 goldens, N4/N8/N10 tests, stronger T12b/T11a
PM ruling: drop the 4th and 5th tries (1095, 1155) from the test_ev13 T26 goldens T20-beside and T20-inside. test_ev59 gains T13e (a give-up never blocks _undo, abandon or _begin), N8 and N10, and the fails-at-select and fails-at-timeout asserts that kill mutant M12. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -460,6 +460,7 @@ check(f"T11a: the drawing timeout, the 16 A restore refused: 3 tries 5 s "
|
||||
near(nz(R11a, 0, 300), [20, 25, 30])
|
||||
and R11a.rows[30]["fails"] == CM.MAX_TRIES and R11a.rows[30]["gave_up"]
|
||||
and refs(R11a) == [30] and R11a.rows[30]["phase_fails"] == 1
|
||||
and R11a.rows[20]["fails"] == 0 and R11a.rows[25]["fails"] == 0
|
||||
and not R11a.drv.phases_log and nz(R11a, 300)[:1] == [300])
|
||||
never("T11a", R11a, ucs=[300])
|
||||
UCS.clear()
|
||||
@@ -487,6 +488,7 @@ check(f"T12b: a refused select counts for the phases only: close taken, fails "
|
||||
f"{R12b.rows[60]['fails']}, phase_fails {R12b.rows[60]['phase_fails']}, "
|
||||
"no REF",
|
||||
R12b.rows[60]["fails"] == 0 and R12b.rows[60]["phase_fails"] == 1
|
||||
and R12b.rows[1]["fails"] == 0 and R12b.rows[1]["phase_fails"] == 1
|
||||
and not refs(R12b) and not R12b.rows[60]["gave_up"])
|
||||
R12c = run(lambda a, n: True, 100, cur=16.0, a=16.0,
|
||||
power=lambda t, d: 1380.0)
|
||||
@@ -650,7 +652,49 @@ R22 = run(refuse, 600, avail=lambda t: False)
|
||||
check("T22: no charger: 0 writes, no lines, no REF",
|
||||
not R22.drv.calls and not R22.log and not refs(R22))
|
||||
|
||||
print("\n7. N4")
|
||||
print("\n6b. A GIVE-UP NEVER BLOCKS THE UNDO, THE SHUTDOWN OR A NEW SEQUENCE (N4)")
|
||||
|
||||
|
||||
def given_up_writer():
|
||||
w = CM.ManualWriter()
|
||||
w.gave_up, w.fails = True, CM.MAX_TRIES
|
||||
w.seq = {"stage": "zero", "t0": 0.0, "n": 3, "tries": 0, "prev": 10.0}
|
||||
return w, Drv(0.0, lambda a, n: True), Trk()
|
||||
|
||||
|
||||
w13, d13, t13 = given_up_writer()
|
||||
asyncio.run(w13._undo(d13, 1.0, t13, 16.0, False))
|
||||
check(f"T13e/N4: `_undo` with gave_up set restores the 10 A ({d13.calls})",
|
||||
d13.calls == [(0.0, 10.0)] and w13.seq is None)
|
||||
w13, d13, t13 = given_up_writer()
|
||||
asyncio.run(w13.abandon(d13, 1.0, t13, clamp=16.0))
|
||||
check(f"T13e/N4: `abandon` with gave_up set gives the 10 A back "
|
||||
f"({d13.calls})", d13.calls == [(0.0, 10.0)] and w13.seq is None)
|
||||
w13, d13, t13 = given_up_writer()
|
||||
w13.seq = None
|
||||
asyncio.run(w13._begin(d13, Rd(10.0), 10.0, 3, 1.0, t13))
|
||||
check(f"T13e/N4: `_begin` with gave_up set still writes the 0 A "
|
||||
f"({d13.calls})", d13.calls == [(0.0, 0.0)] and w13.seq is not None)
|
||||
|
||||
print("\n7. N4, N8, N10")
|
||||
APP = os.path.join(HERE, "app")
|
||||
SRC = {f: open(os.path.join(APP, f), encoding="utf-8").read()
|
||||
for f in sorted(os.listdir(APP)) if f.endswith(".py")}
|
||||
cm_src = SRC["carmode.py"]
|
||||
check("N8 (write_phases and the peak-cut rules untouched): carmode.py still "
|
||||
"has the one `write_phases(` call and no new write path; base had 1",
|
||||
cm_src.count("write_phases(") == 1
|
||||
and cm_src.count("drv.write_current(") == 1)
|
||||
check("N10 (no new store key, setting, notification or timer): `_close_k` "
|
||||
"lives in carmode.py only, never next to a store or option; the "
|
||||
"asyncio.sleep, create_task and _LOG.warning counts are the base's "
|
||||
"(1, 0, 10)",
|
||||
[f for f, s in SRC.items() if "_close_k" in s] == ["carmode.py"]
|
||||
and cm_src.count("asyncio.sleep") == 1
|
||||
and cm_src.count("create_task") == 0
|
||||
and cm_src.count("_LOG.warning(") == 10
|
||||
and not any("_close_k" in line and ("store" in line or "opts" in line)
|
||||
for line in cm_src.splitlines()))
|
||||
w4 = CM.ManualWriter()
|
||||
w4.gave_up, w4.fails, w4._close_k = True, 3, 3
|
||||
w4.user_changed()
|
||||
|
||||
Reference in New Issue
Block a user