code wiki / (root) / nx_maint_business_test.nx

nx_maint_business_test.nx source

↩ module page · 77 lines · 3143 B

1// nx_maint_business_test.nx -- gate for the business-model layer. 2// 3// Proves the unit economics (customer value, ROI, business margin/profit), the 4// VIABLE win-win verdict, the unsustainable cases (customer- / business- 5// negative), and the liar-kill: the economics track the MEASURED failure 6// reduction (more reduction -> more value). Inputs match the simloop result 7// (closed-loop 2 vs open-loop 13 failures). 8// 9// expect_exit: 0 10// 11// license_tier: ORIGINAL 12 13import "nx_syscalls_x86_64.nx" 14import "nx_maint_business.nx" 15 16func main() -> i64 { 17 if nx_biz_verdict_is_valid(NX_BIZ_VIABLE) != 1 { return 1 } 18 if nx_biz_verdict_is_valid(NX_BIZ_N) != 0 { return 2 } 19 20 let p: *BizParams = sys_mmap(64) as *BizParams 21 let out: *BizResult = sys_mmap(64) as *BizResult 22 23 // ===== VIABLE: $800 failure, 13->2 reduction, $60 sub, $12 cost == 24 p.avg_failure_cost_cents = 80000 25 p.failures_reactive_per_100 = 13 26 p.failures_proactive_per_100 = 2 27 p.subscription_cents_yr = 6000 28 p.platform_cost_cents_yr = 1200 29 p.n_assets = 10000 30 nx_biz_model(p, out) 31 if out.verdict != NX_BIZ_VIABLE { return 10 } 32 if out.avoided_cost_cents != 8800 { return 11 } // $88/asset-yr value created 33 if out.customer_savings_cents != 2800 { return 12 } // $28/asset-yr customer net 34 if out.customer_roi_x100 != 146 { return 13 } // 1.46x return on subscription 35 if out.business_margin_cents != 4800 { return 14 } // $48/asset-yr margin 36 if out.business_profit_cents_yr != 48000000 { return 15 } // $480k/yr at 10k assets 37 38 // ===== CUSTOMER_NEGATIVE: subscription too high ($90 > $88 value) = 39 p.subscription_cents_yr = 9000 40 nx_biz_model(p, out) 41 if out.verdict != NX_BIZ_CUSTOMER_NEGATIVE { return 20 } 42 43 // ===== BUSINESS_NEGATIVE: priced below our cost ($10 < $12) ====== 44 p.subscription_cents_yr = 1000 45 p.platform_cost_cents_yr = 1200 46 nx_biz_model(p, out) 47 if out.verdict != NX_BIZ_BUSINESS_NEGATIVE { return 30 } 48 49 // ===== BAD_ARG: platform claims to INCREASE failures ============ 50 p.subscription_cents_yr = 6000 51 p.platform_cost_cents_yr = 1200 52 p.failures_proactive_per_100 = 15 53 nx_biz_model(p, out) 54 if out.verdict != NX_BIZ_BAD_ARG { return 40 } 55 p.failures_proactive_per_100 = 2 56 p.subscription_cents_yr = 0 57 nx_biz_model(p, out) 58 if out.verdict != NX_BIZ_BAD_ARG { return 41 } 59 60 // ===== LIAR-KILL: economics track the failure reduction ========= 61 p.avg_failure_cost_cents = 80000 62 p.failures_reactive_per_100 = 13 63 p.failures_proactive_per_100 = 2 64 p.subscription_cents_yr = 6000 65 p.platform_cost_cents_yr = 1200 66 p.n_assets = 10000 67 nx_biz_model(p, out) 68 let big_avoided: i64 = out.avoided_cost_cents 69 let big_verdict: i64 = out.verdict 70 p.failures_proactive_per_100 = 12 // barely reduces failures 71 nx_biz_model(p, out) 72 if out.avoided_cost_cents >= big_avoided { return 50 } // less reduction -> less value 73 if out.avoided_cost_cents != 800 { return 51 } 74 if out.verdict == big_verdict { return 52 } // VIABLE -> CUSTOMER_NEGATIVE 75 76 return 0 77}