UNIT test can be skipped on MacOS

This commit is contained in:
Klaus Basan
2018-07-12 13:33:26 +02:00
parent 6af1998f58
commit 21f901590b

View File

@@ -18,12 +18,14 @@
#include "blackmisc/network/fsdsetup.h"
#include "blackmisc/aviation/aircraftsituationchange.h"
#include "blackmisc/math/mathutils.h"
#include "blackconfig/buildconfig.h"
#include <QTest>
#include <QTimer>
#include <QDateTime>
#include <QDebug>
using namespace BlackConfig;
using namespace BlackMisc::Aviation;
using namespace BlackMisc::PhysicalQuantities;
using namespace BlackMisc::Network;
@@ -211,9 +213,24 @@ namespace BlackMiscTest
QVERIFY(s1.getAdjustedMSecsSinceEpoch() < s2.getAdjustedMSecsSinceEpoch());
}
const int hint = time.elapsed();
const double ratio = static_cast<double>(hint) / static_cast<double>(noHint); // expected <0
// remark On Win/Linux access with hint is faster
// on MacOS the times are the same, maybe with hint it is even slightly slower
if (noHint >= hint)
{
// on MacOS we accept up to 10% overhead and SKIP the test
if (CBuildConfig::isRunningOnMacOSPlatform() && ratio < 1.1)
{
QSKIP("Skipped sort hint on MacOS");
return;
}
}
qDebug() << "Access without hint" << noHint << "ms";
qDebug() << "Access with hint" << hint << "ms";
QVERIFY2(hint < noHint, "Expected hinted sort being faster");
qDebug() << "Access ratio" << ratio;
QVERIFY2(hint <= noHint, "Expected hinted sort being faster");
}
CAircraftSituationList CTestAircraftSituation::testSituations()