Skip to content

Commit

Permalink
head is the same as item 0
Browse files Browse the repository at this point in the history
  • Loading branch information
forki committed Jul 29, 2015
1 parent 6587027 commit 7735e2c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/fsharp/FSharp.Core.PropertyTests/ListProperties.fs
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,18 @@ let ``head is the same as last of a reversed list`` () =
Check.QuickThrowOnFailure head_and_last<string>
Check.QuickThrowOnFailure head_and_last<NormalFloat>

let head_and_item<'a when 'a : comparison> (xs : list<'a>) =
let a = runAndCheckErrorType (fun () -> xs |> List.item 0)
let b = runAndCheckErrorType (fun () -> List.head xs)

a = b

[<Test>]
let ``head is the same as item 0`` () =
Check.QuickThrowOnFailure head_and_item<int>
Check.QuickThrowOnFailure head_and_item<string>
Check.QuickThrowOnFailure head_and_item<NormalFloat>

let length_and_isEmpty<'a when 'a : comparison> (xs : list<'a>) =
let a = List.length xs = 0
let b = List.isEmpty xs
Expand Down

0 comments on commit 7735e2c

Please sign in to comment.