@pytest.mark.parametrize('var_name,data,raw_value', (('VarMux1', bytearray([1, 12, 0, 0, 0, 0, 0, 0]), 12), ('VarMux2', bytearray([2, 0, 0, 0, 23, 0, 0, 0]), 23), ('VarMux200', bytearray([200, 0, 0, 0, 0, 0, 34, 0]), 34)))
def test_mux_decode(var_name, data, raw_value):
    f = io.BytesIO('    FormatVersion=5.0 // Do not edit this line!\n    Title="Types Test"\n\nFormatVersion=5.0 // Do not edit this line!\nTitle="Test Symbols File"\n\n{SENDRECEIVE}\n\n[MuxTestFrame]\nID=002h\nDLC=8\nMux=Mux1 0,8 1 \nVar=VarMux1 unsigned 8,8\n\n[MuxTestFrame]\nDLC=8\nMux=Mux2 0,8 2 \nVar=VarMux2 unsigned 32,8\n\n[MuxTestFrame]\nDLC=8\nMux=Mux200 0,8 C8h\nVar=VarMux200 unsigned 48,8\n    '.encode('utf-8'))
    matrix = canmatrix.formats.sym.load(f)
    assert (matrix.load_errors == [])
    frame = matrix.frame_by_name('MuxTestFrame')
    r = frame.decode(data)
    assert (var_name in r.keys()), 'Signal {}, not decoded. Only : {}'.format(var_name, ','.join((r for r in r.keys())))
    assert (r[var_name].raw_value == raw_value)
@pytest.mark.parametrize('var_name,data,raw_value', (('VarMux1', bytearray([1, 12, 0, 0, 0, 0, 0, 0]), 12), ('VarMux2', bytearray([2, 0, 0, 0, 23, 0, 0, 0]), 23), ('VarMux200', bytearray([200, 0, 0, 0, 0, 0, 34, 0]), 34)))
def test_mux_decode(var_name, data, raw_value):
    f = io.BytesIO('    FormatVersion=5.0 // Do not edit this line!\n    Title="Types Test"\n\nFormatVersion=5.0 // Do not edit this line!\nTitle="Test Symbols File"\n\n{SENDRECEIVE}\n\n[MuxTestFrame]\nID=002h\nDLC=8\nMux=Mux1 0,8 1 \nVar=VarMux1 unsigned 8,8\n\n[MuxTestFrame]\nDLC=8\nMux=Mux2 0,8 2 \nVar=VarMux2 unsigned 32,8\n\n[MuxTestFrame]\nDLC=8\nMux=Mux200 0,8 C8h\nVar=VarMux200 unsigned 48,8\n    '.encode('utf-8'))
    matrix = canmatrix.formats.sym.load(f)
    assert (matrix.load_errors == [])
    frame = matrix.frame_by_name('MuxTestFrame')
    r = frame.decode(data)
    assert (var_name in r.keys()), 'Signal {}, not decoded. Only : {}'.format(var_name, ','.join((r for r in r.keys())))
    assert (r[var_name].raw_value == raw_value)