예제 #1
0
def test_encode(multizmq_io_obj):
    chip_id = 64
    io_chain = 1
    io_group = list(multizmq_io_obj._io_group_table)[0]
    test_packet = Packet(b'\x00\x01\x02\x03\x04\x05\x06')
    test_packet.io_group = io_group
    test_packet.io_channel = io_chain
    test_bytes = b'0x0006050403020100 1'
    expected = [test_bytes]
    assert multizmq_io_obj.encode([test_packet]) == expected
예제 #2
0
def test_decode(multizmq_io_obj):
    chip_id = 64
    io_chain = 1
    io_group = list(multizmq_io_obj._io_group_table)[0]
    address = str(multizmq_io_obj._io_group_table[io_group])
    test_packet = Packet(b'\x00\x01\x02\x03\x04\x05\x06')
    test_packet.io_group = io_group
    test_packet.io_channel = io_chain
    test_bytes = dataserver_message_encode([test_packet])
    expected = [test_packet]
    assert multizmq_io_obj.decode(test_bytes, address=address) == expected
예제 #3
0
def test_encode(multizmq_io_obj):
    chip_id = 64
    io_chain = 1
    io_group = list(multizmq_io_obj._io_group_table)[0]
    test_packet = Packet(b'\x01' * Packet.num_bytes)
    test_packet.io_group = io_group
    test_packet.io_channel = io_chain
    test_bytes = b'0x0101010101010101 1'
    if Packet == Packet_v1:
        test_bytes = b'0x0001010101010101 1'
    expected = [test_bytes]
    assert multizmq_io_obj.encode([test_packet]) == expected