mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 14:55:36 +08:00
Added unit test based on discussion here
https://swift-project.slack.com/archives/G7GD2UP9C/p1515602377000431
This commit is contained in:
@@ -41,7 +41,6 @@ using namespace BlackMisc::Math;
|
||||
|
||||
namespace BlackMiscTest
|
||||
{
|
||||
|
||||
/*
|
||||
* Basic unit tests for physical units
|
||||
*/
|
||||
@@ -163,14 +162,22 @@ namespace BlackMiscTest
|
||||
*/
|
||||
void CTestPhysicalQuantities::pressureTests()
|
||||
{
|
||||
CPressure p1(1013.25, CPressureUnit::hPa());
|
||||
CPressure p2(29.92, CPressureUnit::inHg());
|
||||
const CPressure p1(1013.25, CPressureUnit::hPa());
|
||||
const CPressure p2(29.92, CPressureUnit::inHg());
|
||||
CPressure p4(p1);
|
||||
p4.switchUnit(CPressureUnit::mbar());
|
||||
|
||||
// does not match exactly
|
||||
QVERIFY2(p1 != p2, "Standard pressure test little difference");
|
||||
QVERIFY2(p1.value() == p4.value(), "mbar/hPa test");
|
||||
|
||||
// Unit substract test
|
||||
const CPressure seaLevelPressure(918.0, CPressureUnit::mbar());
|
||||
const CPressure standardPressure(1013.2, CPressureUnit::mbar());
|
||||
const CPressure delta = (standardPressure - seaLevelPressure);
|
||||
const double expected = 95.2;
|
||||
const double deltaV = delta.value(CPressureUnit::mbar());
|
||||
QCOMPARE(deltaV, expected);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace BlackMiscTest
|
||||
//! Testing angles (degrees / radians)
|
||||
void angleTests();
|
||||
|
||||
//! Testing angles
|
||||
//! Testing mass
|
||||
void massTests();
|
||||
|
||||
//! Testing pressure
|
||||
@@ -69,9 +69,7 @@ namespace BlackMiscTest
|
||||
|
||||
//! Basic arithmetic such as +/-
|
||||
void basicArithmetic();
|
||||
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
//! \endcond
|
||||
|
||||
Reference in New Issue
Block a user