I want to run scalacheck on a sample dataset that I have in a file. How do I create a generator that reads data from this file and allows me to check a property on it?
Asked
Active
Viewed 75 times
1 Answers
0
You could read in all the data in advance and then use
Gen.oneOf(dataSet)
to randomly choose one of the values in the set.
If however the data set is too big to read in at once you could just generate the access index using
Gen.choose(1, setSize)
and read only the selected entry.

johanneslink
- 4,877
- 1
- 20
- 37
-
on the second approach. With the second approach i still can only read a subset of data right? Not the whole dataset – indraneel Nov 08 '19 at 06:45
-
So you want to test against all entries in the file? That would be parameterized testing. I don’t know if that’s supported by Scalacheck. – johanneslink Nov 08 '19 at 10:26