code wiki / _hdl_build / _pe_crawl_test.nx

_pe_crawl_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 "_pe_crawl.nx" 3import "nx_syscalls.nx" 4func main() -> i64 { 5 var bad: i64 = 0 6 if _pe_crawl_allow(1000, 2499) != 0 { bad = bad + 1 } 7 if _pe_crawl_allow(1000, 2500) != 1 { bad = bad + 1 } 8 if _pe_crawl_backoff(0) != 500 { bad = bad + 1 } 9 if _pe_crawl_backoff(3) != 4000 { bad = bad + 1 } 10 if _pe_crawl_backoff(40) != 8000 { bad = bad + 1 } 11 if bad == 0 { sys_exit(0) } 12 sys_exit(1) 13 return 1 14}