Skip to content

Commit

Permalink
tryFindBack is consistent
Browse files Browse the repository at this point in the history
  • Loading branch information
forki committed Jul 29, 2015
1 parent 73c59c7 commit d40c85f
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1030,3 +1030,15 @@ let ``tryFind is consistent`` () =
Check.QuickThrowOnFailure tryFind<int>
Check.QuickThrowOnFailure tryFind<string>
Check.QuickThrowOnFailure tryFind<NormalFloat>

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

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

0 comments on commit d40c85f

Please sign in to comment.