Issue #22 Error when FL doesn't end in 0 or 5 should be warning

This commit is contained in:
Mat Sutcliffe
2021-08-08 19:25:44 +01:00
parent 1c10c3ba0a
commit 09b58b8084
2 changed files with 3 additions and 4 deletions

View File

@@ -342,8 +342,7 @@ namespace BlackMisc
} }
if (!CMathUtils::epsilonZero(fmod(flInt, 5))) if (!CMathUtils::epsilonZero(fmod(flInt, 5)))
{ {
if (msgs) { msgs->push_back(CStatusMessage(this).validationError(u"FL needs to end with 0 or 5")); } if (msgs) { msgs->push_back(CStatusMessage(this).validationWarning(u"FL should end with 0 or 5")); }
return false;
} }
} }
} }

View File

@@ -72,6 +72,8 @@ namespace BlackMiscTest
CAltitude a; CAltitude a;
a.parseFromFpAltitudeString("FL125"); a.parseFromFpAltitudeString("FL125");
QVERIFY2(a == CAltitude(12500, CAltitude::FlightLevel, CLengthUnit::ft()), "Wrong altitude FL125"); QVERIFY2(a == CAltitude(12500, CAltitude::FlightLevel, CLengthUnit::ft()), "Wrong altitude FL125");
a.parseFromFpAltitudeString("FL126");
QVERIFY2(a == CAltitude(12600, CAltitude::FlightLevel, CLengthUnit::ft()), "Wrong altitude FL126");
a.parseFromFpAltitudeString("A122"); a.parseFromFpAltitudeString("A122");
QVERIFY2(a == CAltitude(12200, CAltitude::MeanSeaLevel, CLengthUnit::ft()), "Wrong altitude A122"); QVERIFY2(a == CAltitude(12200, CAltitude::MeanSeaLevel, CLengthUnit::ft()), "Wrong altitude A122");
a.parseFromFpAltitudeString("123ft"); a.parseFromFpAltitudeString("123ft");
@@ -87,8 +89,6 @@ namespace BlackMiscTest
CAltitude faulty(a); CAltitude faulty(a);
faulty.makeNegative(); faulty.makeNegative();
QVERIFY2(!faulty.isValidFpAltitude(), "Negative values not allowed"); QVERIFY2(!faulty.isValidFpAltitude(), "Negative values not allowed");
faulty.parseFromFpAltitudeString("FL111");
QVERIFY2(!faulty.isValidFpAltitude(), "FL should end with 0/5");
// as string // as string
a = CAltitude(12500, CAltitude::FlightLevel, CLengthUnit::ft()); a = CAltitude(12500, CAltitude::FlightLevel, CLengthUnit::ft());