My code is automatically testing for values from -99 to 99 while using FsCheck.
Check.Quick test
where my test function takes integer values.
I would like to test using values from 1 to 4999.
By default, FsCheck generates integers between 1 and 100. You can change this by supplying a Config object to the Check.
let config = {
Config.Quick with
EndSize = 4999
}
Check.One(config,test)
EndSize indicates the size to use for the last test, when all the tests are passing. The size increases linearly between StartSize, which you can also set should you wish to generate test data in a range starting from some value other than 1, and EndSize. See the implementation of type Config
in https://github.com/fscheck/FsCheck/blob/master/src/FsCheck/Runner.fs
You can use
Gen.elements
combined withProp.forAll
:Gen.elements
takes a sequence of valid values and creates a uniform generator from that sequence.Prop.forAll
defines a property with that custom generator.You can combine it with FsCheck's Glue Library for xUnit.net, which is my preferred method: