Created
October 23, 2013 00:32
-
-
Save reiddraper/7110561 to your computer and use it in GitHub Desktop.
Uses simple-check to test that sorting is idempotent.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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