Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 32s
Composes two appendos: l = front ++ s ++ back, equivalently (appendo front-and-s back l) and (appendo front s front-and-s). Goal order matters: doing the (appendo ground:l) split first makes the search finitary; the second appendo is then deterministic given front-and-s and ground s. Reversing the order causes divergence on failing inputs (the front search becomes unbounded). 7 new tests, 405/405 cumulative.
61 lines
924 B
Plaintext
61 lines
924 B
Plaintext
;; lib/minikanren/tests/subo.sx — contiguous-sublist relation.
|
|
|
|
(mk-test
|
|
"subo-simple-found"
|
|
(run*
|
|
q
|
|
(subo
|
|
(list 2 3)
|
|
(list 1 2 3 4)))
|
|
(list (make-symbol "_.0")))
|
|
|
|
(mk-test
|
|
"subo-not-contiguous-fails"
|
|
(run*
|
|
q
|
|
(subo
|
|
(list 2 4)
|
|
(list 1 2 3 4)))
|
|
(list))
|
|
|
|
(mk-test
|
|
"subo-full-list-found"
|
|
(run*
|
|
q
|
|
(subo
|
|
(list 1 2 3)
|
|
(list 1 2 3)))
|
|
(list (make-symbol "_.0")))
|
|
|
|
(mk-test
|
|
"subo-empty-list-found"
|
|
(let
|
|
((res (run* q (subo (list) (list 1 2 3)))))
|
|
(= (len res) 4))
|
|
true)
|
|
|
|
(mk-test
|
|
"subo-prefix"
|
|
(run*
|
|
q
|
|
(subo
|
|
(list 1 2)
|
|
(list 1 2 3 4)))
|
|
(list (make-symbol "_.0")))
|
|
|
|
(mk-test
|
|
"subo-suffix"
|
|
(run*
|
|
q
|
|
(subo
|
|
(list 3 4)
|
|
(list 1 2 3 4)))
|
|
(list (make-symbol "_.0")))
|
|
|
|
(mk-test
|
|
"subo-strings"
|
|
(run* q (subo (list "b" "c") (list "a" "b" "c" "d")))
|
|
(list (make-symbol "_.0")))
|
|
|
|
(mk-tests-run!)
|