code wiki / _hdl_build / nx_browser_arc_pipeline_test.nx

nx_browser_arc_pipeline_test.nx source

↩ module page · 46 lines · 2234 B

1// nx_browser_arc_pipeline_test.nx -- the ENGINEER's KAT gate for the Warden's 2// browser-arc pipeline. Synthetic gate-log buffer proves the evidence reader 3// (last-run-wins, PASS/FAIL/ABSENT) and the RACI routing (NEEDS_TUTOR for novel 4// absent cores, SCAFFOLD-READY for covered, ADMITTED only on PASS evidence, 5// HEAL-QUEUED on FAIL). Exit 0 iff all KATs green. license_tier: ORIGINAL 6import "nx_browser_arc_pipeline.nx" 7 8func t_len(s: *u8) -> i64 { 9 var n: i64 = 0 10 while s[n] != (0 as u8) { n = n + 1 } 11 return n 12} 13 14func t_report(name: *u8, got: i64, want: i64) -> i64 { 15 ba_fputs(1, "KAT \x00" as *u8) 16 ba_fputs(1, name) 17 ba_fputs(1, " got=\x00" as *u8) 18 ba_fputn(1, got) 19 ba_fputs(1, " want=\x00" as *u8) 20 ba_fputn(1, want) 21 if got == want { ba_fputs(1, " PASS\n\x00" as *u8); return 1 } 22 ba_fputs(1, " FAIL\n\x00" as *u8) 23 return 0 24} 25 26func main() -> i64 { 27 // synthetic append-only gate log: foo fails an old run then passes the latest; 28 // bar fails its latest; baz never ran. 29 let log: *u8 = "BROWSER-GATE row=foo build=0 exit=1 sig=0 verdict=FAIL\nBROWSER-GATE row=foo build=0 exit=0 sig=0 verdict=PASS\nBROWSER-GATE row=bar build=0 exit=1 sig=0 verdict=FAIL\n\x00" as *u8 30 let n: i64 = t_len(log) 31 32 var pass: i64 = 0 33 pass = pass + t_report("row-last-wins-pass\x00" as *u8, ba_row_status(log, n, "row=foo \x00" as *u8), 1) 34 pass = pass + t_report("row-latest-fail\x00" as *u8, ba_row_status(log, n, "row=bar \x00" as *u8), 0) 35 pass = pass + t_report("row-absent\x00" as *u8, ba_row_status(log, n, "row=baz \x00" as *u8), 0 - 1) 36 pass = pass + t_report("novel-absent-tutor\x00" as *u8, ba_rung_stage(0, 0 - 1), BP_NEEDS_TUTOR) 37 pass = pass + t_report("covered-absent-scaffold\x00" as *u8, ba_rung_stage(3, 0 - 1), BP_SCAFFOLDED) 38 pass = pass + t_report("pass-evidence-admit\x00" as *u8, ba_rung_stage(0, 1), BP_ADMITTED) 39 pass = pass + t_report("fail-evidence-heal\x00" as *u8, ba_rung_stage(0, 0), BP_HEALED) 40 41 ba_fputs(1, "ARC-PIPELINE-KAT total=7 passed=\x00" as *u8) 42 ba_fputn(1, pass) 43 if pass == 7 { ba_fputs(1, " verdict=GREEN\n\x00" as *u8); return 0 } 44 ba_fputs(1, " verdict=RED\n\x00" as *u8) 45 return 1 46}