def test_primitive(self):
schema = """
@0xbf5147cbbecf40c1;
struct Point {
x @0 :Int64;
y @1 :Int64;
}
"""
mod = self.compile(schema)
buf = b('\x01\x00\x00\x00\x00\x00\x00\x00' # 1
'\x02\x00\x00\x00\x00\x00\x00\x00') # 2
#
p = mod.Point(1, 2)
assert p.x == 1
assert p.y == 2
assert p._seg.buf == buf
#
p = mod.Point(y=2, x=1)
assert p.x == 1
assert p.y == 2
assert p._seg.buf == buf
评论列表
文章目录