def test_fragment_sync(): packet = Packet.sync(checksum_mode=ChecksumMode.Disabled, ) assert packet.fragment_amount == 1 assert packet.fragment_number == 0 assert packet.is_single assert packet.is_last
def test_sync(): packet = Packet.sync(checksum_mode=ChecksumMode.Disabled, ) assert packet.is_sync assert packet.type == 'sync' assert not packet.is_ack assert not packet.is_data
def test_encode_decode_sync_checksum_mode_disabled(): encoded = Packet.sync(checksum_mode=ChecksumMode.Disabled, ) encoded_bytes = bytes(encoded) decoded = Packet.from_bytes(encoded_bytes) decoded_bytes = decoded.as_bytes assert encoded_bytes == decoded_bytes
def test_checksum_mode_disabled(): packet = Packet.sync(checksum_mode=ChecksumMode.Disabled, ) assert packet.checksum == 0
def test_checksum_mode_enabled(): packet = Packet.sync(checksum_mode=ChecksumMode.Enabled, ) assert packet.checksum == 0x2A20054
def test_message_id_and_data_length_sync(): packet = Packet.sync(checksum_mode=ChecksumMode.Disabled, ) assert packet.message_id == 0 assert packet.message_data_length == 0
def test_is_duplicate_sync(): packet = Packet.sync(checksum_mode=ChecksumMode.Disabled, ) assert not packet.is_duplicate
def test_transfer_mode_sync(): packet = Packet.sync(checksum_mode=ChecksumMode.Disabled, ) assert packet.transfer_mode is TransferMode.AckEveryPacket assert packet.is_ack_needed
def test_message_type_sync(): packet = Packet.sync(checksum_mode=ChecksumMode.Disabled, ) assert packet.message_type is MessageType.Data