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