#!/usr/bin/env nujel
(import (rng) :random)
(defn test-sort (times sort-func)
(def l #nil)
(def r (:new rng))
(dotimes (i times)
(set! l (cons (:rng! r) l)))
(def sorted (sort-func l))
(while sorted
(when (and (cadr sorted)
(> (car sorted) (cadr sorted)))
(throw :list-not-sorted))
(cdr! sorted)))
(test-sort 1500 list-merge-sort)
(return :success)