phase29ab(p5): freeze pattern7 split-scan near-miss with fixture+smoke
This commit is contained in:
37
apps/tests/phase29ab_pattern7_firstfail_min.hako
Normal file
37
apps/tests/phase29ab_pattern7_firstfail_min.hako
Normal file
@ -0,0 +1,37 @@
|
||||
// Phase 29ab P5: Pattern7 first-fail minimal (contract violation)
|
||||
// Expect: JoinIR freeze (else step is not i = i + 1)
|
||||
|
||||
static box StringUtils {
|
||||
split_bad_step(s, separator) {
|
||||
local result = new ArrayBox()
|
||||
if separator.length() == 0 {
|
||||
result.push(s)
|
||||
return result
|
||||
}
|
||||
|
||||
local start = 0
|
||||
local i = 0
|
||||
loop(i <= s.length() - separator.length()) {
|
||||
if s.substring(i, i + separator.length()) == separator {
|
||||
result.push(s.substring(start, i))
|
||||
start = i + separator.length()
|
||||
i = start
|
||||
} else {
|
||||
i = i + 2
|
||||
}
|
||||
}
|
||||
|
||||
if start <= s.length() {
|
||||
result.push(s.substring(start, s.length()))
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
static box Main {
|
||||
main() {
|
||||
local result = StringUtils.split_bad_step("a,b,c", ",")
|
||||
return result.length()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user