Skip to content

The use of ?IMPLIES cuts down on test cases without replacement. #41

blt opened this Issue Jun 19, 2012 · 0 comments

2 participants

blt commented Jun 19, 2012

I have a BSON encoder/decoder that I've tested with PropEr, specifically by creating a bunch of bson:document()s and asserting that bson:decode/1 composed with bson:encode/1 is the identity function. See here.

The problem is this: not all bson:documents()s generated purely from type information are valid. I use ?IMPLIES coupled with bson_validate:valid/1 to remove invalid documents, but this chops down the total number of test cases that get run, by about half, in my experience.

How can I:

  • create documents from type information with constraints without heavy duplication of constraint code or
  • ensure that a fixed number of test cases are generated, even if some are necessarily discarded.

I note that mm.erl composes smaller functions to generate its test cases, but duplicating this approach in my library would make for relatively heavyweight tests and duplicate contextual information in my library, which I'd like to avoid if possible.

@manopapad manopapad was assigned Feb 26, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.