mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 14:55:36 +08:00
Ref T270, mark interpolator as unit test
* if we use "recycled" parts, we have to store also the last status * mark unit test so "recycling" is disabled * status flag for "reused"
This commit is contained in:
@@ -292,6 +292,8 @@ namespace BlackMisc
|
||||
Q_ASSERT_X(m_partsToSituationInterpolationRatio >= 1 && m_partsToSituationInterpolationRatio < 11, Q_FUNC_INFO, "Wrong ratio");
|
||||
if (!m_unitTest && !m_lastParts.isNull() && ((m_interpolatedSituationsCounter + aircraftNumber) % m_partsToSituationInterpolationRatio) == 0)
|
||||
{
|
||||
m_currentPartsStatus = m_lastPartsStatus;
|
||||
m_currentPartsStatus.setReusedParts(true);
|
||||
return m_lastParts;
|
||||
}
|
||||
|
||||
@@ -312,6 +314,7 @@ namespace BlackMisc
|
||||
}
|
||||
|
||||
m_lastParts = parts;
|
||||
m_lastPartsStatus = m_currentPartsStatus;
|
||||
return parts;
|
||||
}
|
||||
|
||||
@@ -513,6 +516,7 @@ namespace BlackMisc
|
||||
void CPartsStatus::reset()
|
||||
{
|
||||
m_supportsParts = false;
|
||||
m_resusedParts = false;
|
||||
}
|
||||
|
||||
// see here for the reason of thess forward instantiations
|
||||
|
||||
@@ -96,11 +96,18 @@ namespace BlackMisc
|
||||
//! Set support flag
|
||||
void setSupportsParts(bool supports) { m_supportsParts = supports; }
|
||||
|
||||
//! Is a reused parts, means using last value again
|
||||
bool isReusedPArts() const { return m_resusedParts; }
|
||||
|
||||
//! Mark as reused
|
||||
void setReusedParts(bool reused) { m_resusedParts = reused; }
|
||||
|
||||
//! Reset to default values
|
||||
void reset();
|
||||
|
||||
private:
|
||||
bool m_supportsParts = false; //!< supports parts for given callsign
|
||||
bool m_resusedParts = false; //!< reusing from last step
|
||||
};
|
||||
|
||||
//! Combined results
|
||||
@@ -248,6 +255,7 @@ namespace BlackMisc
|
||||
CInterpolationAndRenderingSetupPerCallsign m_currentSetup; //!< used setup
|
||||
CInterpolationStatus m_currentInterpolationStatus; //!< this step's status
|
||||
CPartsStatus m_currentPartsStatus; //!< this step's status
|
||||
CPartsStatus m_lastPartsStatus; //!< status for last parts, used when last parts are re-used because of m_partsToSituationInterpolationRatio
|
||||
int m_partsToSituationInterpolationRatio = 2; //!< ratio between parts and situation interpolation, 1..always, 2..every 2nd situation
|
||||
Aviation::CAircraftSituation m_lastSituation { Aviation::CAircraftSituation::null() }; //!< latest interpolation
|
||||
Aviation::CAircraftParts m_lastParts { Aviation::CAircraftParts::null() }; //!< latest parts
|
||||
|
||||
@@ -54,10 +54,10 @@ namespace BlackMiscTest
|
||||
{
|
||||
void CTestInterpolatorLinear::basicInterpolatorTests()
|
||||
{
|
||||
CCallsign cs("SWIFT");
|
||||
const CCallsign cs("SWIFT");
|
||||
CRemoteAircraftProviderDummy provider;
|
||||
CInterpolatorLinear interpolator(cs, nullptr, nullptr, &provider);
|
||||
// interpolator.markAsUnitTest();
|
||||
interpolator.markAsUnitTest();
|
||||
|
||||
// fixed time so everything can be debugged
|
||||
const qint64 ts = 1425000000000; // QDateTime::currentMSecsSinceEpoch();
|
||||
@@ -115,6 +115,7 @@ namespace BlackMiscTest
|
||||
// With one callsign in the lists (of dummy provider) it is somehow expected to be roughly the same performance
|
||||
|
||||
interpolator.resetLastInterpolation();
|
||||
interpolator.markAsUnitTest();
|
||||
for (int loops = 0; loops < 20; loops++)
|
||||
{
|
||||
for (qint64 currentTime = startTimeMsSinceEpoch + offset; currentTime < ts + offset; currentTime += (deltaT / 20))
|
||||
|
||||
Reference in New Issue
Block a user