leanovate / gopter

GOlang Property TestER
MIT License
598 stars 40 forks source link

Allow DerivedGen to work with OneGenOf() #56

Closed philandstuff closed 5 years ago

philandstuff commented 5 years ago

DerivedGen encodes an assumption that the sieve for each GenResult from a Gen will always be the same. It captures a single sieve for a Gen and then applies it blindly to subsequent samples.

This interacts poorly with OneGenOf, which can easily emit GenResults that have different sieves, because they originate from different generators.

This commit fixes all that: DerivedGen only uses the sieve that came with a GenResult; it doesn't save an earlier sieve for use later. It adds a test TestDeriveGenVaryingSieve to capture this use case.