code wiki / _hdl_build / _pe_alspec1_test.nx
_pe_alspec1_test.nx source
↩ module page · 25 lines · 708 B
1// AUTHORED BY THE NISHI BUILDER (pattern: WIRE_TLV v3 test) -- KATs computed from the spec at emit time
2import "_pe_alspec1.nx"
3import "nx_syscalls.nx"
4func main() -> i64 {
5 let b: *u8 = sys_mmap(96)
6 b[0] = 0 as u8
7 b[1] = 5 as u8
8 b[2] = 0 as u8
9 b[3] = 3 as u8
10 b[4] = 170 as u8
11 b[5] = 187 as u8
12 b[6] = 204 as u8
13 b[7] = 0 as u8
14 b[8] = 13 as u8
15 b[9] = 0 as u8
16 b[10] = 1 as u8
17 b[11] = 238 as u8
18 if _pe_alspec1_count(b, 12) == 2 {
19 if _pe_alspec1_find(b, 12, 5) == 4 {
20 if _pe_alspec1_find(b, 12, 13) == 11 {
21 if _pe_alspec1_find(b, 12, 99) == 0 - 1 {
22 if _pe_alspec1_count(b, 11) == 0 - 1 { sys_exit(0) } } } } }
23 sys_exit(1)
24 return 1
25}