code wiki / (root) / nx_probiome_provenance_test.nx

nx_probiome_provenance_test.nx source

↩ module page · 56 lines · 2400 B

1// nx_probiome_provenance_test.nx -- smoke for nx_probiome_provenance (R6d). 2// Proves "research not bro science": every catalog claim is cited, every 3// cite_id resolves to a REAL fetched source (>= 80 KB, so a 404 stub can't 4// count), and the hazard liar-kills cite the actual hazard literature. 5// Requires the researcher to have run (nx_probiome_research_fetch). 6// Exit code = failed assertion number; 0 = all pass. 7 8import "nx_syscalls.nx" 9import "nx_probiome.nx" 10import "nx_probiome_provenance.nx" 11 12func main() -> i64 { 13 // --- anti-bro-science: NO uncited claim in the catalog --- 14 if pg_uncited_strains() != 0 { return 1 } 15 16 // --- every referenced cite (1..22) is grounded in a real source --- 17 var c: i64 = 1 18 while c <= PG_CITE_N { 19 if pg_cite_grounded(c) != 1 { return 100 + c } 20 c = c + 1 21 } 22 if pg_count_grounded() != 22 { return 2 } 23 24 // --- the never-HARM liar-kills are grounded in the HAZARD literature: 25 // each unsafe strain cites the source that documents its hazard --- 26 let ls: *NxProbiomeStrain = nx_probiome_strain(PB_STR_LISTERIA) 27 if ls.cite_id != 1 { return 3 } 28 if pg_cite_grounded(1) != 1 { return 4 } 29 let bc: *NxProbiomeStrain = nx_probiome_strain(PB_STR_B_CEREUS) 30 if bc.cite_id != 3 { return 5 } 31 if pg_cite_grounded(3) != 1 { return 6 } 32 let ef: *NxProbiomeStrain = nx_probiome_strain(PB_STR_E_FAECIUM) 33 if ef.cite_id != 4 { return 7 } 34 if pg_cite_grounded(4) != 1 { return 8 } 35 let af: *NxProbiomeStrain = nx_probiome_strain(PB_STR_A_FLAVUS) 36 if af.cite_id != 22 { return 9 } 37 if pg_cite_grounded(22) != 1 { return 10 } 38 39 // --- a keystone benefit claim is grounded (B. subtilis -> cite 2) --- 40 let bs: *NxProbiomeStrain = nx_probiome_strain(PB_STR_B_SUBTILIS) 41 if bs.cite_id != 2 { return 11 } 42 if pg_cite_grounded(2) != 1 { return 12 } 43 44 // --- LIAR-KILL of the grounding check itself: an unknown cite id has 45 // no source file -> NOT grounded (the check is real, not rubber- 46 // stamped) --- 47 if pg_cite_grounded(99) != 0 { return 13 } 48 49 // --- the byte floor is load-bearing: a real file does NOT clear an 50 // absurd 100 MB threshold (proves size logic works both ways) --- 51 let p1: *u8 = pg_cite_path(1) 52 if pg_file_size(p1) < PG_MIN_SOURCE_BYTES { return 14 } 53 if pg_file_size(p1) >= 100000000 { return 15 } 54 55 return 0 56}