18using namespace swift::misc::aviation;
19using namespace swift::misc::geo;
20using namespace swift::misc::physical_quantities;
21using namespace swift::misc::math;
22using namespace swift::misc::simulation;
34 static void pbhInterpolatorTestHeading0To120();
37 static void pbhInterpolatorTestHeadingM90To30();
40 static void pbhInterpolatorTestHeadingM90To170();
43 static void pbhInterpolatorTestBank270To30();
46 static void pbhInterpolatorTestBank170To190();
49 static void pbhInterpolatorTestPitch30ToM30();
52 static void pbhInterpolatorTestPitchM30To30();
55 static constexpr const int m_steps = 10;
56 static constexpr const double m_tfStep = 1.0 / m_steps;
59 void CTestInterpolatorLinearPbh::pbhInterpolatorTestHeading0To120()
63 CInterpolatorLinearPbh pbh(s1, s2);
67 for (
int i = 0; i <= m_steps; i++)
69 pbh.setTimeFraction(m_tfStep * i);
76 else if (i == m_steps)
82 QVERIFY2(h > lastDeg,
"Expect increasing heading");
88 void CTestInterpolatorLinearPbh::pbhInterpolatorTestHeadingM90To30()
92 CInterpolatorLinearPbh pbh(s1, s2);
96 for (
int i = 0; i <= m_steps; i++)
98 pbh.setTimeFraction(m_tfStep * i);
105 else if (i == m_steps)
111 QVERIFY2(h > lastDeg,
"Expect increasing heading");
117 void CTestInterpolatorLinearPbh::pbhInterpolatorTestHeadingM90To170()
121 CInterpolatorLinearPbh pbh(s1, s2);
125 for (
int i = 0; i <= m_steps; i++)
127 pbh.setTimeFraction(m_tfStep * i);
134 else if (i == m_steps)
140 QVERIFY2(h < lastDeg,
"Expect decreasing heading");
146 void CTestInterpolatorLinearPbh::pbhInterpolatorTestBank270To30()
148 CAircraftSituation s1({}, CHeading {}, {}, CAngle(270,
CAngleUnit::deg()));
149 CAircraftSituation s2({}, CHeading {}, {}, CAngle(30,
CAngleUnit::deg()));
150 CInterpolatorLinearPbh pbh(s1, s2);
154 for (
int i = 0; i <= m_steps; i++)
156 pbh.setTimeFraction(m_tfStep * i);
163 else if (i == m_steps)
169 QVERIFY2(b > lastDeg,
"Expect increasing bank");
175 void CTestInterpolatorLinearPbh::pbhInterpolatorTestBank170To190()
177 CAircraftSituation s1({}, CHeading {}, {}, CAngle(170,
CAngleUnit::deg()));
178 CAircraftSituation s2({}, CHeading {}, {}, CAngle(190,
CAngleUnit::deg()));
179 CInterpolatorLinearPbh pbh(s1, s2);
183 for (
int i = 0; i <= m_steps; i++)
185 pbh.setTimeFraction(m_tfStep * i);
192 else if (i == m_steps)
198 QVERIFY2(b > lastDeg,
"Expect increasing bank");
204 void CTestInterpolatorLinearPbh::pbhInterpolatorTestPitch30ToM30()
208 CInterpolatorLinearPbh pbh(s1, s2);
212 for (
int i = 0; i <= m_steps; i++)
214 pbh.setTimeFraction(m_tfStep * i);
221 else if (i == m_steps)
227 QVERIFY2(p < lastDeg,
"Expect decreasing pitch");
233 void CTestInterpolatorLinearPbh::pbhInterpolatorTestPitchM30To30()
237 CInterpolatorLinearPbh pbh(s1, s2);
241 for (
int i = 0; i <= m_steps; i++)
243 pbh.setTimeFraction(m_tfStep * i);
250 else if (i == m_steps)
256 QVERIFY2(p > lastDeg,
"Expect increasing pitch");
266#include "testinterpolatorlinearpbh.moc"
static double normalizeDegrees360(double degrees, int roundDigits=-1)
Normalize: 0≤ degrees <360.
static CAngleUnit deg()
Degrees.
InterpolatorPBH tests As the PBH interpolator works with time-fractions, the situations are time-inde...
Value object encapsulating information of an aircraft's situation.
Heading as used in aviation, can be true or magnetic heading.
static bool epsilonEqualLimits(double v1, double v2)
Epsilon safe equal.
Free functions in swift::misc.
QVERIFY2(condition, message)
#define SWIFTTEST_MAIN(TestObject)
Implements a main() function that executes all tests in TestObject including instantiating a QCoreApp...