From edea043629ae9eca3181b061417f82274be3c306 Mon Sep 17 00:00:00 2001 From: Kurt Schelfthout Date: Sun, 6 Nov 2016 16:59:32 +0000 Subject: [PATCH] Upgrade FsCheck to 2.6.2. Due to a change in FsCheck, tests run with a greater effective size (i.e. generated lists, arrays, strings etc are significantly longer). To make the tests complete in reasonable time the following changes were made. First, the maximum size of the test runs in the CollectionModulesConsistency and AsyncModule tests was changed to 25 and 20 resp. (down from the default, 50). Second, the `haveSameElements` function was optimized so it is no longer quadratic. (Also note this function contained a typo bug: `&& ys |>`, not xs.) --- packages.config | 2 +- src/FSharpSource.targets | 4 +- .../CollectionModulesConsistency.fs | 586 +++++++++--------- .../Microsoft.FSharp.Collections/Utils.fs | 6 +- .../Microsoft.FSharp.Control/AsyncModule.fs | 2 +- 5 files changed, 302 insertions(+), 298 deletions(-) diff --git a/packages.config b/packages.config index bc6a2579672..a805c432caf 100644 --- a/packages.config +++ b/packages.config @@ -22,7 +22,7 @@ - + diff --git a/src/FSharpSource.targets b/src/FSharpSource.targets index 2d8455c5dae..c038d9b5b3d 100644 --- a/src/FSharpSource.targets +++ b/src/FSharpSource.targets @@ -105,8 +105,8 @@ 3.5.0.0 $(FSharpSourcesRoot)\..\packages\NUnit.$(NUnitVersion)\lib\net45 $(FSharpSourcesRoot)\..\packages\NUnit.ConsoleRunner\$(NUnitVersion)\tools\ - 2.0.3 - 2.0.3.0 + 2.6.2 + 2.6.2.0 $(FSharpSourcesRoot)\..\packages\FsCheck.$(FsCheckVersion)\lib\ diff --git a/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/CollectionModulesConsistency.fs b/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/CollectionModulesConsistency.fs index f979844bd0a..c358409b4b1 100644 --- a/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/CollectionModulesConsistency.fs +++ b/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/CollectionModulesConsistency.fs @@ -8,6 +8,8 @@ open NUnit.Framework open FsCheck open Utils +let smallerSizeCheck testable = Check.One({ Config.QuickThrowOnFailure with EndSize = 25 }, testable) + /// helper function that creates labeled FsCheck properties for equality comparisons let consistency name sqs ls arr = (sqs = arr) |@ (sprintf "Seq.%s = '%A', Array.%s = '%A'" name sqs name arr) .&. @@ -22,9 +24,9 @@ let allPairs<'a when 'a : equality> (xs : list<'a>) (xs2 : list<'a>) = [] let ``allPairs is consistent`` () = - Check.QuickThrowOnFailure allPairs - Check.QuickThrowOnFailure allPairs - Check.QuickThrowOnFailure allPairs + smallerSizeCheck allPairs + smallerSizeCheck allPairs + smallerSizeCheck allPairs let append<'a when 'a : equality> (xs : list<'a>) (xs2 : list<'a>) = let s = xs |> Seq.append xs2 |> Seq.toArray @@ -35,9 +37,9 @@ let append<'a when 'a : equality> (xs : list<'a>) (xs2 : list<'a>) = [] let ``append is consistent`` () = - Check.QuickThrowOnFailure append - Check.QuickThrowOnFailure append - Check.QuickThrowOnFailure append + smallerSizeCheck append + smallerSizeCheck append + smallerSizeCheck append let averageFloat (xs : NormalFloat []) = let xs = xs |> Array.map float @@ -48,7 +50,7 @@ let averageFloat (xs : NormalFloat []) = [] let ``average is consistent`` () = - Check.QuickThrowOnFailure averageFloat + smallerSizeCheck averageFloat let averageBy (xs : float []) f = let xs = xs |> Array.map float @@ -61,7 +63,7 @@ let averageBy (xs : float []) f = [] let ``averageBy is consistent`` () = - Check.QuickThrowOnFailure averageBy + smallerSizeCheck averageBy let contains<'a when 'a : equality> (xs : 'a []) x = let s = xs |> Seq.contains x @@ -72,9 +74,9 @@ let contains<'a when 'a : equality> (xs : 'a []) x = [] let ``contains is consistent`` () = - Check.QuickThrowOnFailure contains - Check.QuickThrowOnFailure contains - Check.QuickThrowOnFailure contains + smallerSizeCheck contains + smallerSizeCheck contains + smallerSizeCheck contains let choose<'a when 'a : equality> (xs : 'a []) f = let s = xs |> Seq.choose f |> Seq.toArray @@ -84,9 +86,9 @@ let choose<'a when 'a : equality> (xs : 'a []) f = [] let ``choose is consistent`` () = - Check.QuickThrowOnFailure choose - Check.QuickThrowOnFailure choose - Check.QuickThrowOnFailure choose + smallerSizeCheck choose + smallerSizeCheck choose + smallerSizeCheck choose let chunkBySize<'a when 'a : equality> (xs : 'a []) size = let ls = List.ofArray xs @@ -103,9 +105,9 @@ let chunkBySize<'a when 'a : equality> (xs : 'a []) size = [] let ``chunkBySize is consistent`` () = - Check.QuickThrowOnFailure chunkBySize - Check.QuickThrowOnFailure chunkBySize - Check.QuickThrowOnFailure chunkBySize + smallerSizeCheck chunkBySize + smallerSizeCheck chunkBySize + smallerSizeCheck chunkBySize let collect<'a> (xs : 'a []) f = let s = xs |> Seq.collect f |> Seq.toArray @@ -117,9 +119,9 @@ let collect<'a> (xs : 'a []) f = [] let ``collect is consistent`` () = - Check.QuickThrowOnFailure collect - Check.QuickThrowOnFailure collect - Check.QuickThrowOnFailure collect + smallerSizeCheck collect + smallerSizeCheck collect + smallerSizeCheck collect let compareWith<'a>(xs : 'a []) (xs2 : 'a []) f = let s = (xs, xs2) ||> Seq.compareWith f @@ -131,9 +133,9 @@ let compareWith<'a>(xs : 'a []) (xs2 : 'a []) f = [] let ``compareWith is consistent`` () = - Check.QuickThrowOnFailure compareWith - Check.QuickThrowOnFailure compareWith - Check.QuickThrowOnFailure compareWith + smallerSizeCheck compareWith + smallerSizeCheck compareWith + smallerSizeCheck compareWith let concat<'a when 'a : equality> (xs : 'a [][]) = let s = xs |> Seq.concat |> Seq.toArray @@ -143,9 +145,9 @@ let concat<'a when 'a : equality> (xs : 'a [][]) = [] let ``concat is consistent`` () = - Check.QuickThrowOnFailure concat - Check.QuickThrowOnFailure concat - Check.QuickThrowOnFailure concat + smallerSizeCheck concat + smallerSizeCheck concat + smallerSizeCheck concat let countBy<'a> (xs : 'a []) f = let s = xs |> Seq.countBy f |> Seq.toArray @@ -155,9 +157,9 @@ let countBy<'a> (xs : 'a []) f = [] let ``countBy is consistent`` () = - Check.QuickThrowOnFailure countBy - Check.QuickThrowOnFailure countBy - Check.QuickThrowOnFailure countBy + smallerSizeCheck countBy + smallerSizeCheck countBy + smallerSizeCheck countBy let distinct<'a when 'a : comparison> (xs : 'a []) = let s = xs |> Seq.distinct |> Seq.toArray @@ -167,9 +169,9 @@ let distinct<'a when 'a : comparison> (xs : 'a []) = [] let ``distinct is consistent`` () = - Check.QuickThrowOnFailure distinct - Check.QuickThrowOnFailure distinct - Check.QuickThrowOnFailure distinct + smallerSizeCheck distinct + smallerSizeCheck distinct + smallerSizeCheck distinct let distinctBy<'a when 'a : equality> (xs : 'a []) f = let s = xs |> Seq.distinctBy f |> Seq.toArray @@ -179,9 +181,9 @@ let distinctBy<'a when 'a : equality> (xs : 'a []) f = [] let ``distinctBy is consistent`` () = - Check.QuickThrowOnFailure distinctBy - Check.QuickThrowOnFailure distinctBy - Check.QuickThrowOnFailure distinctBy + smallerSizeCheck distinctBy + smallerSizeCheck distinctBy + smallerSizeCheck distinctBy let exactlyOne<'a when 'a : comparison> (xs : 'a []) = let s = runAndCheckErrorType (fun () -> xs |> Seq.exactlyOne) @@ -191,9 +193,9 @@ let exactlyOne<'a when 'a : comparison> (xs : 'a []) = [] let ``exactlyOne is consistent`` () = - Check.QuickThrowOnFailure exactlyOne - Check.QuickThrowOnFailure exactlyOne - Check.QuickThrowOnFailure exactlyOne + smallerSizeCheck exactlyOne + smallerSizeCheck exactlyOne + smallerSizeCheck exactlyOne let except<'a when 'a : equality> (xs : 'a []) (itemsToExclude: 'a []) = let s = xs |> Seq.except itemsToExclude |> Seq.toArray @@ -203,9 +205,9 @@ let except<'a when 'a : equality> (xs : 'a []) (itemsToExclude: 'a []) = [] let ``except is consistent`` () = - Check.QuickThrowOnFailure except - Check.QuickThrowOnFailure except - Check.QuickThrowOnFailure except + smallerSizeCheck except + smallerSizeCheck except + smallerSizeCheck except let exists<'a when 'a : equality> (xs : 'a []) f = let s = xs |> Seq.exists f @@ -215,9 +217,9 @@ let exists<'a when 'a : equality> (xs : 'a []) f = [] let ``exists is consistent`` () = - Check.QuickThrowOnFailure exists - Check.QuickThrowOnFailure exists - Check.QuickThrowOnFailure exists + smallerSizeCheck exists + smallerSizeCheck exists + smallerSizeCheck exists let exists2<'a when 'a : equality> (xs':('a*'a) []) f = let xs = Array.map fst xs' @@ -229,9 +231,9 @@ let exists2<'a when 'a : equality> (xs':('a*'a) []) f = [] let ``exists2 is consistent for collections with equal length`` () = - Check.QuickThrowOnFailure exists2 - Check.QuickThrowOnFailure exists2 - Check.QuickThrowOnFailure exists2 + smallerSizeCheck exists2 + smallerSizeCheck exists2 + smallerSizeCheck exists2 let filter<'a when 'a : equality> (xs : 'a []) predicate = let s = xs |> Seq.filter predicate @@ -241,9 +243,9 @@ let filter<'a when 'a : equality> (xs : 'a []) predicate = [] let ``filter is consistent`` () = - Check.QuickThrowOnFailure filter - Check.QuickThrowOnFailure filter - Check.QuickThrowOnFailure filter + smallerSizeCheck filter + smallerSizeCheck filter + smallerSizeCheck filter let find<'a when 'a : equality> (xs : 'a []) predicate = let s = run (fun () -> xs |> Seq.find predicate) @@ -253,9 +255,9 @@ let find<'a when 'a : equality> (xs : 'a []) predicate = [] let ``find is consistent`` () = - Check.QuickThrowOnFailure find - Check.QuickThrowOnFailure find - Check.QuickThrowOnFailure find + smallerSizeCheck find + smallerSizeCheck find + smallerSizeCheck find let findBack<'a when 'a : equality> (xs : 'a []) predicate = let s = run (fun () -> xs |> Seq.findBack predicate) @@ -265,9 +267,9 @@ let findBack<'a when 'a : equality> (xs : 'a []) predicate = [] let ``findBack is consistent`` () = - Check.QuickThrowOnFailure findBack - Check.QuickThrowOnFailure findBack - Check.QuickThrowOnFailure findBack + smallerSizeCheck findBack + smallerSizeCheck findBack + smallerSizeCheck findBack let findIndex<'a when 'a : equality> (xs : 'a []) predicate = let s = run (fun () -> xs |> Seq.findIndex predicate) @@ -277,9 +279,9 @@ let findIndex<'a when 'a : equality> (xs : 'a []) predicate = [] let ``findIndex is consistent`` () = - Check.QuickThrowOnFailure findIndex - Check.QuickThrowOnFailure findIndex - Check.QuickThrowOnFailure findIndex + smallerSizeCheck findIndex + smallerSizeCheck findIndex + smallerSizeCheck findIndex let findIndexBack<'a when 'a : equality> (xs : 'a []) predicate = let s = run (fun () -> xs |> Seq.findIndexBack predicate) @@ -289,9 +291,9 @@ let findIndexBack<'a when 'a : equality> (xs : 'a []) predicate = [] let ``findIndexBack is consistent`` () = - Check.QuickThrowOnFailure findIndexBack - Check.QuickThrowOnFailure findIndexBack - Check.QuickThrowOnFailure findIndexBack + smallerSizeCheck findIndexBack + smallerSizeCheck findIndexBack + smallerSizeCheck findIndexBack let fold<'a,'b when 'b : equality> (xs : 'a []) f (start:'b) = let s = run (fun () -> xs |> Seq.fold f start) @@ -301,10 +303,10 @@ let fold<'a,'b when 'b : equality> (xs : 'a []) f (start:'b) = [] let ``fold is consistent`` () = - Check.QuickThrowOnFailure fold - Check.QuickThrowOnFailure fold - Check.QuickThrowOnFailure fold - Check.QuickThrowOnFailure fold + smallerSizeCheck fold + smallerSizeCheck fold + smallerSizeCheck fold + smallerSizeCheck fold let fold2<'a,'b,'c when 'c : equality> (xs': ('a*'b)[]) f (start:'c) = let xs = xs' |> Array.map fst @@ -316,12 +318,12 @@ let fold2<'a,'b,'c when 'c : equality> (xs': ('a*'b)[]) f (start:'c) = [] let ``fold2 is consistent`` () = - Check.QuickThrowOnFailure fold2 - Check.QuickThrowOnFailure fold2 - Check.QuickThrowOnFailure fold2 - Check.QuickThrowOnFailure fold2 - Check.QuickThrowOnFailure fold2 - Check.QuickThrowOnFailure fold2 + smallerSizeCheck fold2 + smallerSizeCheck fold2 + smallerSizeCheck fold2 + smallerSizeCheck fold2 + smallerSizeCheck fold2 + smallerSizeCheck fold2 let foldBack<'a,'b when 'b : equality> (xs : 'a []) f (start:'b) = let s = run (fun () -> Seq.foldBack f xs start) @@ -331,10 +333,10 @@ let foldBack<'a,'b when 'b : equality> (xs : 'a []) f (start:'b) = [] let ``foldBack is consistent`` () = - Check.QuickThrowOnFailure foldBack - Check.QuickThrowOnFailure foldBack - Check.QuickThrowOnFailure foldBack - Check.QuickThrowOnFailure foldBack + smallerSizeCheck foldBack + smallerSizeCheck foldBack + smallerSizeCheck foldBack + smallerSizeCheck foldBack let foldBack2<'a,'b,'c when 'c : equality> (xs': ('a*'b)[]) f (start:'c) = let xs = xs' |> Array.map fst @@ -346,12 +348,12 @@ let foldBack2<'a,'b,'c when 'c : equality> (xs': ('a*'b)[]) f (start:'c) = [] let ``foldBack2 is consistent`` () = - Check.QuickThrowOnFailure foldBack2 - Check.QuickThrowOnFailure foldBack2 - Check.QuickThrowOnFailure foldBack2 - Check.QuickThrowOnFailure foldBack2 - Check.QuickThrowOnFailure foldBack2 - Check.QuickThrowOnFailure foldBack2 + smallerSizeCheck foldBack2 + smallerSizeCheck foldBack2 + smallerSizeCheck foldBack2 + smallerSizeCheck foldBack2 + smallerSizeCheck foldBack2 + smallerSizeCheck foldBack2 let forall<'a when 'a : equality> (xs : 'a []) f = let s = xs |> Seq.forall f @@ -361,9 +363,9 @@ let forall<'a when 'a : equality> (xs : 'a []) f = [] let ``forall is consistent`` () = - Check.QuickThrowOnFailure forall - Check.QuickThrowOnFailure forall - Check.QuickThrowOnFailure forall + smallerSizeCheck forall + smallerSizeCheck forall + smallerSizeCheck forall let forall2<'a when 'a : equality> (xs':('a*'a) []) f = let xs = Array.map fst xs' @@ -375,9 +377,9 @@ let forall2<'a when 'a : equality> (xs':('a*'a) []) f = [] let ``forall2 is consistent for collections with equal length`` () = - Check.QuickThrowOnFailure forall2 - Check.QuickThrowOnFailure forall2 - Check.QuickThrowOnFailure forall2 + smallerSizeCheck forall2 + smallerSizeCheck forall2 + smallerSizeCheck forall2 let groupBy<'a when 'a : equality> (xs : 'a []) f = let s = run (fun () -> xs |> Seq.groupBy f |> Seq.toArray |> Array.map (fun (x,xs) -> x,xs |> Seq.toArray)) @@ -387,9 +389,9 @@ let groupBy<'a when 'a : equality> (xs : 'a []) f = [] let ``groupBy is consistent`` () = - Check.QuickThrowOnFailure groupBy - Check.QuickThrowOnFailure groupBy - Check.QuickThrowOnFailure groupBy + smallerSizeCheck groupBy + smallerSizeCheck groupBy + smallerSizeCheck groupBy let head<'a when 'a : equality> (xs : 'a []) = let s = runAndCheckIfAnyError (fun () -> xs |> Seq.head) @@ -399,9 +401,9 @@ let head<'a when 'a : equality> (xs : 'a []) = [] let ``head is consistent`` () = - Check.QuickThrowOnFailure head - Check.QuickThrowOnFailure head - Check.QuickThrowOnFailure head + smallerSizeCheck head + smallerSizeCheck head + smallerSizeCheck head let indexed<'a when 'a : equality> (xs : 'a []) = let s = xs |> Seq.indexed |> Seq.toArray @@ -411,9 +413,9 @@ let indexed<'a when 'a : equality> (xs : 'a []) = [] let ``indexed is consistent`` () = - Check.QuickThrowOnFailure indexed - Check.QuickThrowOnFailure indexed - Check.QuickThrowOnFailure indexed + smallerSizeCheck indexed + smallerSizeCheck indexed + smallerSizeCheck indexed let init<'a when 'a : equality> count f = let s = runAndCheckErrorType (fun () -> Seq.init count f |> Seq.toArray) @@ -423,9 +425,9 @@ let init<'a when 'a : equality> count f = [] let ``init is consistent`` () = - Check.QuickThrowOnFailure init - Check.QuickThrowOnFailure init - Check.QuickThrowOnFailure init + smallerSizeCheck init + smallerSizeCheck init + smallerSizeCheck init let isEmpty<'a when 'a : equality> (xs : 'a []) = let s = xs |> Seq.isEmpty @@ -435,9 +437,9 @@ let isEmpty<'a when 'a : equality> (xs : 'a []) = [] let ``isEmpty is consistent`` () = - Check.QuickThrowOnFailure isEmpty - Check.QuickThrowOnFailure isEmpty - Check.QuickThrowOnFailure isEmpty + smallerSizeCheck isEmpty + smallerSizeCheck isEmpty + smallerSizeCheck isEmpty let item<'a when 'a : equality> (xs : 'a []) index = let s = runAndCheckIfAnyError (fun () -> xs |> Seq.item index) @@ -447,9 +449,9 @@ let item<'a when 'a : equality> (xs : 'a []) index = [] let ``item is consistent`` () = - Check.QuickThrowOnFailure item - Check.QuickThrowOnFailure item - Check.QuickThrowOnFailure item + smallerSizeCheck item + smallerSizeCheck item + smallerSizeCheck item let iter<'a when 'a : equality> (xs : 'a []) f' = let list = System.Collections.Generic.List<'a>() @@ -466,9 +468,9 @@ let iter<'a when 'a : equality> (xs : 'a []) f' = [] let ``iter looks at every element exactly once and in order - consistenly over all collections`` () = - Check.QuickThrowOnFailure iter - Check.QuickThrowOnFailure iter - Check.QuickThrowOnFailure iter + smallerSizeCheck iter + smallerSizeCheck iter + smallerSizeCheck iter let iter2<'a when 'a : equality> (xs' : ('a*'a) []) f' = let xs = xs' |> Array.map fst @@ -487,9 +489,9 @@ let iter2<'a when 'a : equality> (xs' : ('a*'a) []) f' = [] let ``iter2 looks at every element exactly once and in order - consistenly over all collections when size is equal`` () = - Check.QuickThrowOnFailure iter2 - Check.QuickThrowOnFailure iter2 - Check.QuickThrowOnFailure iter2 + smallerSizeCheck iter2 + smallerSizeCheck iter2 + smallerSizeCheck iter2 let iteri<'a when 'a : equality> (xs : 'a []) f' = let list = System.Collections.Generic.List<'a>() @@ -509,9 +511,9 @@ let iteri<'a when 'a : equality> (xs : 'a []) f' = [] let ``iteri looks at every element exactly once and in order - consistenly over all collections`` () = - Check.QuickThrowOnFailure iteri - Check.QuickThrowOnFailure iteri - Check.QuickThrowOnFailure iteri + smallerSizeCheck iteri + smallerSizeCheck iteri + smallerSizeCheck iteri let iteri2<'a when 'a : equality> (xs' : ('a*'a) []) f' = let xs = xs' |> Array.map fst @@ -533,9 +535,9 @@ let iteri2<'a when 'a : equality> (xs' : ('a*'a) []) f' = [] let ``iteri2 looks at every element exactly once and in order - consistenly over all collections when size is equal`` () = - Check.QuickThrowOnFailure iteri2 - Check.QuickThrowOnFailure iteri2 - Check.QuickThrowOnFailure iteri2 + smallerSizeCheck iteri2 + smallerSizeCheck iteri2 + smallerSizeCheck iteri2 let last<'a when 'a : equality> (xs : 'a []) = let s = runAndCheckIfAnyError (fun () -> xs |> Seq.last) @@ -545,9 +547,9 @@ let last<'a when 'a : equality> (xs : 'a []) = [] let ``last is consistent`` () = - Check.QuickThrowOnFailure last - Check.QuickThrowOnFailure last - Check.QuickThrowOnFailure last + smallerSizeCheck last + smallerSizeCheck last + smallerSizeCheck last let length<'a when 'a : equality> (xs : 'a []) = let s = xs |> Seq.length @@ -557,9 +559,9 @@ let length<'a when 'a : equality> (xs : 'a []) = [] let ``length is consistent`` () = - Check.QuickThrowOnFailure length - Check.QuickThrowOnFailure length - Check.QuickThrowOnFailure length + smallerSizeCheck length + smallerSizeCheck length + smallerSizeCheck length let map<'a when 'a : equality> (xs : 'a []) f = let s = xs |> Seq.map f |> Seq.toArray @@ -569,9 +571,9 @@ let map<'a when 'a : equality> (xs : 'a []) f = [] let ``map is consistent`` () = - Check.QuickThrowOnFailure map - Check.QuickThrowOnFailure map - Check.QuickThrowOnFailure map + smallerSizeCheck map + smallerSizeCheck map + smallerSizeCheck map let map2<'a when 'a : equality> (xs' : ('a*'a) []) f' = let xs = xs' |> Array.map fst @@ -591,9 +593,9 @@ let map2<'a when 'a : equality> (xs' : ('a*'a) []) f' = [] let ``map2 looks at every element exactly once and in order - consistenly over all collections when size is equal`` () = - Check.QuickThrowOnFailure map2 - Check.QuickThrowOnFailure map2 - Check.QuickThrowOnFailure map2 + smallerSizeCheck map2 + smallerSizeCheck map2 + smallerSizeCheck map2 let map3<'a when 'a : equality> (xs' : ('a*'a*'a) []) f' = let xs = xs' |> Array.map (fun (x,y,z) -> x) @@ -614,9 +616,9 @@ let map3<'a when 'a : equality> (xs' : ('a*'a*'a) []) f' = [] let ``map3 looks at every element exactly once and in order - consistenly over all collections when size is equal`` () = - Check.QuickThrowOnFailure map3 - Check.QuickThrowOnFailure map3 - Check.QuickThrowOnFailure map3 + smallerSizeCheck map3 + smallerSizeCheck map3 + smallerSizeCheck map3 let mapFold<'a when 'a : equality> (xs : 'a []) f start = let s,sr = xs |> Seq.mapFold f start @@ -627,9 +629,9 @@ let mapFold<'a when 'a : equality> (xs : 'a []) f start = [] let ``mapFold is consistent`` () = - Check.QuickThrowOnFailure mapFold - Check.QuickThrowOnFailure mapFold - Check.QuickThrowOnFailure mapFold + smallerSizeCheck mapFold + smallerSizeCheck mapFold + smallerSizeCheck mapFold let mapFoldBack<'a when 'a : equality> (xs : 'a []) f start = let s,sr = Seq.mapFoldBack f xs start @@ -640,9 +642,9 @@ let mapFoldBack<'a when 'a : equality> (xs : 'a []) f start = [] let ``mapFold2 is consistent`` () = - Check.QuickThrowOnFailure mapFoldBack - Check.QuickThrowOnFailure mapFoldBack - Check.QuickThrowOnFailure mapFoldBack + smallerSizeCheck mapFoldBack + smallerSizeCheck mapFoldBack + smallerSizeCheck mapFoldBack let mapi<'a when 'a : equality> (xs : 'a []) f = let s = xs |> Seq.mapi f @@ -652,9 +654,9 @@ let mapi<'a when 'a : equality> (xs : 'a []) f = [] let ``mapi is consistent`` () = - Check.QuickThrowOnFailure mapi - Check.QuickThrowOnFailure mapi - Check.QuickThrowOnFailure mapi + smallerSizeCheck mapi + smallerSizeCheck mapi + smallerSizeCheck mapi let mapi2<'a when 'a : equality> (xs' : ('a*'a) []) f' = let xs = xs' |> Array.map fst @@ -677,9 +679,9 @@ let mapi2<'a when 'a : equality> (xs' : ('a*'a) []) f' = [] let ``mapi2 looks at every element exactly once and in order - consistenly over all collections when size is equal`` () = - Check.QuickThrowOnFailure mapi2 - Check.QuickThrowOnFailure mapi2 - Check.QuickThrowOnFailure mapi2 + smallerSizeCheck mapi2 + smallerSizeCheck mapi2 + smallerSizeCheck mapi2 let max<'a when 'a : comparison> (xs : 'a []) = let s = runAndCheckIfAnyError (fun () -> xs |> Seq.max) @@ -689,9 +691,9 @@ let max<'a when 'a : comparison> (xs : 'a []) = [] let ``max is consistent`` () = - Check.QuickThrowOnFailure max - Check.QuickThrowOnFailure max - Check.QuickThrowOnFailure max + smallerSizeCheck max + smallerSizeCheck max + smallerSizeCheck max let maxBy<'a when 'a : comparison> (xs : 'a []) f = let s = runAndCheckIfAnyError (fun () -> xs |> Seq.maxBy f) @@ -701,9 +703,9 @@ let maxBy<'a when 'a : comparison> (xs : 'a []) f = [] let ``maxBy is consistent`` () = - Check.QuickThrowOnFailure maxBy - Check.QuickThrowOnFailure maxBy - Check.QuickThrowOnFailure maxBy + smallerSizeCheck maxBy + smallerSizeCheck maxBy + smallerSizeCheck maxBy let min<'a when 'a : comparison> (xs : 'a []) = let s = runAndCheckIfAnyError (fun () -> xs |> Seq.min) @@ -713,9 +715,9 @@ let min<'a when 'a : comparison> (xs : 'a []) = [] let ``min is consistent`` () = - Check.QuickThrowOnFailure min - Check.QuickThrowOnFailure min - Check.QuickThrowOnFailure min + smallerSizeCheck min + smallerSizeCheck min + smallerSizeCheck min let minBy<'a when 'a : comparison> (xs : 'a []) f = let s = runAndCheckIfAnyError (fun () -> xs |> Seq.minBy f) @@ -725,9 +727,9 @@ let minBy<'a when 'a : comparison> (xs : 'a []) f = [] let ``minBy is consistent`` () = - Check.QuickThrowOnFailure minBy - Check.QuickThrowOnFailure minBy - Check.QuickThrowOnFailure minBy + smallerSizeCheck minBy + smallerSizeCheck minBy + smallerSizeCheck minBy let pairwise<'a when 'a : comparison> (xs : 'a []) = let s = run (fun () -> xs |> Seq.pairwise |> Seq.toArray) @@ -737,9 +739,9 @@ let pairwise<'a when 'a : comparison> (xs : 'a []) = [] let ``pairwise is consistent`` () = - Check.QuickThrowOnFailure pairwise - Check.QuickThrowOnFailure pairwise - Check.QuickThrowOnFailure pairwise + smallerSizeCheck pairwise + smallerSizeCheck pairwise + smallerSizeCheck pairwise let partition<'a when 'a : comparison> (xs : 'a []) f = // no seq version @@ -750,9 +752,9 @@ let partition<'a when 'a : comparison> (xs : 'a []) f = [] let ``partition is consistent`` () = - Check.QuickThrowOnFailure partition - Check.QuickThrowOnFailure partition - Check.QuickThrowOnFailure partition + smallerSizeCheck partition + smallerSizeCheck partition + smallerSizeCheck partition let permute<'a when 'a : comparison> (xs' : list) = let xs = List.map snd xs' @@ -774,9 +776,9 @@ let permute<'a when 'a : comparison> (xs' : list) = [] let ``permute is consistent`` () = - Check.QuickThrowOnFailure permute - Check.QuickThrowOnFailure permute - Check.QuickThrowOnFailure permute + smallerSizeCheck permute + smallerSizeCheck permute + smallerSizeCheck permute let pick<'a when 'a : comparison> (xs : 'a []) f = let s = run (fun () -> xs |> Seq.pick f) @@ -786,9 +788,9 @@ let pick<'a when 'a : comparison> (xs : 'a []) f = [] let ``pick is consistent`` () = - Check.QuickThrowOnFailure pick - Check.QuickThrowOnFailure pick - Check.QuickThrowOnFailure pick + smallerSizeCheck pick + smallerSizeCheck pick + smallerSizeCheck pick let reduce<'a when 'a : equality> (xs : 'a []) f = let s = runAndCheckErrorType (fun () -> xs |> Seq.reduce f) @@ -798,9 +800,9 @@ let reduce<'a when 'a : equality> (xs : 'a []) f = [] let ``reduce is consistent`` () = - Check.QuickThrowOnFailure reduce - Check.QuickThrowOnFailure reduce - Check.QuickThrowOnFailure reduce + smallerSizeCheck reduce + smallerSizeCheck reduce + smallerSizeCheck reduce let reduceBack<'a when 'a : equality> (xs : 'a []) f = let s = runAndCheckErrorType (fun () -> xs |> Seq.reduceBack f) @@ -810,9 +812,9 @@ let reduceBack<'a when 'a : equality> (xs : 'a []) f = [] let ``reduceBack is consistent`` () = - Check.QuickThrowOnFailure reduceBack - Check.QuickThrowOnFailure reduceBack - Check.QuickThrowOnFailure reduceBack + smallerSizeCheck reduceBack + smallerSizeCheck reduceBack + smallerSizeCheck reduceBack let replicate<'a when 'a : equality> x count = let s = runAndCheckIfAnyError (fun () -> Seq.replicate count x |> Seq.toArray) @@ -822,9 +824,9 @@ let replicate<'a when 'a : equality> x count = [] let ``replicate is consistent`` () = - Check.QuickThrowOnFailure replicate - Check.QuickThrowOnFailure replicate - Check.QuickThrowOnFailure replicate + smallerSizeCheck replicate + smallerSizeCheck replicate + smallerSizeCheck replicate let rev<'a when 'a : equality> (xs : 'a []) = let s = Seq.rev xs |> Seq.toArray @@ -834,9 +836,9 @@ let rev<'a when 'a : equality> (xs : 'a []) = [] let ``rev is consistent`` () = - Check.QuickThrowOnFailure rev - Check.QuickThrowOnFailure rev - Check.QuickThrowOnFailure rev + smallerSizeCheck rev + smallerSizeCheck rev + smallerSizeCheck rev let scan<'a,'b when 'b : equality> (xs : 'a []) f (start:'b) = let s = run (fun () -> xs |> Seq.scan f start |> Seq.toArray) @@ -846,10 +848,10 @@ let scan<'a,'b when 'b : equality> (xs : 'a []) f (start:'b) = [] let ``scan is consistent`` () = - Check.QuickThrowOnFailure scan - Check.QuickThrowOnFailure scan - Check.QuickThrowOnFailure scan - Check.QuickThrowOnFailure scan + smallerSizeCheck scan + smallerSizeCheck scan + smallerSizeCheck scan + smallerSizeCheck scan let scanBack<'a,'b when 'b : equality> (xs : 'a []) f (start:'b) = let s = run (fun () -> Seq.scanBack f xs start |> Seq.toArray) @@ -859,10 +861,10 @@ let scanBack<'a,'b when 'b : equality> (xs : 'a []) f (start:'b) = [] let ``scanBack is consistent`` () = - Check.QuickThrowOnFailure scanBack - Check.QuickThrowOnFailure scanBack - Check.QuickThrowOnFailure scanBack - Check.QuickThrowOnFailure scanBack + smallerSizeCheck scanBack + smallerSizeCheck scanBack + smallerSizeCheck scanBack + smallerSizeCheck scanBack let singleton<'a when 'a : equality> (x : 'a) = let s = Seq.singleton x |> Seq.toArray @@ -872,9 +874,9 @@ let singleton<'a when 'a : equality> (x : 'a) = [] let ``singleton is consistent`` () = - Check.QuickThrowOnFailure singleton - Check.QuickThrowOnFailure singleton - Check.QuickThrowOnFailure singleton + smallerSizeCheck singleton + smallerSizeCheck singleton + smallerSizeCheck singleton let skip<'a when 'a : equality> (xs : 'a []) count = let s = runAndCheckIfAnyError (fun () -> Seq.skip count xs |> Seq.toArray) @@ -884,9 +886,9 @@ let skip<'a when 'a : equality> (xs : 'a []) count = [] let ``skip is consistent`` () = - Check.QuickThrowOnFailure skip - Check.QuickThrowOnFailure skip - Check.QuickThrowOnFailure skip + smallerSizeCheck skip + smallerSizeCheck skip + smallerSizeCheck skip let skipWhile<'a when 'a : equality> (xs : 'a []) f = let s = runAndCheckIfAnyError (fun () -> Seq.skipWhile f xs |> Seq.toArray) @@ -896,9 +898,9 @@ let skipWhile<'a when 'a : equality> (xs : 'a []) f = [] let ``skipWhile is consistent`` () = - Check.QuickThrowOnFailure skipWhile - Check.QuickThrowOnFailure skipWhile - Check.QuickThrowOnFailure skipWhile + smallerSizeCheck skipWhile + smallerSizeCheck skipWhile + smallerSizeCheck skipWhile let sort<'a when 'a : comparison> (xs : 'a []) = let s = xs |> Seq.sort |> Seq.toArray @@ -908,9 +910,9 @@ let sort<'a when 'a : comparison> (xs : 'a []) = [] let ``sort is consistent`` () = - Check.QuickThrowOnFailure sort - Check.QuickThrowOnFailure sort - Check.QuickThrowOnFailure sort + smallerSizeCheck sort + smallerSizeCheck sort + smallerSizeCheck sort let sortBy<'a,'b when 'a : comparison and 'b : comparison> (xs : 'a []) (f:'a -> 'b) = let s = xs |> Seq.sortBy f @@ -922,20 +924,18 @@ let sortBy<'a,'b when 'a : comparison and 'b : comparison> (xs : 'a []) (f:'a -> [] let ``sortBy actually sorts (but is inconsistent in regards of stability)`` () = - Check.QuickThrowOnFailure sortBy - Check.QuickThrowOnFailure sortBy - Check.QuickThrowOnFailure sortBy - Check.QuickThrowOnFailure sortBy - Check.QuickThrowOnFailure sortBy - -let sortWith<'a,'b when 'a : comparison and 'b : comparison> (xs : 'a []) (f:'a -> 'a -> int) = - let dict = System.Collections.Generic.Dictionary<_,_>() + smallerSizeCheck sortBy + smallerSizeCheck sortBy + smallerSizeCheck sortBy + smallerSizeCheck sortBy + smallerSizeCheck sortBy + +let sortWith<'a,'b when 'a : comparison and 'b : comparison> (xs : 'a []) = let f x y = if x = y then 0 else if x = Unchecked.defaultof<_> && y <> Unchecked.defaultof<_> then -1 else if y = Unchecked.defaultof<_> && x <> Unchecked.defaultof<_> then 1 else - let r = f x y |> sign // only use one side - if x < y then r else r * -1 + if x < y then -1 else 1 let s = xs |> Seq.sortWith f let l = xs |> List.ofArray |> List.sortWith f @@ -947,11 +947,11 @@ let sortWith<'a,'b when 'a : comparison and 'b : comparison> (xs : 'a []) (f:'a [] let ``sortWith actually sorts (but is inconsistent in regards of stability)`` () = - Check.QuickThrowOnFailure sortWith - Check.QuickThrowOnFailure sortWith - Check.QuickThrowOnFailure sortWith - Check.QuickThrowOnFailure sortWith - Check.QuickThrowOnFailure sortWith + smallerSizeCheck sortWith + smallerSizeCheck sortWith + smallerSizeCheck sortWith + smallerSizeCheck sortWith + smallerSizeCheck sortWith let sortDescending<'a when 'a : comparison> (xs : 'a []) = let s = xs |> Seq.sortDescending |> Seq.toArray @@ -961,9 +961,9 @@ let sortDescending<'a when 'a : comparison> (xs : 'a []) = [] let ``sortDescending is consistent`` () = - Check.QuickThrowOnFailure sortDescending - Check.QuickThrowOnFailure sortDescending - Check.QuickThrowOnFailure sortDescending + smallerSizeCheck sortDescending + smallerSizeCheck sortDescending + smallerSizeCheck sortDescending let sortByDescending<'a,'b when 'a : comparison and 'b : comparison> (xs : 'a []) (f:'a -> 'b) = let s = xs |> Seq.sortByDescending f @@ -975,11 +975,11 @@ let sortByDescending<'a,'b when 'a : comparison and 'b : comparison> (xs : 'a [] [] let ``sortByDescending actually sorts (but is inconsistent in regards of stability)`` () = - Check.QuickThrowOnFailure sortByDescending - Check.QuickThrowOnFailure sortByDescending - Check.QuickThrowOnFailure sortByDescending - Check.QuickThrowOnFailure sortByDescending - Check.QuickThrowOnFailure sortByDescending + smallerSizeCheck sortByDescending + smallerSizeCheck sortByDescending + smallerSizeCheck sortByDescending + smallerSizeCheck sortByDescending + smallerSizeCheck sortByDescending let sum (xs : int []) = let s = run (fun () -> xs |> Seq.sum) @@ -989,7 +989,7 @@ let sum (xs : int []) = [] let ``sum is consistent`` () = - Check.QuickThrowOnFailure sum + smallerSizeCheck sum let sumBy<'a> (xs : 'a []) (f:'a -> int) = let s = run (fun () -> xs |> Seq.sumBy f) @@ -999,9 +999,9 @@ let sumBy<'a> (xs : 'a []) (f:'a -> int) = [] let ``sumBy is consistent`` () = - Check.QuickThrowOnFailure sumBy - Check.QuickThrowOnFailure sumBy - Check.QuickThrowOnFailure sumBy + smallerSizeCheck sumBy + smallerSizeCheck sumBy + smallerSizeCheck sumBy let splitAt<'a when 'a : equality> (xs : 'a []) index = let ls = List.ofArray xs @@ -1019,9 +1019,9 @@ let splitAt<'a when 'a : equality> (xs : 'a []) index = [] let ``splitAt is consistent`` () = - Check.QuickThrowOnFailure splitAt - Check.QuickThrowOnFailure splitAt - Check.QuickThrowOnFailure splitAt + smallerSizeCheck splitAt + smallerSizeCheck splitAt + smallerSizeCheck splitAt let splitInto<'a when 'a : equality> (xs : 'a []) count = let ls = List.ofArray xs @@ -1037,9 +1037,9 @@ let splitInto<'a when 'a : equality> (xs : 'a []) count = [] let ``splitInto is consistent`` () = - Check.QuickThrowOnFailure splitInto - Check.QuickThrowOnFailure splitInto - Check.QuickThrowOnFailure splitInto + smallerSizeCheck splitInto + smallerSizeCheck splitInto + smallerSizeCheck splitInto let tail<'a when 'a : equality> (xs : 'a []) = let s = runAndCheckIfAnyError (fun () -> xs |> Seq.tail |> Seq.toArray) @@ -1049,9 +1049,9 @@ let tail<'a when 'a : equality> (xs : 'a []) = [] let ``tail is consistent`` () = - Check.QuickThrowOnFailure tail - Check.QuickThrowOnFailure tail - Check.QuickThrowOnFailure tail + smallerSizeCheck tail + smallerSizeCheck tail + smallerSizeCheck tail let take<'a when 'a : equality> (xs : 'a []) count = let s = runAndCheckIfAnyError (fun () -> Seq.take count xs |> Seq.toArray) @@ -1061,9 +1061,9 @@ let take<'a when 'a : equality> (xs : 'a []) count = [] let ``take is consistent`` () = - Check.QuickThrowOnFailure take - Check.QuickThrowOnFailure take - Check.QuickThrowOnFailure take + smallerSizeCheck take + smallerSizeCheck take + smallerSizeCheck take let takeWhile<'a when 'a : equality> (xs : 'a []) f = let s = runAndCheckIfAnyError (fun () -> Seq.takeWhile f xs |> Seq.toArray) @@ -1073,9 +1073,9 @@ let takeWhile<'a when 'a : equality> (xs : 'a []) f = [] let ``takeWhile is consistent`` () = - Check.QuickThrowOnFailure takeWhile - Check.QuickThrowOnFailure takeWhile - Check.QuickThrowOnFailure takeWhile + smallerSizeCheck takeWhile + smallerSizeCheck takeWhile + smallerSizeCheck takeWhile let truncate<'a when 'a : equality> (xs : 'a []) count = let s = runAndCheckIfAnyError (fun () -> Seq.truncate count xs |> Seq.toArray) @@ -1085,9 +1085,9 @@ let truncate<'a when 'a : equality> (xs : 'a []) count = [] let ``truncate is consistent`` () = - Check.QuickThrowOnFailure truncate - Check.QuickThrowOnFailure truncate - Check.QuickThrowOnFailure truncate + smallerSizeCheck truncate + smallerSizeCheck truncate + smallerSizeCheck truncate let tryFind<'a when 'a : equality> (xs : 'a []) predicate = let s = xs |> Seq.tryFind predicate @@ -1097,9 +1097,9 @@ let tryFind<'a when 'a : equality> (xs : 'a []) predicate = [] let ``tryFind is consistent`` () = - Check.QuickThrowOnFailure tryFind - Check.QuickThrowOnFailure tryFind - Check.QuickThrowOnFailure tryFind + smallerSizeCheck tryFind + smallerSizeCheck tryFind + smallerSizeCheck tryFind let tryFindBack<'a when 'a : equality> (xs : 'a []) predicate = let s = xs |> Seq.tryFindBack predicate @@ -1109,9 +1109,9 @@ let tryFindBack<'a when 'a : equality> (xs : 'a []) predicate = [] let ``tryFindBack is consistent`` () = - Check.QuickThrowOnFailure tryFindBack - Check.QuickThrowOnFailure tryFindBack - Check.QuickThrowOnFailure tryFindBack + smallerSizeCheck tryFindBack + smallerSizeCheck tryFindBack + smallerSizeCheck tryFindBack let tryFindIndex<'a when 'a : equality> (xs : 'a []) predicate = let s = xs |> Seq.tryFindIndex predicate @@ -1121,9 +1121,9 @@ let tryFindIndex<'a when 'a : equality> (xs : 'a []) predicate = [] let ``tryFindIndex is consistent`` () = - Check.QuickThrowOnFailure tryFindIndex - Check.QuickThrowOnFailure tryFindIndex - Check.QuickThrowOnFailure tryFindIndex + smallerSizeCheck tryFindIndex + smallerSizeCheck tryFindIndex + smallerSizeCheck tryFindIndex let tryFindIndexBack<'a when 'a : equality> (xs : 'a []) predicate = let s = xs |> Seq.tryFindIndexBack predicate @@ -1133,9 +1133,9 @@ let tryFindIndexBack<'a when 'a : equality> (xs : 'a []) predicate = [] let ``tryFindIndexBack is consistent`` () = - Check.QuickThrowOnFailure tryFindIndexBack - Check.QuickThrowOnFailure tryFindIndexBack - Check.QuickThrowOnFailure tryFindIndexBack + smallerSizeCheck tryFindIndexBack + smallerSizeCheck tryFindIndexBack + smallerSizeCheck tryFindIndexBack let tryHead<'a when 'a : equality> (xs : 'a []) = let s = xs |> Seq.tryHead @@ -1145,9 +1145,9 @@ let tryHead<'a when 'a : equality> (xs : 'a []) = [] let ``tryHead is consistent`` () = - Check.QuickThrowOnFailure tryHead - Check.QuickThrowOnFailure tryHead - Check.QuickThrowOnFailure tryHead + smallerSizeCheck tryHead + smallerSizeCheck tryHead + smallerSizeCheck tryHead let tryItem<'a when 'a : equality> (xs : 'a []) index = let s = xs |> Seq.tryItem index @@ -1157,9 +1157,9 @@ let tryItem<'a when 'a : equality> (xs : 'a []) index = [] let ``tryItem is consistent`` () = - Check.QuickThrowOnFailure tryItem - Check.QuickThrowOnFailure tryItem - Check.QuickThrowOnFailure tryItem + smallerSizeCheck tryItem + smallerSizeCheck tryItem + smallerSizeCheck tryItem let tryLast<'a when 'a : equality> (xs : 'a []) = let s = xs |> Seq.tryLast @@ -1169,9 +1169,9 @@ let tryLast<'a when 'a : equality> (xs : 'a []) = [] let ``tryLast is consistent`` () = - Check.QuickThrowOnFailure tryLast - Check.QuickThrowOnFailure tryLast - Check.QuickThrowOnFailure tryLast + smallerSizeCheck tryLast + smallerSizeCheck tryLast + smallerSizeCheck tryLast let tryPick<'a when 'a : comparison> (xs : 'a []) f = let s = xs |> Seq.tryPick f @@ -1181,9 +1181,9 @@ let tryPick<'a when 'a : comparison> (xs : 'a []) f = [] let ``tryPick is consistent`` () = - Check.QuickThrowOnFailure tryPick - Check.QuickThrowOnFailure tryPick - Check.QuickThrowOnFailure tryPick + smallerSizeCheck tryPick + smallerSizeCheck tryPick + smallerSizeCheck tryPick let unfold<'a,'b when 'b : equality> f (start:'a) = let f() = @@ -1200,14 +1200,14 @@ let unfold<'a,'b when 'b : equality> f (start:'a) = [] let ``unfold is consistent`` () = - Check.QuickThrowOnFailure unfold + smallerSizeCheck unfold [] let ``unfold is consistent full`` () = - Check.QuickThrowOnFailure unfold - Check.QuickThrowOnFailure unfold - Check.QuickThrowOnFailure unfold - Check.QuickThrowOnFailure unfold + smallerSizeCheck unfold + smallerSizeCheck unfold + smallerSizeCheck unfold + smallerSizeCheck unfold let unzip<'a when 'a : equality> (xs:('a*'a) []) = // no seq version @@ -1217,9 +1217,9 @@ let unzip<'a when 'a : equality> (xs:('a*'a) []) = [] let ``unzip is consistent`` () = - Check.QuickThrowOnFailure unzip - Check.QuickThrowOnFailure unzip - Check.QuickThrowOnFailure unzip + smallerSizeCheck unzip + smallerSizeCheck unzip + smallerSizeCheck unzip let unzip3<'a when 'a : equality> (xs:('a*'a*'a) []) = // no seq version @@ -1229,9 +1229,9 @@ let unzip3<'a when 'a : equality> (xs:('a*'a*'a) []) = [] let ``unzip3 is consistent`` () = - Check.QuickThrowOnFailure unzip3 - Check.QuickThrowOnFailure unzip3 - Check.QuickThrowOnFailure unzip3 + smallerSizeCheck unzip3 + smallerSizeCheck unzip3 + smallerSizeCheck unzip3 let where<'a when 'a : equality> (xs : 'a []) predicate = let s = xs |> Seq.where predicate |> Seq.toArray @@ -1241,9 +1241,9 @@ let where<'a when 'a : equality> (xs : 'a []) predicate = [] let ``where is consistent`` () = - Check.QuickThrowOnFailure where - Check.QuickThrowOnFailure where - Check.QuickThrowOnFailure where + smallerSizeCheck where + smallerSizeCheck where + smallerSizeCheck where let windowed<'a when 'a : equality> (xs : 'a []) windowSize = let ls = List.ofArray xs @@ -1259,9 +1259,9 @@ let windowed<'a when 'a : equality> (xs : 'a []) windowSize = [] let ``windowed is consistent`` () = - Check.QuickThrowOnFailure windowed - Check.QuickThrowOnFailure windowed - Check.QuickThrowOnFailure windowed + smallerSizeCheck windowed + smallerSizeCheck windowed + smallerSizeCheck windowed let zip<'a when 'a : equality> (xs':('a*'a) []) = let xs = Array.map fst xs' @@ -1273,9 +1273,9 @@ let zip<'a when 'a : equality> (xs':('a*'a) []) = [] let ``zip is consistent for collections with equal length`` () = - Check.QuickThrowOnFailure zip - Check.QuickThrowOnFailure zip - Check.QuickThrowOnFailure zip + smallerSizeCheck zip + smallerSizeCheck zip + smallerSizeCheck zip let zip3<'a when 'a : equality> (xs':('a*'a*'a) []) = let xs = Array.map (fun (x,y,z) -> x) xs' @@ -1288,6 +1288,6 @@ let zip3<'a when 'a : equality> (xs':('a*'a*'a) []) = [] let ``zip3 is consistent for collections with equal length`` () = - Check.QuickThrowOnFailure zip3 - Check.QuickThrowOnFailure zip3 - Check.QuickThrowOnFailure zip3 + smallerSizeCheck zip3 + smallerSizeCheck zip3 + smallerSizeCheck zip3 diff --git a/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/Utils.fs b/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/Utils.fs index 6a45b582b77..3fca63dd06a 100644 --- a/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/Utils.fs +++ b/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Collections/Utils.fs @@ -28,4 +28,8 @@ let runAndCheckIfAnyError f = let isStable sorted = sorted |> Seq.pairwise |> Seq.forall (fun ((ia, a),(ib, b)) -> if a = b then ia < ib else true) let isSorted sorted = sorted |> Seq.pairwise |> Seq.forall (fun (a,b) -> a <= b) -let haveSameElements xs ys = xs |> Seq.forall (fun x -> ys |> Seq.exists ((=) x)) && xs |> Seq.forall (fun y -> xs |> Seq.exists ((=) y)) \ No newline at end of file + +let haveSameElements (xs:seq<_>) (ys:seq<_>) = + let xsHashSet = new System.Collections.Generic.HashSet<_>(xs) + let ysHashSet = new System.Collections.Generic.HashSet<_>(ys) + xsHashSet.SetEquals(ysHashSet) \ No newline at end of file diff --git a/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Control/AsyncModule.fs b/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Control/AsyncModule.fs index e13d5d01962..e2fc8b74014 100644 --- a/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Control/AsyncModule.fs +++ b/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Control/AsyncModule.fs @@ -446,7 +446,7 @@ type AsyncModule() = [] // takes 3 minutes! member this.``Async.Choice specification test``() = ThreadPool.SetMinThreads(100,100) |> ignore - Check.QuickThrowOnFailure (normalize >> runChoice) + Check.One ({Config.QuickThrowOnFailure with EndSize = 20}, normalize >> runChoice) #endif []