18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-15 15:14:09 +01:00

feat(simulation): the pass and the standstill wait for the train under test only

Both waited for every vehicle of the scenery to stand still, so on a scenery
with AI traffic a test could pass only when the traffic happened to stand too,
and the standstill end hardly ever came.

A test scenery names the train under test with test.vehicle <name> in its
config block (once for each train, if several): the pass and the standstill wait
for the consists of these vehicles as they are at the moment, so a train the
tested one couples to counts with it. A name the scenery doesn't have ends the
test with the error code. Without test.vehicle every vehicle counts, as before.
A signal passed at danger counts for every train either way.

run.py puts the case's lead vehicle into test.vehicle. test_mode_standstill_traffic
has the train under test standing on track 2 of Stacja1 while AI traffic leaves
track 1 on the timetable: it ends on its 100 s standstill, where counting every
vehicle runs into the 300 s timeout. Physicslogs of the other trains of a case
(<something>_<vehicle>) are moved out of the game dir too.
This commit is contained in:
jerrrrycho
2026-11-08 11:39:52 +01:00
parent 03a417c7b0
commit e5aafd154f
12 changed files with 120 additions and 30 deletions

View File

@@ -138,9 +138,9 @@ std::optional<test_verdict> evaluate_frame(test_progress &Progress, test_frame c
Progress.resttime = Frame.atrest ? Progress.resttime + Frame.deltatime : 0.0;
if (Progress.passrequested && Progress.resttime >= pass_settle_time)
return test_verdict{pass, "__test.result set to 1 and every vehicle stopped"};
return test_verdict{pass, "__test.result set to 1 and the tested trains stopped"};
if (Limits.standstill > 0.0 && Progress.resttime >= Limits.standstill)
return test_verdict{Limits.pass_on_standstill ? pass : standstill, std::format("every vehicle stood still for {:.0f} s", Limits.standstill)};
return test_verdict{Limits.pass_on_standstill ? pass : standstill, std::format("the tested trains stood still for {:.0f} s", Limits.standstill)};
if (Limits.timeout > 0.0 && Progress.time >= Limits.timeout)
return test_verdict{timeout, std::format("no result after {:.0f} s", Limits.timeout)};
return std::nullopt;