Skip to content

Commit

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

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

[<Test>]
let ``length is consistent`` () =
Check.QuickThrowOnFailure length<int>
Check.QuickThrowOnFailure length<string>
Check.QuickThrowOnFailure length<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 ed72789

Please sign in to comment.