18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-19 15:45:23 +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:
jerrrrycho
2026-11-08 04:22:13 +01:00
parent 5bc4e7cd2e
commit f2ecbd055c

View File

@@ -67,6 +67,9 @@ TEST_CASE("cntrl: ScndCtrlResistiveLock keeps the field shunting off at zero and
REQUIRE(locked->ScndCtrlPosNo > 0);
auto const resistancefree{resistance_free_position(locked.mover())};
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);
SUBCASE("zero") {