Some checks are pending
Test, Build, and Deploy / test-build-deploy (push) Has started running
(arith-progo start step len result): result is the list (start, start+step, ..., start+(len-1)*step). Length 0 yields the empty list. Negative steps and zero step are supported. Useful for FD-style domain construction: (arith-progo 1 1 9 dom) -> (1 2 3 4 5 6 7 8 9) 6 new tests, 538/538 cumulative.
34 lines
663 B
Plaintext
34 lines
663 B
Plaintext
;; lib/minikanren/tests/arith-prog.sx — arithmetic progression generation.
|
|
|
|
(mk-test
|
|
"arith-progo-zero-len"
|
|
(run* q (arith-progo 5 1 0 q))
|
|
(list (list)))
|
|
|
|
(mk-test
|
|
"arith-progo-1-to-5"
|
|
(run* q (arith-progo 1 1 5 q))
|
|
(list (list 1 2 3 4 5)))
|
|
|
|
(mk-test
|
|
"arith-progo-evens-from-0"
|
|
(run* q (arith-progo 0 2 5 q))
|
|
(list (list 0 2 4 6 8)))
|
|
|
|
(mk-test
|
|
"arith-progo-descending"
|
|
(run* q (arith-progo 10 -1 4 q))
|
|
(list (list 10 9 8 7)))
|
|
|
|
(mk-test
|
|
"arith-progo-zero-step"
|
|
(run* q (arith-progo 7 0 3 q))
|
|
(list (list 7 7 7)))
|
|
|
|
(mk-test
|
|
"arith-progo-negative-start"
|
|
(run* q (arith-progo -3 2 4 q))
|
|
(list (list -3 -1 1 3)))
|
|
|
|
(mk-tests-run!)
|