I have an enumeration RankAndFile
with 64 values representing the squares on a chessboard.
I would like a obtain a ScalaCheck Arbitrary[(RankAndFile, RankAndFile)]
but I'm not sure how.
So far I have:
implicit val arbitraryRankAndFile =
Arbitrary(Gen.oneOf(RankAndFile.values.toSeq))
implicit val arbitraryRankAndFilePair =
Arbitrary.arbTuple2[RankAndFile, RankAndFile]
But the compiler complains on the second statement that it could not find implicit value for parameter a1: org.scalacheck.Arbitrary[RankAndFile.RankAndFile]
. Certainly this is because the type of arbitraryRankAndFile
is Arbitrary[Gen[RankAndFile]]
.
What should I have instead?
The arbitrary single value was enough:
The property to be checked took a tuple of
RankAndFile
which could be satisfied by scalacheck from this singleArbitrary
value. The methodArbitrary.arbTuple2
was a red-herring.