mightybyte / armor

Protect against backwards-incompatible serializations
BSD 3-Clause "New" or "Revised" License
22 stars 1 forks source link

QuickCheck/Hedgehog integration? #2

Open axman6 opened 6 years ago

axman6 commented 6 years ago

It feels like the randomised generation of data that QuickCheck and Hedgehog offer are a good match for something like arbor - having something of type

testHedgehog :: Armored a => ArmorConfig -> String -> Gen a -> Test

feels pretty natural. Mainly wanted to open the issue to start the discussion because the library currently feels like it's half missing, but I'm not sure what the other half is! :)

mightybyte commented 6 years ago

Yeah, when I wrote the fake package I also had a similar feeling that it complimented armor very nicely. I wanted armor to be agnostic to your choice of test framework though. This is why it only depends on HUnit, which provides low level unit test infrastructure used by many of the test frameworks.

axman6 commented 6 years ago

I'm also very interested in your fake package, I'm considering using it to produce reasonable Gen values for Hedgehog 😄 (Also considering adding some Australian instances of things like addresses and phone numbers).

Do you have any thoughts how a package linking Armor and QuickCheck or Hedgehog would look? It feels like you would need to specify a static random seed (as well as how many examples you want to exist).

mightybyte commented 6 years ago

Nothing concrete. I tried to make them both as self-contained and composable as I could. The testArmorMany function was created specifically to facilitate this kind of interoperability. I'm definitely willing to add more general helpers like that.