Subject: | test relies on shuffling |
Date: | Tue, 27 Aug 2013 15:02:47 +0100 |
To: | bug-Sereal-Encoder [...] rt.cpan.org |
From: | Zefram <zefram [...] fysh.org> |
Sereal-Encoder randomly fails its tests one time out of N, because
the sort_keys test checks that operation without the sort_keys option
actually generates different results for each of four runs on equivalent
data structures. I haven't determined N either in theory or in practice,
looks like N > 20. I've actually seen the test fail twice.
It looks like the test tries to check whether it's actually got hashes
using different orders; maybe the new hash randomisation is causing
reordering that the test doesn't know about. Anyway, it's testing
behaviour that isn't guaranteed. For my use I've disabled that test,
patch attached. If you want to be cleverer you could compare several
encoding runs and look for some proportion of outputs being distinct,
rather than all being distinct, and you can tune the number of trials and
the threshold to bring the probability of false failure below some target.
Bigger picture: I question the value of supporting non-sort_keys
operation. Sorting isn't that expensive.
-zefram
Message body is not shown because sender requested not to inline it.