Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion: add method to define a flat list of classify conditions to collect statistics on Prop #566

Open
dabd opened this issue Sep 26, 2019 · 2 comments

Comments

@dabd
Copy link

dabd commented Sep 26, 2019

When defining multiple classify conditions to collect statistics on a property, the currently available classify methods on Prop require nesting each classify call resulting in deeply nested code. A method that accepts a flat list of classify conditions would make it more pleasant to use. Something like (using Stream so we don't evaluate all conditions prematurely):

  @scala.annotation.tailrec
  def classify(conditions: Stream[(Boolean, Any, Any)])(prop: Prop): Prop = conditions match {
    case Stream.Empty => prop
    case h #:: Stream.Empty =>
      if (h._1) collect(h._2)(prop) else collect(h._3)(prop)
    case h #:: t =>
      classify(t)(Prop.classify(h._1, h._2, h._3)(prop))
  }
@non
Copy link
Contributor

non commented Sep 27, 2019

@dabd I haven't dug into the classification code much, so I'll need some time to think about it. Thanks for suggesting this.

@dabd
Copy link
Author

dabd commented Oct 2, 2019

@non In your talk about scalacheck you mention in one of the slides that we should pay attention to the distribution and range of generators. It would be useful to have tools to look at test case distribution on par with Haskell's QuickCheck tools such as cover and similar. checkCoverage looks useful as a better stopping criteria than choosing an arbitrary minSuccessfulTests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants