nx_bvh_empty_hstr_fixture_t284.nx source
↩ module page · 29 lines · 1414 B
1import "nx_nxa.nx"
2import "nx_fs_create_lib.nx"
3import "nx_gate_verdict.nx"
4func main()->i64{
5 let words:i64=4+3*4+4+4+1
6 let h:*i64=sys_mmap(words*8) as *i64
7 var i:i64=0;while i<words{h[i]=0;i=i+1}
8 h[0]=nxa_magic();h[1]=NXA_VER;h[2]=3
9 h[4]=nxa_tag4("VERT" as *u8);h[5]=16*8;h[6]=4
10 h[8]=nxa_tag4("TRIS" as *u8);h[9]=20*8;h[10]=4
11 h[12]=nxa_tag4("HSTR" as *u8);h[13]=24*8;h[14]=1
12 h[16]=1;h[20]=1;h[24]=0
13 h[7]=nxa_check2(1,((h as i64)+16*8) as *i64,4)
14 h[11]=nxa_check2(1,((h as i64)+20*8) as *i64,4)
15 h[15]=nxa_check2(1,((h as i64)+24*8) as *i64,1)
16 h[3]=nxa_check2(1,((h as i64)+32) as *i64,12)
17 let ctr:*i64=gv_ctr()
18 gv_check_eq("empty HSTR is structurally valid" as *u8,nxa_counted_section(h as *u8,words*8,nxa_tag4("HSTR" as *u8),24),24,ctr)
19 let path:*u8="knowledge/gates/bvh-empty-hstr-t284.nxa" as *u8
20 let rc:i64=fxc_create(path,h as *u8,words*8)
21 gv_check("fixture created or already exists" as *u8,rc==words*8||rc==FXC_EXISTS,ctr)
22 let n:*i64=sys_mmap(8) as *i64;let read:*u8=sys_map_file(path,n)
23 if (read as i64)==0{return 2}
24 gv_check_eq("fixture readback length" as *u8,n[0],words*8,ctr)
25 if n[0]!=words*8{return 3}
26 let r:*i64=read as *i64;var bad:i64=0;i=0;while i<words{if r[i]!=h[i]{bad=bad+1};i=i+1}
27 gv_check_eq("fixture exact readback" as *u8,bad,0,ctr)
28 return gv_verdict("nx_bvh_empty_hstr_fixture_t284" as *u8,ctr,"empty valid HSTR fixture for diagnostic admission refusal" as *u8)
29}