test-check

lvh 2016-08-29T17:06:57.000002Z

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

lucasbradstreet 2016-08-29T18:57:23.000003Z

@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

lvh 2016-08-29T18:58:50.000004Z

Oh, right — that’s a good point 🙂

lvh 2016-08-29T18:59:27.000005Z

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

lucasbradstreet 2016-08-29T19:02:28.000006Z

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

lucasbradstreet 2016-08-29T19:03:27.000007Z

https://github.com/ztellman/collection-check might be handy if you’re interested in stuff like maps/sets/etc, though it wasn’t really built for what you want

alexmiller 2016-08-29T20:23:08.000009Z

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

lucasbradstreet 2016-08-29T20:34:13.000010Z

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

2016-08-29T23:24:48.000011Z

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

2016-08-29T23:25:12.000012Z

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