Skip to content

Commit

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

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

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

0 comments on commit 25c9101

Please sign in to comment.