| 227 | } |
| 228 | |
| 229 | static 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 | |
| 256 | static void testGeoHelpers() |
| 257 | { |
no test coverage detected