36 lines
881 B
Python
36 lines
881 B
Python
from stdint import *
|
|
import w32.win32console
|
|
import config
|
|
import hashlib
|
|
import binascii
|
|
import zlib.pyzlib as zp
|
|
|
|
import t, c
|
|
import testcheck
|
|
|
|
|
|
def main() -> t.CInt | t.CExport:
|
|
w32.win32console.SetConsoleCP(65001)
|
|
w32.win32console.SetConsoleOutputCP(65001)
|
|
|
|
testcheck.begin("TestProject2: 综合库测试")
|
|
|
|
testcheck.section("zlib runtime version")
|
|
print(zp.runtime_version())
|
|
testcheck.ok("zlib runtime version printed")
|
|
|
|
testcheck.section("HASHLIB")
|
|
md5_buf: t.CArray[t.CUInt8T, hashlib.MD5_DIGEST_LEN]
|
|
mctx = hashlib.md5()
|
|
mctx.update("hello")
|
|
mctx.final(md5_buf)
|
|
testcheck.ok("HASHLIB md5 completed")
|
|
|
|
testcheck.section("BINASCII")
|
|
binascii.init_binascii()
|
|
crc_val: t.CUnsignedInt = binascii.crc32("hello", 5, 0)
|
|
testcheck.ok("BINASCII crc32 completed")
|
|
|
|
testcheck.info("END")
|
|
return testcheck.end()
|