shramov/tll

Add the support of bit fields in Yaml channel

fdenis1983 opened this issue · 0 comments

The following test is supposed to pass; however, it doesn't.

def test_bits():
    scheme =  """yamls://
- name:
  bits:
    i8: {type: int8, options.type: bits, bits: [a, {name: b, offset: 2, size: 1}, c]}
- name: msg
  id: 10
  fields:
    - {name: f1, type: i8}
"""
    url = Config.load(f'''yamls://
tll.proto: yaml
name: yaml
dump: scheme
config.0:
  name: msg
  data:
    f1: c
''')
    url['scheme'] = scheme
    c = Accum(url)
    c.open()
    c.process()
    assert [(m.msgid, m.seq) for m in c.result] == [(10, 0)]
    m = c.unpack(c.result[0])
    assert m.f1.c == True
tll/channel/channel.pyx:296: TLLError
------------------------------------------------------------------------------------------------------------- Captured log call --------------------------------------------------------------------------------------------------------------
ERROR    tll.channel.yaml:test_yaml.py:127 Invalid string 'c': Invalid digit: c
ERROR    tll.channel.yaml:test_yaml.py:127 Failed to fill field f1
ERROR    tll.channel.yaml:test_yaml.py:127 Failed to fill message 0
ERROR    tll.channel.yaml:test_yaml.py:127 Process failed