From e23a20deb114db734fa0b5250f8d3bddb3af3d1c Mon Sep 17 00:00:00 2001 From: Steffen Forkmann Date: Thu, 2 Jul 2015 15:59:11 +0200 Subject: [PATCH] splitAt is consistent --- .../CollectionModulesConsistency.fs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/fsharp/FSharp.Core.PropertyTests/CollectionModulesConsistency.fs b/src/fsharp/FSharp.Core.PropertyTests/CollectionModulesConsistency.fs index 4a75cdf25d7..36d4588858b 100644 --- a/src/fsharp/FSharp.Core.PropertyTests/CollectionModulesConsistency.fs +++ b/src/fsharp/FSharp.Core.PropertyTests/CollectionModulesConsistency.fs @@ -972,6 +972,18 @@ let ``sumBy is consistent`` () = Check.QuickThrowOnFailure sumBy Check.QuickThrowOnFailure sumBy +let splitAt<'a when 'a : equality> (xs : 'a []) index = + // no seq version + let l = run (fun () -> xs |> List.ofArray |> List.splitAt index |> fun (a,b) -> List.toArray a,List.toArray b) + let a = run (fun () -> xs |> Array.splitAt index) + l = a + +[] +let ``splitAt is consistent`` () = + Check.QuickThrowOnFailure splitAt + Check.QuickThrowOnFailure splitAt + Check.QuickThrowOnFailure splitAt + let splitInto<'a when 'a : equality> (xs : 'a []) count = let s = run (fun () -> xs |> Seq.splitInto count |> Seq.map Seq.toArray |> Seq.toArray) let l = run (fun () -> xs |> List.ofArray |> List.splitInto count |> Seq.map Seq.toArray |> Seq.toArray)