alphaHeavy / protobuf

An implementation of Google's Protocol Buffers in Haskell.
http://hackage.haskell.org/package/protobuf
BSD 3-Clause "New" or "Revised" License
96 stars 18 forks source link

New QuickCheck breaks prop_req_out_of_range #30

Open nick8325 opened 8 years ago

nick8325 commented 8 years ago

In the latest QuickCheck, prop_req_out_of_range will only be tested 1 time, not 100. This is because QuickCheck now assumes that any property without a forAll (or similar) is deterministic.

The easiest way to fix it is to use a normal quantifier instead of MkProperty. Something like the following (untested) should keep the types as you need them:

prop_req_out_of_range :: forall a . (Arbitrary (Value a), EncodeWire a) => Proxy a -> Property
prop_req_out_of_range _ = property $ \(Blind (val :: Value a)) ->
  prop_req_reify_out_of_range (Just val) prop_encode_fail

Alternatively, you can wrap the property in again to tell QuickCheck that it's nondeterministic.

NathanHowell commented 8 years ago

It seems like all of the properties are only being evaluated once with QuickCheck 2.9, not just prop_req_out_of_range... further investigation is needed. Any ideas what else I should look at?

nick8325 commented 8 years ago

Sorry, the change we made to QuickCheck turned out to be a bit too aggressive. If you just change MkProperty to property in prop_req_out_of_range then it should work, and all the other properties should work too. (This requires QuickCheck 2.9.2 which I just released.)