Initial import of TransPyV

This commit is contained in:
Viper
2026-07-19 13:18:46 +08:00
commit e7eaf3e9a1
75 changed files with 23037 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
import stdio
import t, c
import string
import testcheck
# ============================================================
# testcheck_test - 测试 includes/testcheck 库导入与调用
#
# 验证命名空间隔离下import testcheck + 模块限定函数调用能正常工作。
# 同时测试 string 库的模块限定调用。
# ============================================================
def testcheck_test() -> int:
testcheck.begin("testcheck_test")
testcheck.section("Arithmetic")
a: int = 3 + 4
testcheck.check(a == 7, "3+4=7", "3+4!=7")
b: int = 10 - 3
testcheck.check(b == 7, "10-3=7", "10-3!=7")
m: int = 6 * 7
testcheck.check(m == 42, "6*7=42", "6*7!=42")
testcheck.section("String")
slen: int = string.strlen("hello")
testcheck.check(slen == 5, "strlen(hello)=5", "strlen(hello)!=5")
scmp: int = string.strcmp("abc", "abc")
testcheck.check(scmp == 0, "strcmp(abc,abc)=0", "strcmp(abc,abc)!=0")
testcheck.section("Module Import")
testcheck.info("testcheck module imported and called successfully")
testcheck.ok("import testcheck works")
return testcheck.end()