;; lib/minikanren/tests/types.sx — type-predicate goals.

(mk-test
  "numbero-on-int"
  (run* q (numbero 5))
  (list (make-symbol "_.0")))
(mk-test "numbero-on-string" (run* q (numbero "5")) (list))
(mk-test "numbero-on-symbol" (run* q (numbero (quote x))) (list))
(mk-test "numbero-on-list" (run* q (numbero (list 1))) (list))

(mk-test
  "stringo-on-string"
  (run* q (stringo "hi"))
  (list (make-symbol "_.0")))
(mk-test "stringo-on-int" (run* q (stringo 5)) (list))
(mk-test
  "stringo-on-keyword"
  (run* q (stringo :k))
  (list (make-symbol "_.0")))  ;; SX keywords ARE strings

(mk-test
  "symbolo-on-symbol"
  (run* q (symbolo (quote x)))
  (list (make-symbol "_.0")))
(mk-test "symbolo-on-string" (run* q (symbolo "x")) (list))
(mk-test "symbolo-on-int" (run* q (symbolo 5)) (list))

;; --- combine with membero for type-filtered enumeration ---

(mk-test
  "membero-numbero-filter"
  (run*
    q
    (fresh
      (x)
      (membero x (list 1 "a" 2 "b" 3))
      (numbero x)
      (== q x)))
  (list 1 2 3))

(mk-test
  "membero-stringo-filter"
  (run*
    q
    (fresh
      (x)
      (membero x (list 1 "a" 2 "b" 3))
      (stringo x)
      (== q x)))
  (list "a" "b"))

(mk-tests-run!)
