// using json as JsonParserModule // 外部パーサ依存を外し、このスモークでは最小検証で固定 using StringUtils as StringUtils static box Main { main() { // JSON Lint: print OK for valid inputs, ERROR otherwise. // Keep logic deterministic and minimal (no heavy parser). local cases = new ArrayBox() local valid = new ArrayBox() // Valid valid.push("null") valid.push("true") valid.push("false") valid.push("42") valid.push("\"hello\"") valid.push("[]") valid.push("{}") valid.push("{\"a\":1}") valid.push("[1,2]") valid.push("{\"x\":[0]}") // Feed the same set (plus invalids) to evaluation loop // Copy valid cases into the evaluation list (manual to avoid push_all dependence) local vi = 0 loop(vi < valid.length()) { cases.push(valid.get(vi)) vi = vi + 1 } // Invalid (syntactically malformed) cases.push("{") // missing closing brace cases.push("[") // missing closing bracket cases.push("{\"a\":}") // missing value cases.push("{\"a\",1}") // missing colon cases.push("[1,,2]") // double comma cases.push("\"unterminated") // unterminated string local i = 0 loop(i < cases.length()) { local s = "" + cases.get(i) // normalize to string // Fixed membership check (no parser dependency) local ok = 0 local j = 0 loop(j < valid.length()) { if s == valid.get(j) { ok = 1 break } j = j + 1 } if ok == 1 { print("OK") } else { print("ERROR") } i = i + 1 } return 0 } }