test: 对象化前的最后稳定版本

- OopInheritTest 全部类补类体字段声明(x/y/r/w/h/health/battery 等), 保证父类字段展平与 GEP 偏移正确
- 多个测试适配 i8* 指针比较语义(== 指针地址比较改 string.strcmp)
- 删除 ZlibTest/__zlib 旧实现与 find.py 调试脚本
- 更新 TODO 与 TestProject
This commit is contained in:
TermiNexus committed 2026-08-09 22:19:29 +08:00
1 parent cd1f662e17
commit e1cb560df0
23 files changed
+151 -3265

No files matched your search

+9 -7
View File
@@ -24,7 +24,7 @@ def test_global_write_no_decl():
# 注意:这里故意不声明 global,测试编译器行为
# 如果 _g_val 在此函数之前被读取过,赋值会修改全局变量
# 如果 _g_val 在此函数中首次被赋值,会创建局部变量
_g_val = 99 # 这应该创建一个局部变量
_g_val: int = 99 # 这应该创建一个局部变量
def test_global_ptr():
global _g_ptr
@@ -41,8 +41,9 @@ def test_global_ptr_no_decl():
# _g_ptr 在 test_global_ptr 中已被赋值(有 global)
# 这里读取 _g_ptr 然后赋值 — 读取会将全局变量加入 Gen.variables
# 所以后续赋值应该修改全局变量
old: t.CUInt32T | t.CPtr = _g_ptr # 读取 -> 加入 Gen.variables
_g_ptr = None # 因为之前读取过,这应该修改全局变量
# TPV 行为改变:读取不会使后续开始修改全局
old: t.CUInt32T | t.CPtr = _g_ptr # 读取 -> 不加入 Gen.variables
_g_ptr: int = None # 因为之前读取过,这应该修改全局变量
# --- Test 2: 指针算术和数组索引 ---
@@ -209,10 +210,10 @@ def main() -> t.CInt | t.CExport:
l[0] = i
print(l)
u: t.CArray[t.CUInt64T | t.BigEndian, 2] = [0x4141414141414141, 0x0000000000000000]
for i in c.Addr(u):
# l[0] = i
stdio.printf("0x%llx\n", i)
#u: t.CArray[t.CUInt64T | t.BigEndian, 2] = [0x4141414141414141, 0x0000000000000000]
#for i in c.Addr(u):
# # l[0] = i
# stdio.printf("0x%llx\n", i)
k: t.CArray[t.CChar, 12] = ['1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C']
for i in k:
@@ -222,6 +223,7 @@ def main() -> t.CInt | t.CExport:
# Test 1: global 声明
testcheck.section("Test 1: global declaration")
global _g_val
_g_val = 0
test_global_write()
stdio.printf("After test_global_write(): _g_val = %d (expect 42)\n", _g_val)