MCPcopy Create free account
hub / github.com/aethersdr/AetherSDR / testEncoders

Function testEncoders

tests/aprs_packet_test.cpp:229–254  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

227}
228
229static void testEncoders()
230{
231 const QString pos = aprs::encodeUncompressedPosition(
232 49.0583333, -72.0291667, '/', '-', QStringLiteral("Test"), true);
233 CHECK(pos == QStringLiteral("=4903.50N/07201.75W-Test"),
234 "position encoder round-trips the reference vector");
235
236 // Encoder output must parse back to the same coordinates.
237 const auto rt = aprs::parseFrame(makeUiFrame(
238 QStringLiteral("N0CALL"), QStringLiteral("APRS"), pos.toLatin1()));
239 CHECK(rt && rt->hasPosition && rt->messagingCapable,
240 "encoded position parses back");
241 CHECK(rt && near(rt->latitude, 49.0583, 0.001)
242 && near(rt->longitude, -72.0292, 0.001),
243 "round-trip coordinates");
244
245 CHECK(aprs::encodeMessage(QStringLiteral("KH2Z"), QStringLiteral("Testing"),
246 QStringLiteral("3"))
247 == QStringLiteral(":KH2Z :Testing{3"),
248 "message encoder pads addressee to 9");
249 CHECK(aprs::encodeAck(QStringLiteral("WU2Z"), QStringLiteral("003"))
250 == QStringLiteral(":WU2Z :ack003"),
251 "ack encoder");
252 CHECK(aprs::encodeStatus(QStringLiteral("hi")) == QStringLiteral(">hi"),
253 "status encoder");
254}
255
256static void testGeoHelpers()
257{

Callers 1

mainFunction · 0.85

Calls 7

parseFrameFunction · 0.85
encodeMessageFunction · 0.85
encodeAckFunction · 0.85
encodeStatusFunction · 0.85
makeUiFrameFunction · 0.70
nearFunction · 0.70

Tested by

no test coverage detected