18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-19 21:34:58 +01:00

refactor(simulation): the rules of the test mode in a file of their own, with unit tests

The command line options of the test mode and the end conditions checked after
each frame are now plain functions in simulation/simulationtestrules.cpp, which
needs nothing of the running simulation: parse_test_command_line() and
evaluate_frame(). The file is part of the core library, so the unit tests check
them (tests/unit/test_test_mode.cpp): the --test-timeout value, values of other
options not taken for options, a pass that waits for the stop, the standstill,
the timeout. test_manager only gathers what a frame brought and acts on the
verdict. No change in behaviour.
This commit is contained in:
jerrrrycho
2026-11-08 11:20:52 +01:00
parent 62526e9d6a
commit 486a714f52
7 changed files with 452 additions and 110 deletions

View File

@@ -454,7 +454,7 @@ endif()
add_library(eu07_settings INTERFACE)
# the parts of the simulation the game shares with the unit tests: the vehicle physics, the vehicle
# definition parser and the helpers they use. built once, and tested as the game uses them
# definition parser, the helpers they use and the rules of the test mode. built once, and tested as the game uses them
set(CORE_SOURCES
"McZapkie/friction.cpp"
"McZapkie/hamulce.cpp"
@@ -463,6 +463,7 @@ set(CORE_SOURCES
"utilities/parser.cpp"
"utilities/utilities.cpp"
"scripting/ladderlogic.cpp"
"simulation/simulationtestrules.cpp"
"vehicle/handover.cpp"
"vehicle/horn.cpp"
"vehicle/smoke.cpp"