mk: subseto — every element of l1 is in l2
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 26s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 26s
Recursive: empty l1 trivially holds; otherwise the head is in l2 (via membero) and the tail is a subset. Duplicates in l1 are allowed since each is independently checked. 7 new tests, 456/456 cumulative.
This commit is contained in:
62
lib/minikanren/tests/subseto.sx
Normal file
62
lib/minikanren/tests/subseto.sx
Normal file
@@ -0,0 +1,62 @@
|
||||
;; lib/minikanren/tests/subseto.sx — every element of l1 is in l2.
|
||||
|
||||
(mk-test
|
||||
"subseto-empty"
|
||||
(run* q (subseto (list) (list 1 2 3)))
|
||||
(list (make-symbol "_.0")))
|
||||
|
||||
(mk-test
|
||||
"subseto-singleton-yes"
|
||||
(run*
|
||||
q
|
||||
(subseto (list 2) (list 1 2 3)))
|
||||
(list (make-symbol "_.0")))
|
||||
|
||||
(mk-test
|
||||
"subseto-singleton-no"
|
||||
(run*
|
||||
q
|
||||
(subseto (list 99) (list 1 2 3)))
|
||||
(list))
|
||||
|
||||
(mk-test
|
||||
"subseto-multi-yes"
|
||||
(run
|
||||
1
|
||||
q
|
||||
(subseto
|
||||
(list 1 3)
|
||||
(list 1 2 3 4)))
|
||||
(list (make-symbol "_.0")))
|
||||
|
||||
(mk-test
|
||||
"subseto-multi-no"
|
||||
(run*
|
||||
q
|
||||
(subseto
|
||||
(list 1 99)
|
||||
(list 1 2 3)))
|
||||
(list))
|
||||
|
||||
(mk-test
|
||||
"subseto-equal-sets"
|
||||
(run
|
||||
1
|
||||
q
|
||||
(subseto
|
||||
(list 1 2 3)
|
||||
(list 1 2 3)))
|
||||
(list (make-symbol "_.0")))
|
||||
|
||||
;; allow duplicates in l1 — each just needs membership in l2.
|
||||
(mk-test
|
||||
"subseto-duplicates-allowed"
|
||||
(run
|
||||
1
|
||||
q
|
||||
(subseto
|
||||
(list 1 1 2)
|
||||
(list 1 2 3)))
|
||||
(list (make-symbol "_.0")))
|
||||
|
||||
(mk-tests-run!)
|
||||
Reference in New Issue
Block a user