Skip to content

Commit

Permalink
list isEmpty if and only if length is 0
Browse files Browse the repository at this point in the history
  • Loading branch information
forki committed Jul 29, 2015
1 parent 6020bea commit 14abd70
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 @@ -148,6 +148,18 @@ let ``head fails when list isEmpty`` () =
Check.QuickThrowOnFailure head_and_isEmpty<string>
Check.QuickThrowOnFailure head_and_isEmpty<NormalFloat>

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

a = b

[<Test>]
let ``list isEmpty if and only if length is 0`` () =
Check.QuickThrowOnFailure length_and_isEmpty<int>
Check.QuickThrowOnFailure length_and_isEmpty<string>
Check.QuickThrowOnFailure length_and_isEmpty<NormalFloat>

let findBack_and_exists<'a when 'a : comparison> (xs : list<'a>) f =
let a =
try
Expand Down

0 comments on commit 14abd70

Please sign in to comment.