Beispiel #1
0
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
Beispiel #2
0
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
Beispiel #3
0
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
Beispiel #4
0
def test_checksum_mode_disabled():

    packet = Packet.sync(checksum_mode=ChecksumMode.Disabled, )

    assert packet.checksum == 0
Beispiel #5
0
def test_checksum_mode_enabled():

    packet = Packet.sync(checksum_mode=ChecksumMode.Enabled, )

    assert packet.checksum == 0x2A20054
Beispiel #6
0
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
Beispiel #7
0
def test_is_duplicate_sync():

    packet = Packet.sync(checksum_mode=ChecksumMode.Disabled, )

    assert not packet.is_duplicate
Beispiel #8
0
def test_transfer_mode_sync():

    packet = Packet.sync(checksum_mode=ChecksumMode.Disabled, )

    assert packet.transfer_mode is TransferMode.AckEveryPacket
    assert packet.is_ack_needed
Beispiel #9
0
def test_message_type_sync():

    packet = Packet.sync(checksum_mode=ChecksumMode.Disabled, )

    assert packet.message_type is MessageType.Data