chore(test): 迁移测试夹具到新语法
机械规则 R2/R3/R4/R6/R7/R8/R13 + R16 保守子集,共 86 文件 2127 行。R1(T | t.CPtr)与 R12(while 下标循环)未做,仍列为待办。全量 77/77 顺序回归通过。
This commit is contained in:
1 parent
c9d741c202
commit
f5da836fbb
86 files changed
+2121
-2121
No files matched your search
@@ -15,7 +15,7 @@ import syslibtest_impl
|
||||
|
||||
|
||||
# MBuddy arena 大小:1MB
|
||||
ARENA_SIZE: t.CDefine = 1048576
|
||||
define ARENA_SIZE = 1048576
|
||||
|
||||
|
||||
def main() -> CInt | CExport:
|
||||
|
||||
@@ -32,7 +32,7 @@ def os_isdir(path: str) -> bool:
|
||||
return os._posix.isdir(path)
|
||||
|
||||
|
||||
def os_getsize(path: str) -> t.CInt64T:
|
||||
def os_getsize(path: str) -> int64:
|
||||
"""返回文件大小(字节,跨平台)。失败返回 -1。"""
|
||||
if platmacro.IS_WINDOWS:
|
||||
return os._win32.getsize(path)
|
||||
|
||||
@@ -19,11 +19,11 @@ import w32.win32process
|
||||
|
||||
|
||||
# 测试用临时文件/目录名前缀
|
||||
TEST_DIR: t.CDefine = "__sylibtest_dir__"
|
||||
TEST_FILE: t.CDefine = "__sylibtest_file.txt"
|
||||
TEST_COPY: t.CDefine = "__sylibtest_copy.txt"
|
||||
TEST_TREE: t.CDefine = "__sylibtest_tree__"
|
||||
TEST_MOVE: t.CDefine = "__sylibtest_moved.txt"
|
||||
define TEST_DIR = "__sylibtest_dir__"
|
||||
define TEST_FILE = "__sylibtest_file.txt"
|
||||
define TEST_COPY = "__sylibtest_copy.txt"
|
||||
define TEST_TREE = "__sylibtest_tree__"
|
||||
define TEST_MOVE = "__sylibtest_moved.txt"
|
||||
|
||||
|
||||
# =============================================================================
|
||||
@@ -128,7 +128,7 @@ def run() -> CInt:
|
||||
testcheck.section("os.path 路径操作")
|
||||
|
||||
# sep
|
||||
sep_char: t.CChar = os.path.sep()
|
||||
sep_char: char = os.path.sep()
|
||||
viperlib.snprintf(buf, 512, "sep = %c", sep_char)
|
||||
testcheck.info(buf)
|
||||
|
||||
@@ -198,8 +198,8 @@ def run() -> CInt:
|
||||
testcheck.check(os_backend.os_exists(TEST_COPY), "copyfile: dst exists OK", "copyfile: dst not exists")
|
||||
|
||||
# 验证拷贝内容一致(检查文件大小)
|
||||
src_size: t.CInt64T = os_backend.os_getsize(TEST_FILE)
|
||||
dst_size: t.CInt64T = os_backend.os_getsize(TEST_COPY)
|
||||
src_size: int64 = os_backend.os_getsize(TEST_FILE)
|
||||
dst_size: int64 = os_backend.os_getsize(TEST_COPY)
|
||||
viperlib.snprintf(buf, 512, "src_size=%lld dst_size=%lld", src_size, dst_size)
|
||||
testcheck.info(buf)
|
||||
testcheck.check(src_size == dst_size, "copyfile: same size OK", "copyfile: size mismatch")
|
||||
|
||||
Reference in new issue
Block a user