def test_list_of_lists(self):
schema = """
@0xbf5147cbbecf40c1;
struct Foo {
x @0 :List(List(Int8));
}
"""
mod = self.compile(schema)
foo = mod.Foo([[1, 2, 3], [4, 5], [6, 7, 8, 9]])
expected = b('\x01\x00\x00\x00\x1e\x00\x00\x00' # list<ptr> (3 items)
'\x09\x00\x00\x00\x1a\x00\x00\x00' # list<8> (3 items)
'\x09\x00\x00\x00\x12\x00\x00\x00' # list<8> (2 items)
'\x09\x00\x00\x00\x22\x00\x00\x00' # list<8> (4 items)
'\x01\x02\x03\x00\x00\x00\x00\x00'
'\x04\x05\x00\x00\x00\x00\x00\x00'
'\x06\x07\x08\x09\x00\x00\x00\x00')
assert foo._seg.buf == expected
评论列表
文章目录