;; lib/minikanren/tests/foldr-o.sx — relational right fold.

(mk-test
  "foldr-o-empty"
  (run* q (foldr-o conso (list) (list 99) q))
  (list (list 99)))

(mk-test
  "foldr-o-conso-rebuilds-list"
  (run* q (foldr-o conso (list 1 2 3) (list) q))
  (list (list 1 2 3)))

(mk-test
  "foldr-o-appendo-flattens"
  (run*
    q
    (foldr-o
      appendo
      (list
        (list 1 2)
        (list 3)
        (list 4 5))
      (list)
      q))
  (list (list 1 2 3 4 5)))

(mk-test
  "foldr-o-with-acc-init"
  (run*
    q
    (foldr-o
      conso
      (list 1 2)
      (list 9 9)
      q))
  (list (list 1 2 9 9)))

(mk-tests-run!)
