mk: sortedo — list is non-decreasing (intarith)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 25s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 25s
Three conde clauses: empty list / singleton list / two-or-more (where the first two satisfy lteo-i and the rest is recursively sorted). Uses ground-only integer comparison (intarith), so the input list must walk to ground integers. 7 new tests, 463/463 cumulative.
This commit is contained in:
40
lib/minikanren/tests/sortedo.sx
Normal file
40
lib/minikanren/tests/sortedo.sx
Normal file
@@ -0,0 +1,40 @@
|
||||
;; lib/minikanren/tests/sortedo.sx — checks list is non-decreasing.
|
||||
|
||||
(mk-test
|
||||
"sortedo-empty"
|
||||
(run* q (sortedo (list)))
|
||||
(list (make-symbol "_.0")))
|
||||
|
||||
(mk-test
|
||||
"sortedo-singleton"
|
||||
(run* q (sortedo (list 42)))
|
||||
(list (make-symbol "_.0")))
|
||||
|
||||
(mk-test
|
||||
"sortedo-ascending"
|
||||
(run* q (sortedo (list 1 2 3 4)))
|
||||
(list (make-symbol "_.0")))
|
||||
|
||||
(mk-test
|
||||
"sortedo-with-equal-adjacent"
|
||||
(run*
|
||||
q
|
||||
(sortedo (list 1 1 2 2 3)))
|
||||
(list (make-symbol "_.0")))
|
||||
|
||||
(mk-test
|
||||
"sortedo-out-of-order-fails"
|
||||
(run* q (sortedo (list 1 3 2)))
|
||||
(list))
|
||||
|
||||
(mk-test
|
||||
"sortedo-descending-fails"
|
||||
(run* q (sortedo (list 3 2 1)))
|
||||
(list))
|
||||
|
||||
(mk-test
|
||||
"sortedo-pair-equal"
|
||||
(run* q (sortedo (list 5 5)))
|
||||
(list (make-symbol "_.0")))
|
||||
|
||||
(mk-tests-run!)
|
||||
Reference in New Issue
Block a user