Deewiant / glob

Haskell library for glob matching
https://deewiant.iki.fi/projects/glob/
Other
25 stars 8 forks source link

Intermittent failure on prop_increasingSeq #26

Closed TikhonJelvis closed 6 years ago

TikhonJelvis commented 6 years ago

prop_increasingSeq failed when I was building Glob but worked after I restarted the build. I'm guessing it's a subtle edge-case that QuickCheck's randomness doesn't always catch.

Here's an excerpt of the test suite output:

Utils:
  overlapperLosesNoInfo: [OK, passed 1000 tests]
  increasingSeq: [Failed]
*** Failed! Falsifiable (after 627 tests and 14 shrinks): 
8388609.0
[]
(used seed 3011364568314363159)
  addToRange: [Arguments exhausted after 972 tests]

This is on Glob-0.8.0 and I haven't tested it with the newer version.

TikhonJelvis commented 6 years ago

It looks like 8388608 is 2^23, which is a magic number in the test property:

prop_increasingSeq a xs =
   let s = fst . increasingSeq $ a:xs
    in abs a <= 2^(23 :: Int) ==> s == reverse [a .. head s]

I'm guessing it's a bug with the defined test property related to this. Not sure exactly why it's coming up though.

Deewiant commented 6 years ago

Looks like a fencepost error in the test, yeah. Originally I figured I'd use floats in the test properties here to try and tease out unusual bugs but the end result has just been silly stuff like this. 😄 Will fix, thanks for the report.