From d96c9f7850f6447052d9c979e3044cd19bed5c35 Mon Sep 17 00:00:00 2001 From: Stuart Longland Date: Sat, 1 Apr 2023 19:48:06 +1000 Subject: [PATCH] issue #17: frame: Add unit tests for emitting SABM(E) --- tests/test_frame/test_uframe.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tests/test_frame/test_uframe.py b/tests/test_frame/test_uframe.py index 7f71850..8eff94e 100644 --- a/tests/test_frame/test_uframe.py +++ b/tests/test_frame/test_uframe.py @@ -345,6 +345,36 @@ def test_encode_pf(): eq_(frame.control, 0x13) +def test_encode_sabm(): + """ + Test we can encode a SABM frame. + """ + frame = AX25SetAsyncBalancedModeFrame( + destination="VK4BWI", source="VK4MSL" + ) + hex_cmp( + bytes(frame), + "ac 96 68 84 ae 92 e0" # Destination + "ac 96 68 9a a6 98 61" # Source + "3f", # Control byte + ) + + +def test_encode_sabme(): + """ + Test we can encode a SABME frame. + """ + frame = AX25SetAsyncBalancedModeExtendedFrame( + destination="VK4BWI", source="VK4MSL" + ) + hex_cmp( + bytes(frame), + "ac 96 68 84 ae 92 e0" # Destination + "ac 96 68 9a a6 98 61" # Source + "7f", # Control byte + ) + + def test_encode_frmr_w(): """ Test we can set the W bit on a FRMR frame.