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

Function testFrameContents

tests/hdlc_codec_test.cpp:70–101  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68}
69
70void testFrameContents()
71{
72 lm::packet pkt("W5XD", "APRS", {}, ">Hello world");
73 auto nrzi = makeNrziBitstream(pkt);
74
75 HdlcCodec codec;
76 bool gotFrame = false;
77 for (uint8_t bit : nrzi) {
78 if (codec.processBit(bit)) {
79 gotFrame = true;
80 break;
81 }
82 }
83
84 report("frame contents: complete flag set", gotFrame && codec.complete());
85 report("frame contents: FCS valid", codec.fcsValid());
86 report("frame contents: at least 15 bytes", codec.frameSize() >= 15);
87
88 // Verify via libmodem's AX.25 parser (passing frame without last 2 FCS bytes)
89 if (codec.fcsValid() && codec.frameSize() >= 2) {
90 lm::packet decoded;
91 bool ok = lm::ax25::try_decode_frame_no_fcs(
92 std::span<const uint8_t>(codec.frameData(), codec.frameSize() - 2),
93 decoded);
94 report("frame contents: libmodem parses callsigns", ok && decoded.from == "W5XD");
95 report("frame contents: libmodem parses data",
96 ok && decoded.data == ">Hello world");
97 } else {
98 report("frame contents: libmodem parses callsigns", false);
99 report("frame contents: libmodem parses data", false);
100 }
101}
102
103void testFcsMatchesLibmodem()
104{

Callers 1

mainFunction · 0.85

Calls 7

makeNrziBitstreamFunction · 0.85
completeMethod · 0.80
fcsValidMethod · 0.80
frameSizeMethod · 0.80
frameDataMethod · 0.80
reportFunction · 0.70
processBitMethod · 0.45

Tested by

no test coverage detected