Skip to content

Commit

Permalink
exists is consistent
Browse files Browse the repository at this point in the history
  • Loading branch information
forki committed Jul 29, 2015
1 parent 350a7c1 commit 453bcd5
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,18 @@ let ``except is consistent`` () =
Check.QuickThrowOnFailure except<string>
Check.QuickThrowOnFailure except<NormalFloat>

let exists<'a when 'a : equality> (xs : 'a []) f =
let s = xs |> Seq.exists f
let l = xs |> List.ofArray |> List.exists f
let a = xs |> Array.exists f
s = a && l = a

[<Test>]
let ``exists is consistent`` () =
Check.QuickThrowOnFailure exists<int>
Check.QuickThrowOnFailure exists<string>
Check.QuickThrowOnFailure exists<NormalFloat>

let sort<'a when 'a : comparison> (xs : 'a []) =
let s = xs |> Seq.sort
let l = xs |> List.ofArray |> List.sort
Expand Down

0 comments on commit 453bcd5

Please sign in to comment.