Generator serving harcoded collection one item at a time

11 views
Skip to first unread message

Marc-André Laverdière

unread,
Feb 13, 2016, 1:42:22 AM2/13/16
to scalacheck
Hello everybody,

I love ScalaCheck, and I would love it even more if I could just get this one conceptual problem solve.

So I have a collection of items, and I want to generate things that are associated to each and every one item in the collection.

The best I can do, right now, is Gen.zip(Gen.oneOf(collection), ... ) and add a suchThat clause later down to check that all entries in the condition are present.

For instance, this might be Gen.mapOf(Gen.zip(Gen.oneOf(collection), ....)).suchThat{map => map.keySet == collection.toSet}

But that doesn't work, as I get lots of evaluations thrown out.

So how can I do it???

Reply all
Reply to author
Forward
0 new messages