Skip to content

Commit

Permalink
Added reportBool, reportRecheckBool, and reportRecheck (#269)
Browse files Browse the repository at this point in the history
  • Loading branch information
dharmaturtle authored Jan 15, 2021
1 parent 7058b4c commit 6b376a6
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 2 deletions.
24 changes: 24 additions & 0 deletions src/Hedgehog/Linq/Property.fs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@ type Property private () =
static member Report (property : Property<unit>, tests : int<tests>) : Report =
Property.report' tests property

[<Extension>]
static member Report (property : Property<bool>) : Report =
Property.reportBool property

[<Extension>]
static member Report (property : Property<bool>, tests : int<tests>) : Report =
Property.reportBool' tests property

[<Extension>]
static member Check (property : Property<unit>) : unit =
Property.check property
Expand Down Expand Up @@ -102,6 +110,22 @@ type Property private () =
static member Recheck (property : Property<bool>, size : Size, seed : Seed, tests : int<tests>) : unit =
Property.recheckBool' size seed tests property

[<Extension>]
static member ReportRecheck (property : Property<unit>, size : Size, seed : Seed) : Report =
Property.reportRecheck size seed property

[<Extension>]
static member ReportRecheck (property : Property<unit>, size : Size, seed : Seed, tests : int<tests>) : Report =
Property.reportRecheck' size seed tests property

[<Extension>]
static member ReportRecheck (property : Property<bool>, size : Size, seed : Seed) : Report =
Property.reportRecheckBool size seed property

[<Extension>]
static member ReportRecheck (property : Property<bool>, size : Size, seed : Seed, tests : int<tests>) : Report =
Property.reportRecheckBool' size seed tests property

[<Extension>]
static member Print (property : Property<unit>, tests : int<tests>) : unit =
Property.print' tests property
Expand Down
22 changes: 20 additions & 2 deletions src/Hedgehog/Property.fs
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,12 @@ module Property =
let report (p : Property<unit>) : Report =
report' 100<tests> p

let reportBool' (n : int<tests>) (p : Property<bool>) : Report =
bind p ofBool |> report' n

let reportBool (p : Property<bool>) : Report =
bind p ofBool |> report

let check' (n : int<tests>) (p : Property<unit>) : unit =
report' n p
|> Report.tryRaise
Expand All @@ -386,12 +392,24 @@ module Property =
with
| _ -> failure

let recheck' (size : Size) (seed : Seed) (n : int<tests>) (p : Property<unit>) : unit =
let reportRecheck' (size : Size) (seed : Seed) (n : int<tests>) (p : Property<unit>) : Report =
reportWith' false size seed n p

let reportRecheck (size : Size) (seed : Seed) (p : Property<unit>) : Report =
reportWith false size seed p

let reportRecheckBool' (size : Size) (seed : Seed) (n : int<tests>) (p : Property<bool>) : Report =
bind p ofBool |> reportRecheck' size seed n

let reportRecheckBool (size : Size) (seed : Seed) (p : Property<bool>) : Report =
bind p ofBool |> reportRecheck size seed

let recheck' (size : Size) (seed : Seed) (n : int<tests>) (p : Property<unit>) : unit =
reportRecheck' size seed n p
|> Report.tryRaise

let recheck (size : Size) (seed : Seed) (p : Property<unit>) : unit =
reportWith false size seed p
reportRecheck size seed p
|> Report.tryRaise

let recheckBool' (size : Size) (seed : Seed) (n : int<tests>) (g : Property<bool>) : unit =
Expand Down

0 comments on commit 6b376a6

Please sign in to comment.