18 using namespace swift::misc::aviation;
19 using namespace swift::misc::simulation;
20 using namespace swift::misc::physical_quantities;
31 void propertyIndexCSimulatedAircraft();
34 void propertyIndexSort();
37 void CTestPropertyIndex::propertyIndexCSimulatedAircraft()
39 const CFrequency f(123.50, CFrequencyUnit::MHz());
40 const CPropertyIndex i({ CSimulatedAircraft::IndexCom1System, CComSystem::IndexActiveFrequency });
43 aircraft.setCom1ActiveFrequency(f);
46 QVERIFY2(pf == f,
"Frequencies should have same value");
49 void CTestPropertyIndex::propertyIndexSort()
62 const int vrefCs = cs1.asString().compare(cs2.asString());
63 int v1 = cs1.comparePropertyByIndex(indexCs, cs2);
64 int v2 = cs2.comparePropertyByIndex(indexCs, cs1);
65 int v3 = cs1.comparePropertyByIndex(indexCs, cs1);
66 int v11 = indexCs.comparator()(cs1, cs2);
67 int v22 = indexCs.comparator()(cs2, cs1);
68 int v33 = indexCs.comparator()(cs1, cs1);
69 QVERIFY(v1 == v11 && v1 < 0 && vrefCs == v1);
70 QVERIFY(v2 == v22 && v2 > 0);
71 QVERIFY(v3 == v33 && v3 == 0);
73 QVERIFY(callsigns.
front().equalsString(
"DLH3000"));
76 s1.setMSecsSinceEpoch(4000);
78 s2.setMSecsSinceEpoch(3000);
80 s3.setMSecsSinceEpoch(2000);
82 s4.setMSecsSinceEpoch(1000);
93 int vrefTs = Compare::compare(s2.getUtcTimestamp(), s1.getUtcTimestamp());
94 int v4 = s2.comparePropertyByIndex(index, s1);
95 int v5 = s1.comparePropertyByIndex(index, s2);
96 int v6 = s3.comparePropertyByIndex(index, s3);
98 int v44 = index.comparator()(s2, s1);
99 int v55 = index.comparator()(s1, s2);
100 int v66 = index.comparator()(s3, s3);
102 QVERIFY(v4 == v44 && v1 < 0 && v4 == vrefTs);
103 QVERIFY(v5 == v55 && v2 > 0);
104 QVERIFY(v6 == v66 && v3 == 0);
114 #include "testpropertyindex.moc"
Testing property index access.
Value object encapsulating a list of property indexes.
Generic sequential container with value semantics.
void push_back(const T &value)
Appends an element at the end of the sequence.
reference front()
Access the first element.
reference back()
Access the last element.
Streamable status message, e.g.
constexpr static auto SeverityDebug
Status severities.
constexpr static auto SeverityError
Status severities.
constexpr static auto SeverityInfo
Status severities.
constexpr static auto SeverityWarning
Status severities.
Status messages, e.g. from Core -> GUI.
Wrapper around QVariant which provides transparent access to CValueObject methods of the contained ob...
T value() const
Return the value converted to the type T.
QVariant propertyByIndex(swift::misc::CPropertyIndexRef index) const
Property by index.
qint64 getMSecsSinceEpoch() const
Timestamp as ms value.
Value object encapsulating information of a callsign.
Comprehensive information of an aircraft.
void setCallsign(const aviation::CCallsign &callsign)
Set callsign.
Free functions in swift::misc.
SWIFTTEST_APPLESS_MAIN(MiscTest::CTestPropertyIndex)
main