(use-modules (tests)
             (fibers)
             (unit-test)
             (knots sort))

(run-fibers-for-tests
 (lambda ()
   (assert-equal
    '()
    (fibers-sort! '() <))

   (assert-equal
    '(1)
    (fibers-sort! (list 1) <))

   (assert-equal
    '(1)
    (fibers-sort! (list 1) < #:parallelism 10))

   (assert-equal
    '(1 2)
    (fibers-sort! (list 2 1) <))

   (assert-equal
    (sort (reverse! (iota 100)) <)
    (fibers-sort! (reverse! (iota 100)) < #:parallelism 10))))

(display "sort test finished successfully\n")
