18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-19 07:36:02 +01:00

refactor(simulation): fix the Sonar remarks on the test mode code

- TController::TableCheck() calls TSpeedPos::Update() as it did before the
  test mode: the check for a signal passed at danger is a call of its own
  after it (CheckSignalPassedAtDanger), so the update lines nest no deeper
  than on master (S134). A switch is a track, so a signal's update never
  takes the switch-change branch and the check runs in the same place as
  before; the physicslogs of all 15 scenario cases are byte for byte the
  same.
- null_imgui_renderer is final (S1235), to_string(test_result) uses
  `using enum` (S6177), init_result_cell() is const (S5817),
  ConfigParseTest() takes a std::string_view (S6009) and the test settings
  struct is declared apart from its member (S3646).
This commit is contained in:
jerrrrycho
2026-11-08 09:35:59 +01:00
parent 6ccf4b14bf
commit 547706b54d
7 changed files with 31 additions and 27 deletions

View File

@@ -456,10 +456,10 @@ bool global_settings::ConfigParseInput(cParser& Parser, const std::string& token
return false;
}
bool global_settings::ConfigParseTest(cParser& Parser, const std::string& token)
bool global_settings::ConfigParseTest(cParser& Parser, std::string_view const Token)
{
// integration test limits, usually given in the config block of a test scenery
if (token == "test.timeout")
if (Token == "test.timeout")
{
double value{ test.timeout };
ParseOne(Parser, value);
@@ -468,26 +468,26 @@ bool global_settings::ConfigParseTest(cParser& Parser, const std::string& token)
return true;
}
if (token == "test.standstill")
if (Token == "test.standstill")
{
ParseOne(Parser, test.standstill);
test.standstill = std::max(0.0, test.standstill);
return true;
}
if (token == "test.pass_on_standstill")
if (Token == "test.pass_on_standstill")
{
ParseOne(Parser, test.pass_on_standstill);
return true;
}
if (token == "test.fail_if_stop_overran")
if (Token == "test.fail_if_stop_overran")
{
ParseOne(Parser, test.fail_if_stop_overran);
return true;
}
if (token == "test.no_movement_before_pass")
if (Token == "test.no_movement_before_pass")
{
ParseOne(Parser, test.no_movement_before_pass);
return true;