test(dfu): cover retry failures and sequence wrap cases

This commit is contained in:
2026-03-04 18:09:48 +01:00
parent 2ac68e09ab
commit bdcd200a62
2 changed files with 90 additions and 9 deletions

View File

@ -67,6 +67,19 @@ void main() {
expect(frames[1].bytes.length, universalShifterDfuFrameSizeBytes);
expect(frames[1].bytes.sublist(1, 18), image.sublist(63, 80));
});
test('uses deterministic wrapping sequence numbers from custom start', () {
final image = List<int>.generate(
3 * universalShifterDfuFramePayloadSizeBytes,
(index) => index & 0xFF);
final frames = DfuProtocol.buildDataFrames(image, startSequence: 0xFE);
expect(frames.length, 3);
expect(frames[0].sequence, 0xFE);
expect(frames[1].sequence, 0xFF);
expect(frames[2].sequence, 0x00);
});
});
group('DfuProtocol sequence and ACK helpers', () {