mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-19 14:42:28 +01:00
test: reach the mover by reference in the brake handle lambdas (Sonar S2259)
The lambdas of the St113 EP brake and the MHZ buttons tests called the mover through test::vehicle::operator->(), which the analyser takes as possibly null; they capture a reference from mover() instead.
This commit is contained in:
@@ -131,9 +131,10 @@ TEST_CASE("brake handles: the overload and the high pressure buttons of the MHZ
|
|||||||
real.record(trace);
|
real.record(trace);
|
||||||
REQUIRE(real->Handle != nullptr);
|
REQUIRE(real->Handle != nullptr);
|
||||||
auto &handle{*real->Handle};
|
auto &handle{*real->Handle};
|
||||||
auto const at{[&trace, &real](std::string const &Event, double Position, double Seconds) {
|
auto &mover{real.mover()};
|
||||||
|
auto const at{[&trace, &real, &mover](std::string const &Event, double Position, double Seconds) {
|
||||||
trace.mark(Event);
|
trace.mark(Event);
|
||||||
real->BrakeLevelSet(Position);
|
mover.BrakeLevelSet(Position);
|
||||||
test::drive(test::driving(real), {}, Seconds);
|
test::drive(test::driving(real), {}, Seconds);
|
||||||
}};
|
}};
|
||||||
at("running", handle.GetPos(bh_RP), 60.0);
|
at("running", handle.GetPos(bh_RP), 60.0);
|
||||||
@@ -196,8 +197,9 @@ TEST_CASE("brake handles: the positions of the Knorr St113 EP brake") {
|
|||||||
auto &cab{unit[0]};
|
auto &cab{unit[0]};
|
||||||
REQUIRE(cab->Handle != nullptr);
|
REQUIRE(cab->Handle != nullptr);
|
||||||
auto &handle{*cab->Handle};
|
auto &handle{*cab->Handle};
|
||||||
auto const ep_at{[&unit, &cab, &handle](double Position) {
|
auto &mover{cab.mover()};
|
||||||
cab->BrakeLevelSet(Position);
|
auto const ep_at{[&unit, &mover, &handle](double Position) {
|
||||||
|
mover.BrakeLevelSet(Position);
|
||||||
unit.run(0.1);
|
unit.run(0.1);
|
||||||
return handle.GetEP();
|
return handle.GetEP();
|
||||||
}};
|
}};
|
||||||
|
|||||||
Reference in New Issue
Block a user