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

Overwrite specific subtype of ADT? #249

Open
fdietze opened this issue Feb 25, 2022 · 0 comments
Open

Overwrite specific subtype of ADT? #249

fdietze opened this issue Feb 25, 2022 · 0 comments

Comments

@fdietze
Copy link

fdietze commented Feb 25, 2022

I have sealed trait similar to this one:

sealed trait Expression
object Expression {
  case class Identifier(name: String)          extends Expression
  case class Num(x: Double)                    extends Expression
  case class Add(x: Expression, y: Expression) extends Expression
}

Now, I'd like to exhaustively generate an Arbitrary[Expression] with scalacheck-shapeless, which uses my custom implementation of Arbitrary[Expression.Identifier]. Is that possible somehow?

My problem is that I have certain requirements on the name: String field in Identifier, which throws away too many test cases when I just filter the Arbitrary[Expression]

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

1 participant