test: add Phase104 json_cur read_digits fixture and smokes
This commit is contained in:
25
apps/tests/phase104_read_digits_json_cur_min.hako
Normal file
25
apps/tests/phase104_read_digits_json_cur_min.hako
Normal 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"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user