How can I establish conditions on test inputs when performing Property-based testing?
For example, the following code generates bools when I need ints:
Gen.map (fun v -> v > 0)
Here's the function:
[<Property(QuietOnSuccess = true)>]
let ``number of cells in grid equals rowcount squared`` () =
let values = Arb.generate<int> |> Gen.map (fun v -> v > 0)
|> Arb.fromGen
I need something like this so that I can get qualifying ints:
Gen.filter (fun v -> v > 0)
However, I just don't see an option for this.
Any suggestions?
Gen.where
orGen.suchThat
? – Mark SeemannGen.filter
to FsCheck. – Mark Seemann