Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 4
0
def test_checksum_mode_disabled():

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

    assert packet.checksum == 0
Ejemplo n.º 5
0
def test_checksum_mode_enabled():

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

    assert packet.checksum == 0x2A20054
Ejemplo n.º 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
Ejemplo n.º 7
0
def test_is_duplicate_sync():

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

    assert not packet.is_duplicate
Ejemplo n.º 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
Ejemplo n.º 9
0
def test_message_type_sync():

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

    assert packet.message_type is MessageType.Data