code wiki / (root) / nx_ferment_flavor_test.nx

nx_ferment_flavor_test.nx source

↩ module page · 41 lines · 1784 B

1// nx_ferment_flavor_test.nx -- smoke for nx_ferment_flavor (CAPSTONE). 2// 3// Proves the two-ladder convergence: predict a ferment's flavor trajectory 4// from chemistry, and design a ferment for a target flavor. 5// - sour rises with fermentation and is bounded (T0 saturation) (1-3) 6// - umami rises with time + proteolysis (4) 7// - aged ferment is more flavour-intense than young (R3+T0+T2 vector) (5) 8// - DESIGN: find the hour that hits a target sourness, verify it (6-7) 9// - DESIGN refuses a target the chemistry can never reach (8) 10// Exit code = failed assertion number; 0 = all pass. 11 12import "nx_syscalls.nx" 13import "nx_ferment_kinetics.nx" 14import "nx_taste_transduce.nx" 15import "nx_flavor_integrate.nx" 16import "nx_ferment_flavor.nx" 17 18func main() -> i64 { 19 // --- sour rises with fermentation, nonzero, bounded --- 20 if nx_ferment_sour_at(43, 24) <= nx_ferment_sour_at(43, 4) { return 1 } 21 if nx_ferment_sour_at(43, 24) <= 0 { return 2 } 22 if nx_ferment_sour_at(43, 48) > 1000 { return 3 } 23 24 // --- umami rises with time + proteolysis --- 25 if nx_ferment_umami_at(100, 50) <= nx_ferment_umami_at(10, 50) { return 4 } 26 27 // --- aged ferment is more flavour-intense than young --- 28 let young: *NxFlavorVector = nx_ferment_flavor_vector(43, 2, 50) 29 let aged: *NxFlavorVector = nx_ferment_flavor_vector(43, 48, 50) 30 if nx_flavor_total_intensity(aged) <= nx_flavor_total_intensity(young) { return 5 } 31 32 // --- DESIGN for a target sourness --- 33 let h: i64 = nx_ferment_time_for_sour(43, 300, 72) 34 if h <= 0 { return 6 } 35 if nx_ferment_sour_at(43, h) < 300 { return 7 } 36 37 // --- DESIGN refuses an unreachable target (sour saturates below it) --- 38 if nx_ferment_time_for_sour(43, 999, 72) != (0 - 1) { return 8 } 39 40 return 0 41}