Skip to content

Commit

Permalink
Merge pull request #136 from moodmosaic/topic/to-bigint-double
Browse files Browse the repository at this point in the history
Add ToBigInt overload for System.Double
  • Loading branch information
moodmosaic authored Oct 11, 2017
2 parents 720dd49 + ebfbaa3 commit 4b67a6e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Hedgehog/Numeric.fs
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,9 @@ type ToBigInt =
static member ToBigInt (x : uint64) =
bigint (int64 x)

static member ToBigInt (x : double) =
bigint x

static member inline Invoke (x :'Integral) : bigint =
let inline call_2 (a : ^a, b : ^b) =
((^a or ^b) : (static member ToBigInt : _ -> _) b)
Expand Down
14 changes: 14 additions & 0 deletions src/Hedgehog/Script.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,20 @@ Range.constantBounded ()
|> Gen.map (fun (ma, mi, bu, re) -> Version (ma, mi, bu, re))
|> Gen.printSample

//
// Printing Samples ― Prevent a generator from shrinking
//

Range.exponentialBounded ()
|> Gen.double
|> Gen.noShrink
|> Gen.printSample

Range.exponentialBounded ()
|> Gen.float
|> Gen.noShrink
|> Gen.printSample

//
// Printing Samples ― System.Net.IPAddress
//
Expand Down

0 comments on commit 4b67a6e

Please sign in to comment.