nx_wasm_layout_wat_gate.nx source
↩ module page · 22 lines · 1115 B
1import "nx_wasm_layout_wat_lib.nx"
2import "nx_gate_verdict.nx"
3
4func main() -> i64 {
5 let c: *i64=gv_ctr()
6 let m: *Module=ir_module_new("wat-layout-fixture" as *u8)
7 ir_add_global_bss(m,"state" as *u8,5,65536)
8 let out: *OutBuf=out_new(212)
9 gv_check_eq("exact-fit record",wl_wat_record(m,1,1,out),96,c)
10 gv_check_eq("complete comment extent",out.pos,212,c)
11 gv_check_eq("comment newline",out.buf[211] as i64,10,c)
12 gv_check_eq("record hex starts at prefix",out.buf[19] as i64,52,c)
13 gv_check_eq("record hex low nibble",out.buf[20] as i64,101,c)
14 let short: *OutBuf=out_new(211)
15 short.buf[0]=165 as u8
16 gv_check_eq("short output refused",wl_wat_record(m,1,1,short),0,c)
17 gv_check_eq("refusal keeps output position",short.pos,0,c)
18 gv_check_eq("refusal keeps output bytes",short.buf[0] as i64,165,c)
19 gv_check_eq("null module refused",wl_wat_record(0 as *Module,1,1,out),0,c)
20 gv_check_eq("null output refused",wl_wat_record(m,1,1,0 as *OutBuf),0,c)
21 return gv_verdict("WASM-LAYOUT-WAT",c,"comment emission only; binary provenance and pair acceptance pending")
22}