takenobu-hs/ghci-hexcalc

Failing tests because of (==>)

qrilka opened this issue · 1 comments

Tests fail occasionally with output like the following:

src/Data/GHex.hs:1063: failure in expression `(x1 >= x2 && x2 >= 0 && x1 < hexBitSize) ==> (range1 $ bits x1 x2) == (x1,x2)'
*** Gave up! Passed only 97 tests; 1000 discarded tests.

without extra Arbitrary instance I have sketched only the following fix:

-- prop> forAll (arbitrary `suchThat` (\(x1, x2) -> x1 >= x2 && x2 >= 0 && x1 < hexBitSize)) $ \(x1,x2) -> range1 ( bits x1 x2) == (x1,x2)

qrilka, thank you for telling me about a wonderful solution!
I'll fix this in your way.
Thank you.