4 base
= os
.path
.dirname(__file__
)
5 path
= os
.path
.dirname(base
)
6 sys
.path
.insert(0, path
)
8 sys
.stdout
= open(sys
.argv
[1], "w")
10 import liba
# type: ignore
16 assert crc(text
) == 0x45
17 assert crc(crc
.pack(text
)) == 0
19 crc
= liba
.crc8(0x31, reversed=True)
21 assert crc(text
) == 0x75
22 assert crc(crc
.pack(text
)) == 0
24 crc
= liba
.crc16(0x1021)
26 assert crc(text
) == 0x9C58
27 assert crc(crc
.pack(text
)) == 0
29 crc
= liba
.crc16(0x8005, reversed=True)
31 assert crc(text
) == 0x443D
32 assert crc(crc
.pack(text
)) == 0
34 crc
= liba
.crc32(0x1EDC6F41)
36 assert crc(text
) == 0x512B456E
37 assert crc(crc
.pack(text
)) == 0
39 crc
= liba
.crc32(0x04C11DB7, reversed=True)
41 assert crc(text
) == 0x450EAFB0
42 assert crc(crc
.pack(text
)) == 0
44 crc
= liba
.crc64(0x000000000000001B)
46 assert crc(text
) == 0xE4FFBEA588AFC790
47 assert crc(crc
.pack(text
)) == 0
49 crc
= liba
.crc64(0x42F0E1EBA9EA3693, reversed=True)
51 assert crc(text
) == 0xDA60676A5CDE0008
52 assert crc(crc
.pack(text
)) == 0