code wiki / _hdl_build / nx_viz_ease_gate.nx
nx_viz_ease_gate.nx source
↩ module page · 47 lines · 1989 B
1// nx_viz_ease_gate.nx -- REFEREE for easing. linear(300)=300; cubic-inout 0/500/1000 = 0/500/1000, (250)=62;
2// ease_at(0,100,500)=50; monotonic 250<500<750. GREEN iff all. Sovereign: nx_viz_ease. license_tier: ORIGINAL
3import "nx_viz_ease.nx"
4import "nx_syscalls.nx"
5import "nx_gate_verdict.nx"
6
7func g_w(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
8func g_row(name: *u8, ok: i64) -> i64 {
9 if ok == 1 { g_w(" PASS " as *u8) } else { g_w(" FAIL " as *u8) }
10 g_w(name); g_w("\n" as *u8)
11 return ok
12}
13
14func main() -> i64 {
15 g_w("viz-ease gate (easing + interpolate)\n" as *u8)
16 var pass: i64 = 0
17
18 var t1: i64 = 0
19 if ve_linear(300) == 300 { t1 = 1 }
20 pass = pass + g_row("T1 linear(300)=300\x00" as *u8, t1)
21
22 var t2: i64 = 0
23 if ve_cubic_inout(0) == 0 { if ve_cubic_inout(500) == 500 { if ve_cubic_inout(1000) == 1000 { t2 = 1 } } }
24 pass = pass + g_row("T2 cubic-inout endpoints + midpoint\x00" as *u8, t2)
25
26 var t3: i64 = 0
27 if ve_cubic_inout(250) == 62 { t3 = 1 }
28 pass = pass + g_row("T3 cubic-inout(250)=62 (4*0.25^3)\x00" as *u8, t3)
29
30 var t4: i64 = 0
31 if ve_at(0, 100, 500) == 50 { t4 = 1 }
32 pass = pass + g_row("T4 interpolate 0->100 @0.5 = 50\x00" as *u8, t4)
33
34 var t5: i64 = 0
35 if ve_cubic_inout(250) < ve_cubic_inout(500) { if ve_cubic_inout(500) < ve_cubic_inout(750) { t5 = 1 } }
36 pass = pass + g_row("T5 monotonic 250<500<750\x00" as *u8, t5)
37
38 // MIGRATED onto nx_gate_verdict by nx_gate_dry_apply (D001, minimal form): every check
39 // row above is untouched, so the PASS/FAIL vector cannot change; only the hand-rolled
40 // verdict emission is replaced by the ONE shared base class. Proven by nx_gate_migrate verify.
41 let ctr__dry: *i64 = gv_ctr()
42 ctr__dry[0] = pass
43 ctr__dry[1] = 5
44 let rc__dry: i64 = gv_verdict("VIZ-EASE-GATE" as *u8, ctr__dry, "5/5 (easing curves, bits-up)" as *u8)
45 sys_exit(rc__dry)
46 return rc__dry
47}