code wiki / _hdl_build / nx_research_sovereign_lens_test.nx
nx_research_sovereign_lens_test.nx source
↩ module page · 59 lines · 3351 B
1// nx_research_sovereign_lens_test.nx -- KAT: every third-party tool a finding
2// names becomes a SOVEREIGN-BUILD directive (benchmark to exceed, never adopt).
3// Generic concepts stay neutral. Mechanizes "no third party, build S-class from
4// the hardware rung up." expect_exit: 0.
5
6import "nx_syscalls.nx"
7import "nx_research_extract.nx"
8import "nx_research_sovereign_lens.nx"
9
10func w(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
11func wn(v: i64) -> i64 {
12 let b: *u8 = sys_mmap(28); var m: i64 = v
13 if m < 0 { m = 0 - m; sys_write(1, "-" as *u8, 1) }
14 let t: *u8 = sys_mmap(28); var k: i64 = 0
15 if m == 0 { t[0] = 48 as u8; k = 1 }
16 while m > 0 { t[k] = (48 + (m % 10)) as u8; m = m / 10; k = k + 1 }
17 var i: i64 = 0; while i < k { b[i] = t[k - 1 - i]; i = i + 1 }
18 sys_write(1, b, k); return 0
19}
20func chk(cond: i64, pass: *i64, fail: *i64, label: *u8) -> i64 {
21 if cond == 1 { pass[0] = pass[0] + 1; w(" ok " as *u8); w(label); w("\n" as *u8) }
22 else { fail[0] = fail[0] + 1; w(" XX " as *u8); w(label); w("\n" as *u8) }
23 return 0
24}
25
26func tc(subj: *u8, obj: *u8, exp_idx: i64, s1: *u8, s2: *u8, pass: *i64, fail: *i64) -> i64 {
27 let out: *u8 = sys_mmap(2048)
28 let idx: i64 = nx_sovereign_lens(subj, obj, out)
29 w(" claim: " as *u8); w(subj); w(" / " as *u8); w(obj); w("\n" as *u8)
30 if idx >= 0 { w(" => " as *u8); w(out); w("\n" as *u8) } else { w(" => (neutral, no third party)\n" as *u8) }
31 chk(idx == exp_idx, pass, fail, "tool-index" as *u8)
32 if exp_idx >= 0 {
33 let on: i64 = re_strlen(out)
34 chk(re_has(out, on, s1), pass, fail, s1)
35 chk(re_has(out, on, s2), pass, fail, s2)
36 }
37 return 0
38}
39
40func main() -> i64 {
41 let pass: *i64 = (sys_mmap(8)) as *i64
42 let fail: *i64 = (sys_mmap(8)) as *i64
43 pass[0] = 0
44 fail[0] = 0
45 w("=== nx_research_sovereign_lens KAT (third party -> sovereign build, EXCEED) ===\n" as *u8)
46 tc("Firelight FMOD" as *u8, "low cost robust audio library and toolset" as *u8, 0, "AUDIO ENGINE" as *u8, "FMOD" as *u8, pass, fail)
47 tc("Havok" as *u8, "a robust physics simulation system" as *u8, 2, "PHYSICS ENGINE" as *u8, "Havok" as *u8, pass, fail)
48 tc("Scaleform" as *u8, "GFx for high performance Flash UI" as *u8, 6, "VECTOR RENDERER" as *u8, "Scaleform" as *u8, pass, fail)
49 tc("The renderer" as *u8, "uses Vulkan for rendering" as *u8, 14, "GRAPHICS API" as *u8, "Vulkan" as *u8, pass, fail)
50 tc("The compute pipeline" as *u8, "runs on CUDA cores" as *u8, 16, "GPU COMPUTE" as *u8, "CUDA" as *u8, pass, fail)
51 tc("game engine" as *u8, "software framework primarily designed for video game development" as *u8, 0 - 1, "" as *u8, "" as *u8, pass, fail)
52 tc("Blender" as *u8, "the popular open source 3D software" as *u8, 19, "DCC" as *u8, "Blender" as *u8, pass, fail)
53 tc("ZBrush" as *u8, "a digital sculpting tool" as *u8, 20, "SCULPTING" as *u8, "ZBrush" as *u8, pass, fail)
54 tc("Klipper" as *u8, "3D printer firmware" as *u8, 24, "FIRMWARE" as *u8, "Klipper" as *u8, pass, fail)
55 tc("KiCad" as *u8, "PCB design suite" as *u8, 27, "PCB/EDA" as *u8, "KiCad" as *u8, pass, fail)
56 w("=== VERDICT pass=" as *u8); wn(pass[0]); w(" fail=" as *u8); wn(fail[0]); w(" ===\n" as *u8)
57 if fail[0] == 0 { return 0 }
58 return 1
59}