Last active
August 29, 2015 14:04
-
-
Save lbradstreet/d266fee39103ab9a69de to your computer and use it in GitHub Desktop.
Clojure test check uuid
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
(ns test-check-contrib.gen-uuid | |
(:require [clojure.string] | |
[clojure.test.check :as tc] | |
[clojure.test.check.generators :as gen] | |
[clojure.test.check.properties :as prop] | |
[clojure.test.check.clojure-test :refer [defspec]]) | |
(:import [java.util UUID]) | |
(:require [clojure.core :as core])) | |
(def gen-uuid-simple | |
(gen/fmap (fn [v] (UUID/randomUUID)) (gen/tuple))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you're interested in a deterministic approach (that should work with shrinking) I've written a pure test.check version that relies on
java.util.UUID/fromString
.