mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-26 02:35:38 +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;
|
CInterpolationResult result;
|
||||||
do
|
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 CAircraftSituation interpolatedSituation = this->getInterpolatedSituation();
|
||||||
const CAircraftParts interpolatedParts = this->getInterpolatedOrGuessedParts();
|
const CAircraftParts interpolatedParts = this->getInterpolatedOrGuessedParts();
|
||||||
|
|
||||||
|
|||||||
@@ -204,6 +204,9 @@ namespace BlackMisc
|
|||||||
//! \remark either by passing a model or using the provider
|
//! \remark either by passing a model or using the provider
|
||||||
void initCorrespondingModel(const CAircraftModel &model = {});
|
void initCorrespondingModel(const CAircraftModel &model = {});
|
||||||
|
|
||||||
|
//! Mark as unit test
|
||||||
|
void markAsUnitTest() { m_unitTest = true; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//! Constructor
|
//! Constructor
|
||||||
CInterpolator(const Aviation::CCallsign &callsign,
|
CInterpolator(const Aviation::CCallsign &callsign,
|
||||||
@@ -249,6 +252,7 @@ namespace BlackMisc
|
|||||||
qint64 m_situationsLastModifiedUsed { -1 }; //!< interpolant based on situations last updated
|
qint64 m_situationsLastModifiedUsed { -1 }; //!< interpolant based on situations last updated
|
||||||
int m_interpolatedSituationsCounter { 0 }; //!< counter for each interpolated situations: statistics, every n-th interpolation ....
|
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"
|
//! Verify gnd flag, times, ... true means "OK"
|
||||||
bool verifyInterpolationSituations(const Aviation::CAircraftSituation &oldest, const Aviation::CAircraftSituation &newer, const Aviation::CAircraftSituation &latest,
|
bool verifyInterpolationSituations(const Aviation::CAircraftSituation &oldest, const Aviation::CAircraftSituation &newer, const Aviation::CAircraftSituation &latest,
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ namespace BlackMiscTest
|
|||||||
CCallsign cs("SWIFT");
|
CCallsign cs("SWIFT");
|
||||||
CRemoteAircraftProviderDummy provider;
|
CRemoteAircraftProviderDummy provider;
|
||||||
CInterpolatorLinear interpolator(cs, nullptr, nullptr, &provider);
|
CInterpolatorLinear interpolator(cs, nullptr, nullptr, &provider);
|
||||||
|
// interpolator.markAsUnitTest();
|
||||||
|
|
||||||
// fixed time so everything can be debugged
|
// fixed time so everything can be debugged
|
||||||
const qint64 ts = 1425000000000; // QDateTime::currentMSecsSinceEpoch();
|
const qint64 ts = 1425000000000; // QDateTime::currentMSecsSinceEpoch();
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ namespace BlackMiscTest
|
|||||||
CCallsign cs("SWIFT");
|
CCallsign cs("SWIFT");
|
||||||
CRemoteAircraftProviderDummy provider;
|
CRemoteAircraftProviderDummy provider;
|
||||||
CInterpolatorSpline interpolator(cs, nullptr, nullptr, &provider);
|
CInterpolatorSpline interpolator(cs, nullptr, nullptr, &provider);
|
||||||
|
interpolator.markAsUnitTest();
|
||||||
|
|
||||||
// fixed time so everything can be debugged
|
// fixed time so everything can be debugged
|
||||||
const qint64 ts = 1425000000000; // QDateTime::currentMSecsSinceEpoch()
|
const qint64 ts = 1425000000000; // QDateTime::currentMSecsSinceEpoch()
|
||||||
|
|||||||
Reference in New Issue
Block a user