mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-19 21:34:58 +01:00
fix: keep the resistive-lock test's controller table index in range for CI
Sonar (S3519) doesn't see the REQUIRE ending the test, so it read the table at the index below the first resistance-free position as possibly -1.
This commit is contained in:
@@ -67,6 +67,9 @@ TEST_CASE("cntrl: ScndCtrlResistiveLock keeps the field shunting off at zero and
|
|||||||
REQUIRE(locked->ScndCtrlPosNo > 0);
|
REQUIRE(locked->ScndCtrlPosNo > 0);
|
||||||
auto const resistancefree{resistance_free_position(locked.mover())};
|
auto const resistancefree{resistance_free_position(locked.mover())};
|
||||||
REQUIRE(resistancefree > 1);
|
REQUIRE(resistancefree > 1);
|
||||||
|
if (resistancefree <= 1) {
|
||||||
|
continue; // not reached, the REQUIRE above ends the test; tells the static analysis the index below is in range
|
||||||
|
}
|
||||||
REQUIRE(locked->RList[resistancefree - 1].R >= 0.01);
|
REQUIRE(locked->RList[resistancefree - 1].R >= 0.01);
|
||||||
|
|
||||||
SUBCASE("zero") {
|
SUBCASE("zero") {
|
||||||
|
|||||||
Reference in New Issue
Block a user