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

test: characterize the parser of the text files

The tokens, comments, quotes, parameters and include directives of cParser, its numbers and its place in the text, as they behave now, with the files of the tests made in a folder of the build (scratch.h). The helpers of utilities.h which read from a parser are here too.
This commit is contained in:
jerrrrycho
2026-11-11 22:40:02 +01:00
parent 5d46478fa9
commit 2f13f052f7
3 changed files with 942 additions and 0 deletions

View File

@@ -77,6 +77,9 @@ TEST_CASE("brakes: service braking stops a heavier wagon too") {
- `pair` (`vehicle.h`) puts two vehicles on that track facing each other with the given ends and
runs them together, as the simulation runs the vehicles of a scene: the coupler and buffer
forces, collisions and automatic coupling come from the physics (`test_couplers.cpp`).
- A test which reads files makes them in a `test::scratch_folder` (`scratch.h`): a folder of its own
in the build folder of the tests, removed with the object. The files are written byte for byte, so
the line ends are the ones the test gives (`test_parser.cpp`, `test_ladder_logic.cpp`).
- Check behaviour (speeds, pressures, states the player sees) rather than internal flags, and make
the test check its own preconditions (`REQUIRE` that the braking skidded, before checking what a
skid leads to).