code wiki / _hdl_build / nx_uiq_atree_gate.nx
nx_uiq_atree_gate.nx source
↩ module page · 99 lines · 4267 B
1// nx_uiq_atree_gate.nx -- D001 gate for the F106b ARIA-tree + ZSS TED organ (gv-verdict anchored).
2// Proves BEFORE any page is judged: exact node counts on a known fixture, TED oracle (identical=0,
3// one delete=1, one heading rename=1, one wrapper insert=1, symmetric), script bodies masked, and a
4// runtime-built 62-node scale tree (count exact + self-TED 0) beyond fixture size.
5// license_tier: ORIGINAL expect_exit: 0
6import "nx_uiq_atree_lib.nx"
7import "nx_gate_verdict.nx"
8
9func ag_app(dst: *u8, off: i64, lit: *u8) -> i64 {
10 var k: i64 = 0
11 var o: i64 = off
12 while lit[k]!=(0 as u8) { dst[o]=lit[k]; o=o+1; k=k+1 }
13 return o
14}
15
16func main() -> i64 {
17 let ctr: *i64 = gv_ctr()
18 gv_head("nx_uiq_atree_gate -- ARIA-tree + Zhang-Shasha TED (F106b): exact oracle, liar-killed" as *u8)
19 let fa: *u8 = AT_FIX_A
20 let fal: i64 = cs_len(fa)
21 let ta: *i64 = sys_mmap(AT_SLOTS*8) as *i64
22 let nA: i64 = at_build(fa, fal, ta)
23 var t1: i64=0
24 if nA==10 { t1=1 }
25 gv_check("T1 fixture tree exact node count (10 incl virtual root; bare section now generic)" as *u8, t1, ctr)
26 let d0: i64 = at_ted_html(fa, fal, fa, fal)
27 var t2: i64=0
28 if d0==0 { t2=1 }
29 gv_check("T2 identical trees TED=0" as *u8, t2, ctr)
30 let fc: *u8 = AT_FIX_C
31 let fcl: i64 = cs_len(fc)
32 let d1: i64 = at_ted_html(fa, fal, fc, fcl)
33 var t3: i64=0
34 if d1==1 { t3=1 }
35 gv_check("T3 one deleted nav link TED=1" as *u8, t3, ctr)
36 let fdx: *u8 = AT_FIX_D
37 let fdl: i64 = cs_len(fdx)
38 let d2: i64 = at_ted_html(fa, fal, fdx, fdl)
39 var t4: i64=0
40 if d2==1 { t4=1 }
41 gv_check("T4 heading level rename (h1->h2) TED=1" as *u8, t4, ctr)
42 let fe: *u8 = AT_FIX_E
43 let fel: i64 = cs_len(fe)
44 let d3: i64 = at_ted_html(fa, fal, fe, fel)
45 var t5: i64=0
46 if d3==1 { t5=1 }
47 gv_check("T5 inserted article wrapper TED=1" as *u8, t5, ctr)
48 let ds: i64 = at_ted_html(fc, fcl, fa, fal)
49 var t6: i64=0
50 if ds==1 { t6=1 }
51 gv_check("T6 TED symmetric (C vs A also 1)" as *u8, t6, ctr)
52 let fm: *u8 = AT_FIX_MASK2
53 let fml: i64 = cs_len(fm)
54 let tm: *i64 = sys_mmap(AT_SLOTS*8) as *i64
55 let nM: i64 = at_build(fm, fml, tm)
56 var t7: i64=0
57 if nM==3 { t7=1 }
58 gv_check("T7 script-masked: nav-in-JS-string contributes zero nodes" as *u8, t7, ctr)
59 let sf: i64 = at_selftest()
60 var t8: i64=0
61 if sf==0 { t8=1 }
62 gv_check("T8 embedded selftest (the CLI --kat contract) 0 fails" as *u8, t8, ctr)
63 let sb: *u8 = sys_mmap(8192)
64 var so: i64 = 0
65 so = ag_app(sb, so, "<ul>" as *u8)
66 var r: i64 = 0
67 while r<60 { so = ag_app(sb, so, "<li>x</li>" as *u8); r=r+1 }
68 so = ag_app(sb, so, "</ul>" as *u8)
69 let ts2: *i64 = sys_mmap(AT_SLOTS*8) as *i64
70 let nS: i64 = at_build(sb, so, ts2)
71 var t9: i64=0
72 if nS==62 { let dS: i64 = at_ted_html(sb, so, sb, so); if dS==0 { t9=1 } }
73 gv_check("T9 scale: 62-node runtime-built list exact count + self-TED 0" as *u8, t9, ctr)
74 let lab: *u8 = "<section aria-label=\"L\"><h2>S</h2></section>" as *u8
75 let labl: i64 = cs_len(lab)
76 let tl2: *i64 = sys_mmap(AT_SLOTS*8) as *i64
77 let nL: i64 = at_build(lab, labl, tl2)
78 let bare: *u8 = "<section><h2>S</h2></section>" as *u8
79 let barel: i64 = cs_len(bare)
80 let tb2: *i64 = sys_mmap(AT_SLOTS*8) as *i64
81 let nB: i64 = at_build(bare, barel, tb2)
82 var t10: i64=0
83 if nL==3 { if nB==2 { t10=1 } }
84 gv_check("T10 CHROME-AX RULE: labeled section=region, bare section=generic (discriminating pair)" as *u8, t10, ctr)
85 let scp: *u8 = "<article><footer>x</footer></article>" as *u8
86 let scpl: i64 = cs_len(scp)
87 let tc2: *i64 = sys_mmap(AT_SLOTS*8) as *i64
88 let nC2: i64 = at_build(scp, scpl, tc2)
89 let top: *u8 = "<footer>x</footer>" as *u8
90 let topl: i64 = cs_len(top)
91 let td2: *i64 = sys_mmap(AT_SLOTS*8) as *i64
92 let nD2: i64 = at_build(top, topl, td2)
93 var t11: i64=0
94 if nC2==2 { if nD2==2 { t11=1 } }
95 gv_check("T11 CHROME-AX RULE: footer in article demoted, document-scope footer kept" as *u8, t11, ctr)
96 let rc: i64 = gv_verdict("UIQ-ATREE-GATE" as *u8, ctr, "F106b ARIA-tree + ZSS: exact node counts, TED oracle 0/1/1/1 symmetric, mask tooth, 62-node scale" as *u8)
97 sys_exit(rc)
98 return rc
99}