Skip to content

Instantly share code, notes, and snippets.

@reiddraper
Created October 23, 2013 00:32
Show Gist options
  • Save reiddraper/7110561 to your computer and use it in GitHub Desktop.
Save reiddraper/7110561 to your computer and use it in GitHub Desktop.
Uses simple-check to test that sorting is idempotent.
(require '[simple-check.core :as sc])
(require '[simple-check.generators :as gen])
(require '[simple-check.properties :as prop])
(def sort-idempotent-prop
(prop/for-all [v (gen/vector gen/int)]
(= (sort v) (sort (sort v)))))
(sc/quick-check 100 sort-idempotent-prop)
;; => {:result true, :num-tests 100, :seed 1382488326530}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment