code wiki / _hdl_build / _wb_pace_test.nx

_wb_pace_test.nx source

↩ module page · 14 lines · 521 B

1// AUTHORED BY THE NISHI BUILDER (pattern: GOVERNOR test) -- boundary KATs derived from the spec 2import "_wb_pace.nx" 3import "nx_syscalls.nx" 4func main() -> i64 { 5 var bad: i64 = 0 6 if _wb_pace_allow(1000, 2999) != 0 { bad = bad + 1 } 7 if _wb_pace_allow(1000, 3000) != 1 { bad = bad + 1 } 8 if _wb_pace_backoff(0) != 250 { bad = bad + 1 } 9 if _wb_pace_backoff(3) != 2000 { bad = bad + 1 } 10 if _wb_pace_backoff(40) != 16000 { bad = bad + 1 } 11 if bad == 0 { sys_exit(0) } 12 sys_exit(1) 13 return 1 14}