From: Robin Krens Date: Sat, 10 Feb 2024 13:43:38 +0000 (+0100) Subject: test: added test for unpack packets X-Git-Tag: v0.0.1~52 X-Git-Url: https://robinkrens.nl/gitweb/?a=commitdiff_plain;h=48527dafe9e6df1ac0c4c0a93feaf386da7fa6a4;hp=e3f9ceea84c52e5dbbccde147151efa8e10fa054;p=renesas-ra-flasher test: added test for unpack packets --- diff --git a/tests/test_parse.py b/tests/test_parse.py index d83e629..df324bf 100644 --- a/tests/test_parse.py +++ b/tests/test_parse.py @@ -1,4 +1,4 @@ -from flasher.flasher import calc_sum +from flasher.flasher import calc_sum, unpack_pkt import pytest def test_calc_sum(): @@ -6,3 +6,8 @@ def test_calc_sum(): assert calc_sum(0x34, ['0x00']) == (0, 0x2, 0xCA) assert calc_sum(0x00, ['0x00']) == (0, 0x02, 0xFE) +def test_unpack(): + assert unpack_pkt(b'\x81\x00\x02\x00\x00\xFE\x03') == ['0x00'] + assert unpack_pkt(b'\x81\x00\x02\x12\x00\xEC\x03') == ['0x00'] + assert unpack_pkt(b'\x81\x00\x02\x13\x00\xEB\x03') == ['0x00'] +