Skip to content

Commit

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

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

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

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 d276384

Please sign in to comment.