test(joinir): Phase 104 read_digits loop(true) parity

This commit is contained in:
nyash-codex
2025-12-17 18:29:27 +09:00
parent ce501113a7
commit 950560a3d9
20 changed files with 954 additions and 30 deletions

View File

@ -2,7 +2,7 @@
// Goal: one branch returns early (no join), other returns later.
// Expect: two numeric lines "7" then "2".
box Main {
static box Main {
g(flag) {
if flag == 0 {
return 7
@ -12,9 +12,8 @@ box Main {
}
main() {
print(me.g(0))
print(me.g(1))
print(g(0))
print(g(1))
return "OK"
}
}

View File

@ -2,7 +2,7 @@
// Goal: require merge (PHI-equivalent) in an if-only program (no loops),
// and include one nested if to ensure nested merge stability.
box Main {
static box Main {
main() {
local x = 0
@ -20,4 +20,3 @@ box Main {
return "OK"
}
}

View File

@ -0,0 +1,35 @@
// Phase 104: read_digits_from loop(true) + break-only minimal fixture
// Expect numeric output lines: 2 then 1
static box Main {
read_digits_min(s, pos) {
local i = pos
local out = ""
loop(true) {
local ch = s.substring(i, i + 1)
// end-of-string guard
if ch == "" { break }
// digit check (match real-app shape; keep on one line to avoid ASI ambiguity)
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_min("12x", 0)
local b = read_digits_min("9", 0)
print(a.length())
print(b.length())
return "OK"
}
}