code wiki / _hdl_build / _cn_fetch_test.nx
_cn_fetch_test.nx source
↩ module page · 14 lines · 526 B
1// AUTHORED BY THE NISHI BUILDER (pattern: GOVERNOR test) -- boundary KATs derived from the spec
2import "_cn_fetch.nx"
3import "nx_syscalls.nx"
4func main() -> i64 {
5 var bad: i64 = 0
6 if _cn_fetch_allow(1000, 2499) != 0 { bad = bad + 1 }
7 if _cn_fetch_allow(1000, 2500) != 1 { bad = bad + 1 }
8 if _cn_fetch_backoff(0) != 500 { bad = bad + 1 }
9 if _cn_fetch_backoff(3) != 4000 { bad = bad + 1 }
10 if _cn_fetch_backoff(40) != 8000 { bad = bad + 1 }
11 if bad == 0 { sys_exit(0) }
12 sys_exit(1)
13 return 1
14}