Skip to content

Commit 5067316

Browse files
Merge pull request #240 from fsprojects/repo-assist/fix-experimental-tests-115-116-4e5d599-c320f049d9e9f407
[Repo Assist] fix: enable and fix experimental tests for issues #115 and #116
2 parents 32de73f + 4fa8272 commit 5067316

File tree

2 files changed

+28
-28
lines changed

2 files changed

+28
-28
lines changed

tests/FSharpx.Collections.Experimental.Tests/DListTest.fs

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,31 @@ module DListTest =
2020

2121
test "test DList.length should return 5" { DList.length expected |> Expect.equal "" 5 }
2222

23-
ptest "test ofSeq should create a DList from a seq" {
24-
let test = seq { for i in 0..4 -> i }
25-
DList.ofSeq test |> Expect.equal "" expected
23+
test "test ofSeq should create a DList from a seq" {
24+
let input = seq { for i in 0..4 -> i }
25+
26+
DList.ofSeq input
27+
|> DList.toSeq
28+
|> Seq.toList
29+
|> Expect.equal "" [ 0; 1; 2; 3; 4 ]
2630
}
2731

28-
ptest "test ofSeq should create a DList from a list" {
29-
let test = [ for i in 0..4 -> i ]
30-
DList.ofSeq test |> Expect.equal "" expected
32+
test "test ofSeq should create a DList from a list" {
33+
let input = [ for i in 0..4 -> i ]
34+
35+
DList.ofSeq input
36+
|> DList.toSeq
37+
|> Seq.toList
38+
|> Expect.equal "" [ 0; 1; 2; 3; 4 ]
3139
}
3240

33-
ptest "test ofSeq should create a DList from an array" {
34-
let test = [| for i in 0..4 -> i |]
35-
DList.ofSeq test |> Expect.equal "" expected
41+
test "test ofSeq should create a DList from an array" {
42+
let input = [| for i in 0..4 -> i |]
43+
44+
DList.ofSeq input
45+
|> DList.toSeq
46+
|> Seq.toList
47+
|> Expect.equal "" [ 0; 1; 2; 3; 4 ]
3648
}
3749

3850
test "test DList.cons should prepend 10 to the front of the original list" {

tests/FSharpx.Collections.Experimental.Tests/SkewBinomialHeapTest.fs

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -191,20 +191,6 @@ module SkewBinomialHeapTest =
191191
}
192192

193193

194-
//@@@@@@@@@@@@@@@@@@@
195-
let iComparableGen() : Gen<IComparable> =
196-
gen {
197-
let! t =
198-
Arb.generate
199-
|> Gen.filter(fun x ->
200-
match x :> obj with
201-
| :? System.IComparable -> true
202-
| _ -> false)
203-
204-
return t :> System.IComparable
205-
}
206-
//|> Arb.fromGen
207-
208194
let genDesc d =
209195
match d with
210196
| Some v -> Gen.constant v
@@ -213,7 +199,8 @@ module SkewBinomialHeapTest =
213199
let emptyOnly d =
214200
gen {
215201
let! desc = genDesc d
216-
let! s = Gen.listOf(Arb.generate<'T>)
202+
let! n = Gen.choose(0, 12)
203+
let! s = Gen.listOfLength n Arb.generate<int>
217204

218205
return
219206
{ Heap =
@@ -227,7 +214,8 @@ module SkewBinomialHeapTest =
227214
gen {
228215
let! desc = genDesc d
229216
let! t = Gen.elements [ true; false ]
230-
let! s = Gen.nonEmptyListOf <| iComparableGen()
217+
let! n = Gen.length1thru12
218+
let! s = Gen.listOfLength n Arb.generate<int>
231219

232220
let! ndel =
233221
if t then
@@ -302,7 +290,7 @@ module SkewBinomialHeapTest =
302290
(Prop.forAll(Arb.fromGen heapStringGen)
303291
<| fun (heap, orig) -> heap |> SkewBinomialHeap.toSeq |> Seq.toList = sortList heap orig)
304292

305-
ptestPropertyWithConfig
293+
testPropertyWithConfig
306294
config10k
307295
"toList returns the same as toSeq |> List.ofSeq"
308296
(Prop.forAll(comparableAndComparable())
@@ -535,7 +523,7 @@ module SkewBinomialHeapTest =
535523
// |> SkewBinomialHeap.toList
536524
// |> Expect.equal "" (orig1 |> List.append orig2 |> sortList heap1))
537525

538-
ptestPropertyWithConfig
526+
testPropertyWithConfig
539527
config10k
540528
"merge throws when both heaps have diferent ordering"
541529
(Prop.forAll(differentOrdered())
@@ -592,7 +580,7 @@ module SkewBinomialHeapTest =
592580
////Maybe the distribution of the hash should be checked
593581
////to avoid bad hashes, I don't know if that should be done as part of unit testPropertyWithConfig config10king
594582

595-
ptestPropertyWithConfig
583+
testPropertyWithConfig
596584
config10k
597585
"Equality reflexivity"
598586
(Prop.forAll(comparableAndComparable())

0 commit comments

Comments
 (0)