leanovate / gopter

GOlang Property TestER
MIT License
599 stars 40 forks source link

Fix some problems related to shrinks #1

Closed exarkun closed 8 years ago

exarkun commented 8 years ago

This change expands commonGeneratorTest to include code that exercises the generator's shrinker (and sieve). It adds the assertion that, if there is a shrinker, it must be able to shrink all the values generated and the resulting shrunk values must also satisfy the predicate given to commonGeneratorTest.

Also included are changes to fix bugs uncovered by this change:

Incidentally, some gofmt changes are included.

Branch was developed in collaboration with @itamarst (and really he did more than I did).

Thanks for Gopter!

codecov-io commented 8 years ago

Current coverage is 93.07%

Merging #1 into master will increase coverage by +0.15% as of ce9f18c

@@            master      #1   diff @@
======================================
  Files           44      44       
  Stmts         1569    1575     +6
  Branches       220     222     +2
  Methods          0       0       
======================================
+ Hit           1458    1466     +8
  Partial         30      30       
+ Missed          81      79     -2

Review entire Coverage Diff as of ce9f18c

Powered by Codecov. Updated on successful CI builds.

untoldwind commented 8 years ago

Overall looks good to me. The thing with the shrinker for string is a bit surpriseing though. Will investigate that a bit further. (Most likely the Identifier() generator has the same issue.)

untoldwind commented 8 years ago

Ah I see, that was a refactoring issue, the original SliceShrinker was able to handle string als well as slices. Good finding.

Anyhow, did a bit of a cleanup, fixed the identifier gen as well and added your temporary test as an example to the "prop" package.

exarkun commented 8 years ago

Hooray, thanks! :)