18using namespace swift::misc::aviation;
19using namespace swift::misc::simulation;
20using namespace swift::misc::physical_quantities;
31 void propertyIndexCSimulatedAircraft();
34 void propertyIndexSort();
37 void CTestPropertyIndex::propertyIndexCSimulatedAircraft()
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()
51 CCallsign cs1(
"DLH1000");
52 CCallsign cs2(
"DLH2000");
53 CCallsign cs3(
"DLH3000");
54 CSequence<CCallsign> callsigns;
59 const CPropertyIndex indexCs(CCallsign::IndexCallsignString);
60 const CPropertyIndexList indexListCs({ indexCs });
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);
76 s1.setMSecsSinceEpoch(4000);
78 s2.setMSecsSinceEpoch(3000);
80 s3.setMSecsSinceEpoch(2000);
82 s4.setMSecsSinceEpoch(1000);
84 CStatusMessageList msgs;
90 const CPropertyIndex index(CStatusMessage::IndexUtcTimestamp);
91 const CPropertyIndexList indexList({ index });
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);
114#include "testpropertyindex.moc"
static CFrequencyUnit MHz()
Megahertz.
Testing property index access.
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.
static constexpr auto SeverityInfo
Status severities.
static constexpr auto SeverityError
Status severities.
static constexpr auto SeverityDebug
Status severities.
static constexpr auto SeverityWarning
Status severities.
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.
Comprehensive information of an aircraft.
void setCallsign(const aviation::CCallsign &callsign)
Set callsign.
Free functions in swift::misc.
#define SWIFTTEST_APPLESS_MAIN(TestObject)
Implements a main() function that executes all tests in TestObject without instantiating a QApplicati...