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

Function testTwoConsecutiveFrames

tests/hdlc_codec_test.cpp:164–182  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

162}
163
164void testTwoConsecutiveFrames()
165{
166 lm::packet p1("AA1BB", "APRS", {}, ">First");
167 lm::packet p2("CC3DD", "APRS", {}, ">Second");
168
169 // Encode p1 normally, then encode p2 starting from the NRZI level where
170 // p1 left off. Without this, bs2 starts at level 0 while the codec's
171 // prevNrzi is whatever bs1 ended on, causing mis-decoded first bits.
172 auto bs1 = lm::ax25::encode_bitstream(p1, 5, 2);
173 const uint8_t finalLevel = bs1.empty() ? 0 : bs1.back();
174 auto bs2 = lm::ax25::encode_bitstream(p2, finalLevel, 5, 2);
175
176 HdlcCodec codec;
177 FeedResult r1 = feedBits(codec, bs1);
178 FeedResult r2 = feedBits(codec, bs2);
179
180 report("two frames: first decoded", r1.goodFcs == 1);
181 report("two frames: second decoded", r2.goodFcs == 1);
182}
183
184void testPreambleCount()
185{

Callers 1

mainFunction · 0.85

Calls 2

feedBitsFunction · 0.85
reportFunction · 0.70

Tested by

no test coverage detected