Hi,
I'm doing something like:
(def valid-email (gen/fmap (fn [[name domain]] (str name "@" domain))
(gen/tuple (gen/not-empty gen/string) gen/uuid)))
(defspec test-email
100
(for-all [email valid-email]
(tx-email! (get-in system [:database :conn]) email)
The email has a unique-by-value constraint (in datomic) and this
transaction fails occasionally because the unique-by-value constraint
fails. However, this:
(= 1000 (count (distinct (gen/sample valid-email 1000))))
always succeeds. It seems like for-all reuses a generated value sometimes.
Could this be possible? Or maybe this happens when test.check tries to
shrink the test case? Except I don't see any other error, one that would
cause it to try to shrink.
Thanks.
-Tom
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.