test: 对象化前的最后稳定版本
- OopInheritTest 全部类补类体字段声明(x/y/r/w/h/health/battery 等), 保证父类字段展平与 GEP 偏移正确 - 多个测试适配 i8* 指针比较语义(== 指针地址比较改 string.strcmp) - 删除 ZlibTest/__zlib 旧实现与 find.py 调试脚本 - 更新 TODO 与 TestProject
This commit is contained in:
1 parent
cd1f662e17
commit
e1cb560df0
23 files changed
+151
-3265
No files matched your search
@@ -24,7 +24,7 @@ def test_type_print(pool: memhub.MemPool | t.CPtr):
|
||||
ty_i32: llvmlite.LLVMType | t.CPtr = core.Int32()
|
||||
buf[0] = 0
|
||||
core.PrintType(buf, 64, ty_i32)
|
||||
testcheck.check(buf == "i32",
|
||||
testcheck.check(string.strcmp(buf, "i32") == 0,
|
||||
"Int32 -> i32",
|
||||
"Int32 fail")
|
||||
|
||||
@@ -32,7 +32,7 @@ def test_type_print(pool: memhub.MemPool | t.CPtr):
|
||||
ty_ptr: llvmlite.LLVMType | t.CPtr = core.Ptr(ty_i32)
|
||||
buf[0] = 0
|
||||
core.PrintType(buf, 64, ty_ptr)
|
||||
testcheck.check(buf == "i32*",
|
||||
testcheck.check(string.strcmp(buf, "i32*") == 0,
|
||||
"Ptr(Int32) -> i32*",
|
||||
"Ptr fail")
|
||||
|
||||
@@ -40,7 +40,7 @@ def test_type_print(pool: memhub.MemPool | t.CPtr):
|
||||
ty_void: llvmlite.LLVMType | t.CPtr = core.Void()
|
||||
buf[0] = 0
|
||||
core.PrintType(buf, 64, ty_void)
|
||||
testcheck.check(buf == "void",
|
||||
testcheck.check(string.strcmp(buf, "void") == 0,
|
||||
"Void -> void",
|
||||
"Void fail")
|
||||
|
||||
@@ -48,7 +48,7 @@ def test_type_print(pool: memhub.MemPool | t.CPtr):
|
||||
ty_i64: llvmlite.LLVMType | t.CPtr = core.Int64()
|
||||
buf[0] = 0
|
||||
core.PrintType(buf, 64, ty_i64)
|
||||
testcheck.check(buf == "i64",
|
||||
testcheck.check(string.strcmp(buf, "i64") == 0,
|
||||
"Int64 -> i64",
|
||||
"Int64 fail")
|
||||
|
||||
@@ -68,7 +68,7 @@ def test_value_print(pool: memhub.MemPool | t.CPtr):
|
||||
val42: llvmlite.Value | t.CPtr = mcore.ConstInt32(42)
|
||||
buf[0] = 0
|
||||
mcore.PrintValue(buf, 64, val42)
|
||||
testcheck.check(buf == "i32 42",
|
||||
testcheck.check(string.strcmp(buf, "i32 42") == 0,
|
||||
"ConstInt(42) -> i32 42",
|
||||
"ConstInt fail")
|
||||
|
||||
@@ -78,7 +78,7 @@ def test_value_print(pool: memhub.MemPool | t.CPtr):
|
||||
val_ssa: llvmlite.Value | t.CPtr = mcore.SSAValue(ty_i32, name_ssa)
|
||||
buf[0] = 0
|
||||
mcore.PrintValue(buf, 64, val_ssa)
|
||||
testcheck.check(buf == "i32 %0",
|
||||
testcheck.check(string.strcmp(buf, "i32 %0") == 0,
|
||||
"SSAValue(%0) -> i32 %0",
|
||||
"SSAValue fail")
|
||||
|
||||
@@ -293,7 +293,7 @@ def test_array_type(pool: memhub.MemPool | t.CPtr):
|
||||
ty_arr: llvmlite.LLVMType | t.CPtr = core.Array(ty_i32, 4)
|
||||
buf[0] = 0
|
||||
core.PrintType(buf, 128, ty_arr)
|
||||
testcheck.check(buf == "[4 x i32]",
|
||||
testcheck.check(string.strcmp(buf, "[4 x i32]") == 0,
|
||||
"Array(i32,4) -> [4 x i32]",
|
||||
"Array fail")
|
||||
|
||||
@@ -303,7 +303,7 @@ def test_array_type(pool: memhub.MemPool | t.CPtr):
|
||||
ty_nested: llvmlite.LLVMType | t.CPtr = core.Array(ty_inner, 2)
|
||||
buf[0] = 0
|
||||
core.PrintType(buf, 128, ty_nested)
|
||||
testcheck.check(buf == "[2 x [3 x i8]]",
|
||||
testcheck.check(string.strcmp(buf, "[2 x [3 x i8]]") == 0,
|
||||
"nested array -> [2 x [3 x i8]]",
|
||||
"nested array fail")
|
||||
|
||||
@@ -328,7 +328,7 @@ def test_struct_type(pool: memhub.MemPool | t.CPtr):
|
||||
ty_struct: llvmlite.LLVMType | t.CPtr = core.Struct(head, 2)
|
||||
buf[0] = 0
|
||||
core.PrintType(buf, 128, ty_struct)
|
||||
testcheck.check(buf == "{i32, i8*}",
|
||||
testcheck.check(string.strcmp(buf, "{i32, i8*}") == 0,
|
||||
"struct {i32, i8*}",
|
||||
"struct fail")
|
||||
|
||||
@@ -336,7 +336,7 @@ def test_struct_type(pool: memhub.MemPool | t.CPtr):
|
||||
ty_empty: llvmlite.LLVMType | t.CPtr = core.Struct(None, 0)
|
||||
buf[0] = 0
|
||||
core.PrintType(buf, 128, ty_empty)
|
||||
testcheck.check(buf == "{}",
|
||||
testcheck.check(string.strcmp(buf, "{}") == 0,
|
||||
"empty struct -> {}",
|
||||
"empty struct fail")
|
||||
|
||||
@@ -361,7 +361,7 @@ def test_func_type(pool: memhub.MemPool | t.CPtr):
|
||||
ty_func: llvmlite.LLVMType | t.CPtr = core.Func(ty_i32, head, 2)
|
||||
buf[0] = 0
|
||||
core.PrintType(buf, 128, ty_func)
|
||||
testcheck.check(buf == "i32 (i32, i8*)",
|
||||
testcheck.check(string.strcmp(buf, "i32 (i32, i8*)") == 0,
|
||||
"func type -> i32 (i32, i8*)",
|
||||
"func type fail")
|
||||
|
||||
@@ -370,7 +370,7 @@ def test_func_type(pool: memhub.MemPool | t.CPtr):
|
||||
ty_func_void: llvmlite.LLVMType | t.CPtr = core.Func(ty_void, None, 0)
|
||||
buf[0] = 0
|
||||
core.PrintType(buf, 128, ty_func_void)
|
||||
testcheck.check(buf == "void ()",
|
||||
testcheck.check(string.strcmp(buf, "void ()") == 0,
|
||||
"void func -> void ()",
|
||||
"void func fail")
|
||||
|
||||
@@ -431,7 +431,7 @@ def test_float_types(pool: memhub.MemPool | t.CPtr):
|
||||
ty_half: llvmlite.LLVMType | t.CPtr = core.Half()
|
||||
buf[0] = 0
|
||||
core.PrintType(buf, 128, ty_half)
|
||||
testcheck.check(buf == "half",
|
||||
testcheck.check(string.strcmp(buf, "half") == 0,
|
||||
"Half -> half",
|
||||
"Half fail")
|
||||
|
||||
@@ -439,7 +439,7 @@ def test_float_types(pool: memhub.MemPool | t.CPtr):
|
||||
ty_float: llvmlite.LLVMType | t.CPtr = core.Float()
|
||||
buf[0] = 0
|
||||
core.PrintType(buf, 128, ty_float)
|
||||
testcheck.check(buf == "float",
|
||||
testcheck.check(string.strcmp(buf, "float") == 0,
|
||||
"Float -> float",
|
||||
"Float fail")
|
||||
|
||||
@@ -447,7 +447,7 @@ def test_float_types(pool: memhub.MemPool | t.CPtr):
|
||||
ty_double: llvmlite.LLVMType | t.CPtr = core.Double()
|
||||
buf[0] = 0
|
||||
core.PrintType(buf, 128, ty_double)
|
||||
testcheck.check(buf == "double",
|
||||
testcheck.check(string.strcmp(buf, "double") == 0,
|
||||
"Double -> double",
|
||||
"Double fail")
|
||||
|
||||
@@ -455,7 +455,7 @@ def test_float_types(pool: memhub.MemPool | t.CPtr):
|
||||
ty_fp128: llvmlite.LLVMType | t.CPtr = core.FP128()
|
||||
buf[0] = 0
|
||||
core.PrintType(buf, 128, ty_fp128)
|
||||
testcheck.check(buf == "fp128",
|
||||
testcheck.check(string.strcmp(buf, "fp128") == 0,
|
||||
"FP128 -> fp128",
|
||||
"FP128 fail")
|
||||
|
||||
|
||||
Reference in new issue
Block a user