EV-60: test row T5b (route (b) world, next key, cap lifted, change runs)
Test only; carmode.py is unchanged from 5bd2b1e.
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -455,6 +455,49 @@ for k in "R":
|
||||
len(k1) == 3 and all(b - a >= 60 for a, b in zip(k1, k1[1:]))
|
||||
and not r.w.gave_up and not r.refs and r.q3w == [120])
|
||||
|
||||
# T5b: route (b)'s world, the cap lifts at 900 and the plan decides a change
|
||||
ph5 = {"all": True}
|
||||
|
||||
|
||||
def t5b_pre(w, d, t):
|
||||
if t == 0:
|
||||
set_cap(w, 0.0)
|
||||
w.plan.a = 0.0
|
||||
if t == 180:
|
||||
set_cap(w, None)
|
||||
ph5["all"] = False
|
||||
w.plan.a = 8.0
|
||||
if t == 900:
|
||||
set_cap(w, None)
|
||||
w.plan.a = 8.0
|
||||
w.plan.n = 3
|
||||
w.plan._set(8.0, 900.0, 1) # 3 -> 1 phase, no cap
|
||||
|
||||
|
||||
def t5b_post(w, d, t):
|
||||
if t == 180:
|
||||
w.plan._set(8.0, 180.0, 3)
|
||||
elif 180 < t < 900 and w.seq is not None \
|
||||
and w.seq.get("stage") == "settle" and w.cut_a is None:
|
||||
set_cap(w, 6.0)
|
||||
|
||||
|
||||
r = world("R", 1000, pre=t5b_pre, post=t5b_post,
|
||||
take=lambda a, d, w: d.now >= 900 or (
|
||||
not ph5["all"] and a == 0.0 and w.cut_a is None))
|
||||
c900 = [(int(t), a) for t, a in r.drv.calls if t >= 900]
|
||||
check(f"T5b: route (b) tries used up in key 0 (cut_fails {r.snap[899]['cf']}); "
|
||||
f"at key 1 the cut is lifted and the phase change runs with no cut "
|
||||
f"try: the 0 A already stands, the select, the close at the plan's "
|
||||
f"value 8 A at ~911 ({c900}); cut_fails {r.snap[900]['cf']}, no "
|
||||
f"refused cut try in key 1 ({[t for t in r.tries if t >= 900]}), "
|
||||
f"plan.n {r.w.plan.n}, seq None, no give-up",
|
||||
r.snap[899]["cf"] == 3 and r.snap[900]["cf"] == 0
|
||||
and len(c900) == 1 and abs(c900[0][0] - 911) <= 1 and c900[0][1] == 8.0
|
||||
and not [t for t in r.tries if t >= 900] and r.w.plan.n == 1
|
||||
and not r.w.plan.switch and r.w.seq is None and not r.w.gave_up
|
||||
and len(r.drv.phases_log) == 2)
|
||||
|
||||
# T11a: no cap any more: not a cut try
|
||||
r = route_a("R", until=420, plan_a=8.0,
|
||||
take=lambda a, d, w: a == 0.0 and w.cut_a is None
|
||||
|
||||
Reference in New Issue
Block a user