Fork me on GitHub

Is there something in test.check for producing equal-but-internally-different data structures? (Trying to check if a serialization format is deterministic).


@lvh where two data structures are equal but will serialize/deserialize to something equal but distinct? e.g. clojure maps and records can be equal, but a record should round trip back to a record


Oh, right — that’s a good point 🙂


I guess I’m mostly thinking of issues like map key order or set order


Ah. Those two are interesting although, at least in clojure, I don’t think/don’t count them as part of the contract

lucasbradstreet19:08:27 might be handy if you’re interested in stuff like maps/sets/etc, though it wasn’t really built for what you want

Alex Miller (Clojure team)20:08:08

maps and sets are not ordered - equality does not consider them (and there are no guarantees around it)


I remember from the google groups discussion that the order of keys and the order of vals, on an identical? map, are guaranteed to be in the same order, but that was it


@lvh I think if you could enumerate the sort of distinctions you're aiming at it wouldn't be hard to put together yourself


(defn gen-tweak "Returns a generator of variants of x such that (= x x')" [x] ...)