Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomer-ben-david/25a515a5b9262bc766fe to your computer and use it in GitHub Desktop.
Save tomer-ben-david/25a515a5b9262bc766fe to your computer and use it in GitHub Desktop.
scalacheck generate a complex class
case class MyCaseClass(e: SomeEnum, l: Long, d: SomeDouble)
def ratiosGen: Gen[MyCaseClass] = for {
e <- Gen.oneOf(Seq(State.ALWAYS, State.NONE, State.NEVER, null)) // one of the items.
l <- Arbitrary.arbitrary[Long]
d <- Arbitrary.arbitrary[Double]
} yield MyCaseClass(e, l, d)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment