I have a function for generating doubles in the range:
let gen_doublein = fun mx mn -> Arb.generate<float> |> Gen.suchThat ( (>) mx ) |> Gen.suchThat ( (<) mn )
and then a function to create an array of 2 of them:
let gen_params:Gen<double array> = gen { let! x = gen_doublein 0.0 20000.0 let! y = gen_doublein 0.0 2000.0 return [| x;y|] }
I put:
static member arb_params = Arb.fromGen gen_params
in the Generator class and register it. Everything seems OK. To verify that everything is in order, I:
let f2 (xs:double array) :double= exp (-2.0*xs.[0]) + xs.[1]*exp (-2.0*xs.[0]) let fcheck fn xs = fn xs > 0.0
then using the array generator 'arrayOfLength':
Check.Quick (Prop.forAll (arrayOfLength 2) (fcheck f2))
works as expected, however:
Check.Quick (Prop.forAll (Generators.arb_params) (fcheck f2))
just starts doing some calculations and never returns. f # guru, please help.
source share