mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-14 09:06:58 +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:
@@ -82,9 +82,10 @@ void test_manager::start()
|
||||
}
|
||||
// a pause set by the scenery or the settings would never be lifted, nobody is there to press the key
|
||||
Global.iPause = 0;
|
||||
WriteLog(std::format("test: started, timeout {:.0f} s, standstill {:.0f} s{}{}", Global.test.timeout, Global.test.standstill,
|
||||
WriteLog(std::format("test: started, timeout {:.0f} s, standstill {:.0f} s{}{}{}", Global.test.timeout, Global.test.standstill,
|
||||
Global.test.pass_on_standstill ? ", standstill passes" : "",
|
||||
Global.test.fail_if_stop_overran ? "" : ", signals passed at danger allowed"));
|
||||
Global.test.fail_if_stop_overran ? "" : ", signals passed at danger allowed",
|
||||
Global.test.no_movement_before_pass ? "" : ", pass without waiting for a stop"));
|
||||
}
|
||||
|
||||
void test_manager::update(double const Deltatime)
|
||||
@@ -103,6 +104,11 @@ void test_manager::update(double const Deltatime)
|
||||
finish(test_result::fail, std::format("__test.result set to 0{}", reason));
|
||||
return;
|
||||
}
|
||||
if (holds(value, 1.0) && false == Global.test.no_movement_before_pass)
|
||||
{
|
||||
finish(test_result::pass, std::format("__test.result set to 1{}", reason));
|
||||
return;
|
||||
}
|
||||
if (holds(value, 1.0) && false == m_passrequested)
|
||||
{
|
||||
m_passrequested = true;
|
||||
|
||||
Reference in New Issue
Block a user