31 lines
912 B
Plaintext
31 lines
912 B
Plaintext
|
|
// 🎯 Phase B-C 验证测试 - 确认状态共享修复是否有效
|
|||
|
|
static box Main {
|
|||
|
|
init { array_test, map_test, buffer_test, socket_test }
|
|||
|
|
main() {
|
|||
|
|
// ArrayBox测试
|
|||
|
|
local arr
|
|||
|
|
arr = new ArrayBox()
|
|||
|
|
arr.push("hello")
|
|||
|
|
me.array_test = arr.length() // 期待: 1
|
|||
|
|
|
|||
|
|
// MapBox测试
|
|||
|
|
local map
|
|||
|
|
map = new MapBox()
|
|||
|
|
map.set("key1", "value1")
|
|||
|
|
me.map_test = map.size() // 期待: 1
|
|||
|
|
|
|||
|
|
// BufferBox测试
|
|||
|
|
local buf
|
|||
|
|
buf = new BufferBox()
|
|||
|
|
buf.write([72, 101, 108, 108, 111]) // "Hello"
|
|||
|
|
me.buffer_test = buf.length() // 期待: 5
|
|||
|
|
|
|||
|
|
// SocketBox测试
|
|||
|
|
local sock
|
|||
|
|
sock = new SocketBox()
|
|||
|
|
sock.bind("127.0.0.1", 8080)
|
|||
|
|
me.socket_test = 1 // 暂时设为1,表示创建成功
|
|||
|
|
|
|||
|
|
return me.array_test
|
|||
|
|
}
|
|||
|
|
}
|