def test_bin_parser_from_cfg_tools(data_dir, ref_dcd_obj): with open(os.path.join(data_dir, 'dcd.bin'), 'rb') as f: dcd_data = f.read() dcd_obj = SegDCD.parse(dcd_data) # compare with reference DCD assert dcd_obj == ref_dcd_obj
def dcd_from_bin() -> SegDCD: """Create DCD from binary data (from binary file).""" # fmt: off data = bytes([ 0xd2, 0x00, 0xb4, 0x41, 0xcc, 0x00, 0x24, 0x04, 0x30, 0x34, 0x00, 0x04, 0x4f, 0x40, 0x00, 0x05, 0x30, 0x34, 0x00, 0x04, 0x4f, 0x40, 0x00, 0x05, 0x30, 0x34, 0x00, 0x04, 0x4f, 0x40, 0x00, 0x05, 0x30, 0x34, 0x00, 0x04, 0x4f, 0x40, 0x00, 0x05, 0xcc, 0x00, 0x0c, 0x14, 0x30, 0x79, 0x00, 0xc4, 0x00, 0x00, 0x00, 0x01, 0xcc, 0x00, 0x0c, 0x1c, 0x30, 0x79, 0x00, 0xc4, 0x00, 0x00, 0x00, 0x01, 0xcf, 0x00, 0x0c, 0x04, 0x30, 0x79, 0x00, 0xc4, 0x00, 0x00, 0x00, 0x01, 0xcf, 0x00, 0x10, 0x04, 0x30, 0x79, 0x00, 0xc4, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x05, 0xcf, 0x00, 0x0c, 0x14, 0x30, 0x79, 0x00, 0xc4, 0x00, 0x00, 0x00, 0x01, 0xcf, 0x00, 0x10, 0x14, 0x30, 0x79, 0x00, 0xc4, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x05, 0xcf, 0x00, 0x0c, 0x0c, 0x30, 0x79, 0x00, 0xc4, 0x00, 0x00, 0x00, 0x01, 0xcf, 0x00, 0x10, 0x0c, 0x30, 0x79, 0x00, 0xc4, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x05, 0xcf, 0x00, 0x0c, 0x1c, 0x30, 0x79, 0x00, 0xc4, 0x00, 0x00, 0x00, 0x01, 0xcf, 0x00, 0x10, 0x1c, 0x30, 0x79, 0x00, 0xc4, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x05, 0xc0, 0x00, 0x04, 0x00, ]) # fmt: on return SegDCD.parse(data)