From 48527dafe9e6df1ac0c4c0a93feaf386da7fa6a4 Mon Sep 17 00:00:00 2001 From: Robin Krens Date: Sat, 10 Feb 2024 14:43:38 +0100 Subject: [PATCH] test: added test for unpack packets --- tests/test_parse.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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'] + -- 2.7.4