nx_ferment_cultures_test.nx source
↩ module page · 67 lines · 2832 B
1// nx_ferment_cultures_test.nx -- smoke for nx_ferment_cultures (R6b).
2// Proves the cheese/yogurt maker reasons about its beneficial bacteria:
3// - yogurt declares S. thermophilus + L. acidophilus as live cultures;
4// - every named recipe's cultures are HUMAN-safe (never-HARM gate);
5// - the ferment surfaces its cultures' cross-kingdom benefit + mechanisms;
6// - honest gap: kombucha/tempeh declare 0 bacterial cultures;
7// - LIAR-KILL: a ferment declaring a pathogen or AMR opportunist as a
8// culture is REFUSED.
9// Exit code = failed assertion number; 0 = all pass.
10
11import "nx_syscalls.nx"
12import "nx_ferment_recipes.nx"
13import "nx_probiome.nx"
14import "nx_ferment_cultures.nx"
15
16func main() -> i64 {
17 // --- yogurt cultures ---
18 let yc: *NxFermentCultures = nx_ferment_cultures(NX_RCP_YOGURT)
19 if yc.count != 2 { return 1 }
20 if fc_culture_at(yc, 0) != PB_STR_S_THERMOPHILUS { return 2 }
21 if fc_cultures_safe(yc) != PB_OK { return 3 }
22
23 // --- the ferment surfaces its cultures' benefits ---
24 if fc_recipe_benefits_host(NX_RCP_YOGURT, PB_HOST_HUMAN) != 1 { return 4 }
25 if fc_recipe_benefits_host(NX_RCP_YOGURT, PB_HOST_ANIMAL) != 1 { return 5 }
26 if fc_recipe_delivers(NX_RCP_YOGURT, PB_MECH_VITAMIN) != 1 { return 6 }
27 if fc_recipe_delivers(NX_RCP_YOGURT, PB_MECH_LACTIC) != 1 { return 7 }
28
29 // --- cheese cultures ---
30 let cc: *NxFermentCultures = nx_ferment_cultures(NX_RCP_CHEDDAR)
31 if fc_culture_at(cc, 0) != PB_STR_L_LACTIS { return 8 }
32 if fc_cultures_safe(cc) != PB_OK { return 9 }
33
34 // --- widened: kombucha SCOBY = acetic-acid bacteria + yeast ---
35 let kc: *NxFermentCultures = nx_ferment_cultures(NX_RCP_KOMBUCHA)
36 if kc.count != 2 { return 10 }
37 if fc_cultures_safe(kc) != PB_OK { return 11 }
38 // --- tempeh: the Rhizopus mold, admitted for human consumption ---
39 let tc: *NxFermentCultures = nx_ferment_cultures(NX_RCP_TEMPEH)
40 if fc_culture_at(tc, 0) != PB_STR_RHIZOPUS { return 12 }
41 if fc_cultures_safe(tc) != PB_OK { return 13 }
42
43 // --- CONVERGENCE: every named recipe's cultures are HUMAN-safe ---
44 var i: i64 = 0
45 while i < NX_RCP_N {
46 let c: *NxFermentCultures = nx_ferment_cultures(i)
47 if fc_cultures_safe(c) != PB_OK { return 100 + i }
48 i = i + 1
49 }
50
51 // --- LIAR-KILL: a ferment declaring a PATHOGEN culture is REFUSED ---
52 let bad: *NxFermentCultures = (sys_mmap(64)) as *NxFermentCultures
53 bad.recipe_id = -1
54 bad.count = 1
55 bad.s0 = PB_STR_LISTERIA
56 bad.s1 = -1
57 bad.s2 = -1
58 bad.s3 = -1
59 if fc_cultures_safe(bad) != PB_REFUSED_PATHOGEN { return 20 }
60
61 // --- LIAR-KILL: a ferment declaring an AMR opportunist is REFUSED ---
62 bad.count = 1
63 bad.s0 = PB_STR_E_FAECIUM
64 if fc_cultures_safe(bad) != PB_REFUSED_OPPORTUNIST { return 21 }
65
66 return 0
67}