hedgehogqa / fsharp-hedgehog

Release with confidence, state-of-the-art property testing for .NET.
https://hedgehogqa.github.io/fsharp-hedgehog/
Other
271 stars 31 forks source link

Add a Gen.timeSpan function? #440

Closed njlr closed 11 months ago

njlr commented 11 months ago

Could be this?

  let timeSpan (range : Range<TimeSpan>) : Gen<TimeSpan> =
    Gen.int64 (range |> Range.map (fun x -> x.Ticks))
    |> Gen.map TimeSpan.FromTicks

Would a PR be accepted?

TysonMN commented 11 months ago

Yes, this is good.

Add as this:

  let timeSpan (range: Range<TimeSpan>) : Gen<TimeSpan> =
    range
    |> Range.map (fun x -> x.Ticks)
    |> Gen.int64
    |> Gen.map TimeSpan.FromTicks

Please also add a test.