mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-12-03 06:35:21 +01:00
f65411a668
The speed along the couplers, the location, the offsets from the track axis,
the accelerations, the distance counter and the distance moved since the last
check, the flat of the wheels and the truck hunting, the distance of the
derailment check, whether the vehicle is inside a consist and in the coupler
model, the analog demand of the integrated controller and the flow of the pipe
stabiliser are private to physics::Vehicle. TDynamicObject places and moves the
vehicle, the scenery puts road vehicles on their way and the contacts push them
through the operations (SetV(), SetLoc(), SetOffsetTrackH(), ...), and the
jolts of the track are ShakeVertically() and ShakeHorizontally(), the same
additions as before.
No change in behaviour: the golden traces recorded on dfb43c4f match bit for bit.
37 lines
1.2 KiB
C++
37 lines
1.2 KiB
C++
#pragma once
|
|
|
|
#include <functional>
|
|
#include <string>
|
|
#include <string_view>
|
|
#include <vector>
|
|
|
|
#include "physics/vehicle.h"
|
|
|
|
namespace test {
|
|
|
|
// what the rules over time need of the step before
|
|
struct snapshot {
|
|
double time;
|
|
double v;
|
|
double distCounter;
|
|
};
|
|
|
|
// a rule of physics or of the vehicle's circuits, which holds for every vehicle after every step, whatever
|
|
// the test does with it. every golden trace checks them as it samples (see golden.h), on every step, not only
|
|
// on the recorded ones, and with no comparison to a recorded file, so they hold on any compiler. a change which
|
|
// alters the behaviour on purpose records the traces anew, and the rules still check the new behaviour makes sense.
|
|
struct invariant {
|
|
std::string name;
|
|
// Before is null at the first step of a trace
|
|
std::function<bool(physics::Vehicle const &Now, double Time, snapshot const *Before)> holds;
|
|
// the values the rule looks at, shown when it's broken
|
|
std::function<std::string(physics::Vehicle const &Now)> explain;
|
|
};
|
|
|
|
std::vector<invariant> const &invariants();
|
|
|
|
// the traces where the game breaks a rule, as it is, with the reason (see COVERAGE.md, what the tests found)
|
|
bool excused(std::string_view Trace, std::string_view Invariant);
|
|
|
|
} // namespace test
|