code wiki / _hdl_build / nx_scientist_test.nx

nx_scientist_test.nx source

↩ module page · 40 lines · 1992 B

1// nx_scientist_test.nx -- ACCEPTANCE GATE for the SCIENTIST role (PUBLISH under a NO-OVERCLAIM gate). 2// Was untested -- now Engineer-verifiable like every team role. 3import "nx_scientist.nx" 4import "nx_syscalls.nx" 5 6func st_puts(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } 7func st_putn(v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m} let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48 as u8;k=1} while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1} var i: i64=0; while i<k{bb[i]=t[k-1-i];i=i+1} sys_write(1,bb,k); return 0 } 8 9func main() -> i64 { 10 var pass: i64 = 0 11 var total: i64 = 0 12 13 // T1: a complete, honest, reproducible paper -> PUBLISH 14 total = total + 1 15 if sci_review(1,1,1,1,1,1, 3, 3) == SCI_PUBLISH { pass = pass + 1 } else { st_puts("T1 FAIL publish\n" as *u8) } 16 17 // T2: OVERCLAIM (claim tier 4 > honest grade 3) -> NOT publishable (rejected) 18 total = total + 1 19 if sci_review(1,1,1,1,1,1, 4, 3) != SCI_PUBLISH { pass = pass + 1 } else { st_puts("T2 FAIL overclaim slipped\n" as *u8) } 20 21 // T3: missing a component (no caveats) -> REVISE, not publish 22 total = total + 1 23 var t3: i64 = 1 24 if sci_complete(1,1,1,1,0,1) != 0 { t3 = 0 } // not complete (caveats missing) 25 if sci_review(1,1,1,1,0,1, 3, 3) == SCI_PUBLISH { t3 = 0 } 26 if t3 == 1 { pass = pass + 1 } else { st_puts("T3 FAIL revise\n" as *u8) } 27 28 // T4: no-overclaim gate exact -- tier<=grade ok, tier>grade fail 29 total = total + 1 30 var t4: i64 = 1 31 if sci_no_overclaim(3, 3) != 1 { t4 = 0 } 32 if sci_no_overclaim(2, 5) != 1 { t4 = 0 } 33 if sci_no_overclaim(5, 2) != 0 { t4 = 0 } 34 if t4 == 1 { pass = pass + 1 } else { st_puts("T4 FAIL no-overclaim\n" as *u8) } 35 36 st_puts("SCIENTIST " as *u8); st_putn(pass); st_puts("/" as *u8); st_putn(total); st_puts("\n" as *u8) 37 if pass == total { st_puts("SCIENTIST ALL-PASS\n" as *u8); sys_exit(0) } 38 sys_exit(1) 39 return 1 40}