mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-30 11:55:35 +08:00
COM frequency rounding + testcase
This commit is contained in:
@@ -59,6 +59,9 @@ namespace BlackMiscTest
|
||||
//! COM and NAV units
|
||||
void comAndNav();
|
||||
|
||||
//! COM frequency rounding
|
||||
void comFrequencyRounding();
|
||||
|
||||
//! Transponder
|
||||
void transponder();
|
||||
|
||||
@@ -108,6 +111,25 @@ namespace BlackMiscTest
|
||||
QVERIFY2(!CNavSystem::isValidCivilNavigationFrequency(CFrequency(200.0, CFrequencyUnit::MHz())), "Expect invalid nav frequency");
|
||||
}
|
||||
|
||||
void CTestAviation::comFrequencyRounding()
|
||||
{
|
||||
const CFrequency f1 = CFrequency(122.8, CFrequencyUnit::MHz());
|
||||
const CFrequency f2 = CFrequency(122.795, CFrequencyUnit::MHz());
|
||||
const CFrequency f3 = CFrequency(122.805, CFrequencyUnit::MHz());
|
||||
|
||||
QVERIFY2(f1 == f1, "Ups, how can this fail");
|
||||
QVERIFY2(f1 != f2, "Ups, how can this fail");
|
||||
QVERIFY2(f1 != f3, "Ups, how can this fail");
|
||||
|
||||
CFrequency up(f2);
|
||||
CComSystem::roundToChannelSpacing(up, CComSystem::ChannelSpacing25KHz);
|
||||
QVERIFY2(up == f1, "Expect rounding up");
|
||||
|
||||
CFrequency down(f3);
|
||||
CComSystem::roundToChannelSpacing(down, CComSystem::ChannelSpacing25KHz);
|
||||
QVERIFY2(down == f1, "Expect rounding up");
|
||||
}
|
||||
|
||||
void CTestAviation::transponder()
|
||||
{
|
||||
CTransponder t1 = CTransponder::getStandardTransponder(7000, CTransponder::StateStandby);
|
||||
|
||||
Reference in New Issue
Block a user