code wiki / (root) / nx_probiome_garden_test.nx

nx_probiome_garden_test.nx source

↩ module page · 49 lines · 2301 B

1// nx_probiome_garden_test.nx -- smoke for nx_probiome_garden (R6c). 2// Proves the plant-kingdom payoff: crop -> beneficial inoculant, every 3// pick validated safe + plant-beneficial through the R6 never-HARM gate, 4// grounded in real agronomy (legume/Rhizobium, cereal/Azospirillum, 5// root/mycorrhiza, fruiting/Bacillus biocontrol). Safe by construction. 6// Exit code = failed assertion number; 0 = all pass. 7 8import "nx_syscalls.nx" 9import "nx_probiome.nx" 10import "nx_probiome_garden.nx" 11 12func main() -> i64 { 13 // --- agronomy pairings --- 14 if pg_inoculant(PG_CROP_LEGUME) != PB_STR_RHIZOBIUM { return 1 } 15 if pg_inoculant_admit(PG_CROP_LEGUME) != PB_OK { return 2 } 16 if pg_inoculant(PG_CROP_CEREAL) != PB_STR_AZOSPIRILLUM { return 3 } 17 if pg_inoculant_admit(PG_CROP_CEREAL) != PB_OK { return 4 } 18 if pg_inoculant(PG_CROP_FRUITING) != PB_STR_B_SUBTILIS { return 5 } 19 if pg_inoculant_admit(PG_CROP_FRUITING) != PB_OK { return 6 } 20 if pg_inoculant(PG_CROP_ROOT) != PB_STR_MYCORRHIZA { return 7 } 21 if pg_inoculant_admit(PG_CROP_ROOT) != PB_OK { return 8 } 22 23 // --- the pick actually delivers the crop's needed mechanism --- 24 if pg_crop_mechanism(PG_CROP_LEGUME) != PB_MECH_NFIX { return 9 } 25 if pg_inoculant_delivers_need(PG_CROP_LEGUME) != 1 { return 10 } 26 if pg_inoculant_delivers_need(PG_CROP_ROOT) != 1 { return 11 } 27 if pg_inoculant_delivers_need(PG_CROP_FRUITING) != 1 { return 12 } 28 29 // --- SAFE BY CONSTRUCTION: every crop archetype gets a safe pick --- 30 if pg_count_served() != PG_CROP_N { return 13 } 31 var crop: i64 = 0 32 while crop < PG_CROP_N { 33 if pg_inoculant_admit(crop) != PB_OK { return 100 + crop } 34 crop = crop + 1 35 } 36 37 // --- benefit surfaced (Rhizobium symbiotic N-fixation is high) --- 38 if pg_inoculant_benefit(PG_CROP_LEGUME) != 900 { return 14 } 39 40 // --- unknown crop: nothing recommended, refusal (not a false OK) --- 41 if pg_inoculant(PG_CROP_N) != -1 { return 15 } 42 if pg_inoculant_admit(PG_CROP_N) == PB_OK { return 16 } 43 44 // --- cross-consistency: the fruiting pick matches what the pure 45 // probiome recommender returns for (plant, biocontrol) --- 46 if pg_inoculant(PG_CROP_FRUITING) != nx_probiome_recommend(PB_HOST_PLANT, PB_MECH_BIOCONTROL) { return 17 } 47 48 return 0 49}