I generate user data with FsCheck Gen.
Suppose you have a function that returns Gen<'T>:
let chooseRectangle widthMax heightMax offset =
gen {
let! left = Gen.choose(0, widthMax-offset)
let! top = Gen.choose(0, heightMax-offset)
let! width = Gen.choose(offset, widthMax-left)
let! height = Gen.choose(offset, heightMax-top)
return { Left=left
Top=top
Width=width
Height=height
}
}
which is then used to generate data:
Gen.sample 0 10 (chooseRectangle 400 200 10)
- argument size(first) used in this case, and does it affect the alteration of values?
source
share