Created
November 13, 2016 03:58
-
-
Save artur-s/bf809bd978e2be8a4cbd427d39d785d6 to your computer and use it in GitHub Desktop.
FsCheck generator for positive decimals constrained to more realistic money amounts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open System | |
open FsCheck | |
let positiveDecimal = gen { | |
let! low = Gen.elements [0..1000] | |
let! mid = Gen.elements [0..100] | |
let! scale = Gen.elements [0..5] | |
return! | |
Gen.elements [ | |
Decimal(low, mid, 0, false, byte scale) | |
Decimal(low, 0, 0, false, byte scale) ] | |
} | |
// positiveDecimal |> FsCheck.Gen.sample 0 50 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment