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

Function testStateTransitions

tests/hdlc_codec_test.cpp:216–234  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

214}
215
216void testStateTransitions()
217{
218 HdlcCodec codec;
219 report("initial state: searching", codec.searching());
220 report("initial state: not in preamble", !codec.inPreamble());
221 report("initial state: not in frame", !codec.inFrame());
222 report("initial state: not complete", !codec.complete());
223
224 // Feed one preamble flag: 0x7E = 0,1,1,1,1,1,1,0 (NRZ LSB-first)
225 // NRZI encode it starting from level 0.
226 uint8_t level = 0;
227 const uint8_t nrzFlag[8] = {0, 1, 1, 1, 1, 1, 1, 0};
228 for (int i = 0; i < 8; ++i) {
229 if (nrzFlag[i] == 0)
230 level ^= 1;
231 codec.processBit(level);
232 }
233 report("after one flag: in preamble", codec.inPreamble());
234}
235
236void testLongPayload()
237{

Callers 1

mainFunction · 0.85

Calls 6

searchingMethod · 0.80
inPreambleMethod · 0.80
inFrameMethod · 0.80
completeMethod · 0.80
reportFunction · 0.70
processBitMethod · 0.45

Tested by

no test coverage detected