mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-19 11:06:03 +01:00
feat(simulation): test.no_movement_before_pass, a pass that doesn't wait for a stop
The config key from eu07/maszyna#541. By default (yes) a pass reported to __test.result waits until every vehicle has stood still for 1 s; with no it ends the test at once. The key is listed with the other test.* settings in the log and in the test start line. Scenario tests: new case test_mode_pass_while_moving reports the pass from event2 of tor1k as the train runs onto it and checks the run ended with the train still moving (new check ends_moving). The README lists the test.* keys with their defaults and the input the test mode ignores.
This commit is contained in:
@@ -416,6 +416,15 @@ def check_holds_still(rows, moving_speed, stop_speed, max_distance):
|
||||
return d <= max_distance, detail
|
||||
|
||||
|
||||
def check_ends_moving(rows, min_speed):
|
||||
"""The run ended with the vehicle still moving, e.g. a pass that didn't wait for the trains to stop."""
|
||||
if not rows:
|
||||
return False, "the physicslog is empty"
|
||||
last = rows[-1]
|
||||
ok = last[COL_VELOCITY] >= min_speed
|
||||
return ok, f"last row t={last[COL_TIME]:.1f}s, v={last[COL_VELOCITY]:.1f} km/h (wanted >= {min_speed})"
|
||||
|
||||
|
||||
def check_slip_clears(rows, moving_speed, stop_speed, within):
|
||||
"""Once the vehicle has stopped after moving off, its wheels stop slipping within `within` seconds
|
||||
(a vehicle left skidding on locked wheels keeps its brakes capped by the sliding adhesion)."""
|
||||
@@ -444,6 +453,7 @@ CHECKS = {
|
||||
"stops": check_stops,
|
||||
"stays_stopped": check_stays_stopped,
|
||||
"distance": check_distance,
|
||||
"ends_moving": check_ends_moving,
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user