mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 14:55:36 +08:00
Allow to mark interpolator for unit tests (which can be used to disable some checks)
This commit is contained in:
@@ -147,9 +147,12 @@ namespace BlackMisc
|
||||
CInterpolationResult result;
|
||||
do
|
||||
{
|
||||
if (!this->initIniterpolationStepData(currentTimeSinceEpoc, setup)) { break; }
|
||||
if (!this->initIniterpolationStepData(currentTimeSinceEpoc, setup))
|
||||
{
|
||||
// make sure we can also interpolate parts only (needed in unit tests)
|
||||
if (!m_unitTest) { break; }
|
||||
}
|
||||
|
||||
// make sure we can also interpolate parts only (needed in unit tests for instance)
|
||||
const CAircraftSituation interpolatedSituation = this->getInterpolatedSituation();
|
||||
const CAircraftParts interpolatedParts = this->getInterpolatedOrGuessedParts();
|
||||
|
||||
|
||||
@@ -204,6 +204,9 @@ namespace BlackMisc
|
||||
//! \remark either by passing a model or using the provider
|
||||
void initCorrespondingModel(const CAircraftModel &model = {});
|
||||
|
||||
//! Mark as unit test
|
||||
void markAsUnitTest() { m_unitTest = true; }
|
||||
|
||||
protected:
|
||||
//! Constructor
|
||||
CInterpolator(const Aviation::CCallsign &callsign,
|
||||
@@ -249,6 +252,7 @@ namespace BlackMisc
|
||||
qint64 m_situationsLastModifiedUsed { -1 }; //!< interpolant based on situations last updated
|
||||
int m_interpolatedSituationsCounter { 0 }; //!< counter for each interpolated situations: statistics, every n-th interpolation ....
|
||||
|
||||
bool m_unitTest = false; //!< mark as unit test
|
||||
|
||||
//! Verify gnd flag, times, ... true means "OK"
|
||||
bool verifyInterpolationSituations(const Aviation::CAircraftSituation &oldest, const Aviation::CAircraftSituation &newer, const Aviation::CAircraftSituation &latest,
|
||||
|
||||
@@ -57,6 +57,7 @@ namespace BlackMiscTest
|
||||
CCallsign cs("SWIFT");
|
||||
CRemoteAircraftProviderDummy provider;
|
||||
CInterpolatorLinear interpolator(cs, nullptr, nullptr, &provider);
|
||||
// interpolator.markAsUnitTest();
|
||||
|
||||
// fixed time so everything can be debugged
|
||||
const qint64 ts = 1425000000000; // QDateTime::currentMSecsSinceEpoch();
|
||||
|
||||
@@ -33,6 +33,7 @@ namespace BlackMiscTest
|
||||
CCallsign cs("SWIFT");
|
||||
CRemoteAircraftProviderDummy provider;
|
||||
CInterpolatorSpline interpolator(cs, nullptr, nullptr, &provider);
|
||||
interpolator.markAsUnitTest();
|
||||
|
||||
// fixed time so everything can be debugged
|
||||
const qint64 ts = 1425000000000; // QDateTime::currentMSecsSinceEpoch()
|
||||
|
||||
Reference in New Issue
Block a user