nx_soda_design_test.nx source
↩ module page · 44 lines · 2047 B
1// nx_soda_design_test.nx -- smoke for nx_soda_design (craft-soda capstone).
2//
3// Proves the AIR-TO-SODA chain + the SYSTEM-level exceed (every pillar is
4// load-bearing -- none is a hand-set number):
5// - the clean COLD chain scores high + is sugar-free by construction (1-4)
6// - carbonation lands in the soda pH range (5)
7// - WARM water breaks "no heavy equipment" (>5 bar) + drops the score (6-7)
8// - HARD water muddies the canvas + drops the score (8-9)
9// - the on-demand per-glass crystal dose is a sane craft quantity (10-11)
10// Exit code = failed assertion number; 0 = all pass.
11
12import "nx_syscalls.nx"
13import "nx_soda_design.nx"
14
15func main() -> i64 {
16 // --- the clean cold chain: pure water (20 ppm), 4C, target sour 400 ---
17 let cs: *NxCraftSoda = soda_craft(4, 400, 20)
18 if cs.craft_score_milli < 700 { return 1 }
19 if cs.sugar_g_per_l != 0 { return 2 } // sugar-free by construction
20 if cs.clarity_milli != 1000 { return 3 } // clean canvas
21 if cs.nanobubble_ok != 1 { return 4 } // no heavy equipment (cold)
22
23 // --- carbonation acidity lands in the measured soda range ---
24 if cs.ph_milli < 3400 { return 5 }
25 if cs.ph_milli > 4000 { return 5 }
26
27 // --- WARM water (25C) breaks the no-heavy-equipment promise (>5 bar) and
28 // drops the craft score -- carbonating COLD is what keeps gear compact ---
29 let warm: *NxCraftSoda = soda_craft(25, 400, 20)
30 if warm.nanobubble_ok != 0 { return 6 }
31 if warm.craft_score_milli >= cs.craft_score_milli { return 7 }
32
33 // --- HARD water (300 ppm) muddies the canvas and drops the score ---
34 let hard: *NxCraftSoda = soda_craft(4, 400, 300)
35 if hard.water_purity_milli >= cs.water_purity_milli { return 8 }
36 if hard.craft_score_milli >= cs.craft_score_milli { return 9 }
37
38 // --- on-demand per-glass crystal dose is a sane craft quantity (mg/250ml) ---
39 let dose: i64 = soda_glass_crystal_mg(cs, 250)
40 if dose < 300 { return 10 }
41 if dose > 1200 { return 11 }
42
43 return 0
44}