Skip to content

Commit

Permalink
windowed returns succeeding elements
Browse files Browse the repository at this point in the history
  • Loading branch information
forki committed Jul 29, 2015
1 parent a916251 commit 76a41d4
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/fsharp/FSharp.Core.PropertyTests/ListProperties.fs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,19 @@ let ``windowed returns list with correct length`` () =
Check.QuickThrowOnFailure windowed_and_length<string>
Check.QuickThrowOnFailure windowed_and_length<NormalFloat>

let windowed_and_order<'a when 'a : equality> (listsize:PositiveInt) size =
size > 1 ==> (lazy
let xs = [1..(int listsize)]

List.windowed size xs
|> List.forall (fun w -> w = List.sort w))

[<Test>]
let ``windowed returns succeeding elements`` () =
Check.QuickThrowOnFailure windowed_and_order<int>
Check.QuickThrowOnFailure windowed_and_order<string>
Check.QuickThrowOnFailure windowed_and_order<NormalFloat>

let windowed_and_pairwise<'a when 'a : equality> (xs : 'a list) =
let a = List.windowed 2 xs
let b = List.pairwise xs |> List.map (fun (x,y) -> [x;y])
Expand Down

0 comments on commit 76a41d4

Please sign in to comment.