chore(comments): Test 仓注释英文化(R11)
把 81 个 .vp 文件的中文 # 注释与三引号文档串改写为简洁英文,每个连续注释块 <=2 行;运行时中文字符串字面量(testcheck.begin/print 等用户可见消息)保持原样。骨架比对 HEAD 与工作区 112 文件漂移 0,全量 77/77 顺序回归通过。
This commit is contained in:
1 parent
aa5a7e7250
commit
ee6461be46
81 files changed
+1231
-1925
No files matched your search
@@ -3,7 +3,7 @@ import stdio
|
||||
import string
|
||||
import testcheck
|
||||
|
||||
# 定义结构体
|
||||
# Define structs
|
||||
class Point():
|
||||
x: int
|
||||
y: int
|
||||
@@ -14,7 +14,7 @@ class Rect():
|
||||
|
||||
class Node():
|
||||
value: int
|
||||
next: t.CPtr # Node* 类型
|
||||
next: t.CPtr # Node* type
|
||||
|
||||
def test_struct_basic():
|
||||
testcheck.section("Test 1: struct basic")
|
||||
@@ -37,12 +37,12 @@ def test_struct_pointer():
|
||||
p: Point = Point()
|
||||
p.x = 42
|
||||
p.y = 84
|
||||
# 取结构体指针
|
||||
# Take a struct pointer
|
||||
pp: Point* = t.CPtr(uint64(p))
|
||||
# 通过指针修改
|
||||
# Modify through the pointer
|
||||
pp.x = 100
|
||||
pp.y = 200
|
||||
# 检查原始结构体是否被修改
|
||||
# Check whether the original struct changed
|
||||
testcheck.check(p.x == 100 and p.y == 200, "struct pointer (x=100 y=200)", "struct pointer (x y expect 100 200)")
|
||||
|
||||
def test_struct_param():
|
||||
@@ -58,13 +58,13 @@ def point_sum(p: Point) -> int:
|
||||
|
||||
def test_struct_array():
|
||||
testcheck.section("Test 5: struct array")
|
||||
# 分配结构体数组
|
||||
# Allocate a struct array
|
||||
buf: uint8* = w32.win32memory.VirtualAlloc(None, 256, 12288, 4)
|
||||
if uint64(buf) == 0:
|
||||
stdio.printf("SKIP: VirtualAlloc returned NULL\n")
|
||||
return
|
||||
string.memset(buf, 0, 256)
|
||||
# 将缓冲区转为 Point 数组
|
||||
# Reinterpret the buffer as a Point array
|
||||
pts: Point* = (Point*)(buf)
|
||||
pts[0].x = 1
|
||||
pts[0].y = 2
|
||||
|
||||
Reference in new issue
Block a user