test: add Phase104 json_cur read_digits fixture and smokes

This commit is contained in:
nyash-codex
2025-12-17 21:25:12 +09:00
parent e935b2324b
commit a05ce39a1f
4 changed files with 123 additions and 1 deletions

View File

@ -0,0 +1,25 @@
// Phase 104 (P2): real-app derived fixture from apps/libs/json_cur.hako:read_digits_from
// Expect numeric output lines: 2 then 1
static box Main {
read_digits_from(s, pos) {
local out = ""
local i = pos
if i < 0 { return out }
loop (true) {
local ch = s.substring(i, i+1)
if ch == "" { break }
if ch == "0" || ch == "1" || ch == "2" || ch == "3" || ch == "4" || ch == "5" || ch == "6" || ch == "7" || ch == "8" || ch == "9" { out = out + ch i = i + 1 } else { break }
}
return out
}
main() {
local a = read_digits_from("12x", 0)
local b = read_digits_from("9", 0)
print(a.length())
print(b.length())
return "OK"
}
}