From cbce976ed07d29516e4ec0946afddf867659580c Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 9 Mar 2026 13:10:00 +0000 Subject: [PATCH 1/2] fix: enable and fix experimental tests for issues #115 and #116 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SkewBinomialHeapTest.fs (closes #115): - Remove broken iComparableGen() helper that tried to generate IComparable values via FsCheck — FsCheck cannot automatically generate interface instances, causing a runtime exception in all three property tests that depended on it. - Replace with Arb.generate throughout the module-level emptyOnly / nonEmptyOnly generators. - Add Gen.choose(0, 12) / Gen.length1thru12 size bounds (consistent with the project guidance in FsCheckProperties.fs) so the generators stay fast at 10,000 test cases. - Promote the three ptestPropertyWithConfig tests to testPropertyWithConfig: * 'toList returns the same as toSeq |> List.ofSeq' * 'merge throws when both heaps have diferent ordering' * 'Equality reflexivity' DListTest.fs (closes #116): - The three ofSeq ptest tests were checking internal DList node structure, not observable behaviour. The current ofSeq implementation builds a left-leaning tree (via snoc) while the expected value was a right-leaning tree (built with cons), so they would always fail when enabled. - Rewrite each test to compare DList.toSeq output against the expected element sequence [0;1;2;3;4], which correctly captures the contract of ofSeq without coupling tests to the internal representation. - Promote all three from ptest to test. Test status: - FSharpx.Collections.Tests: 706 passed, 6 skipped, 0 failed - Experimental DList: 14 passed, 0 ignored, 0 failed - Experimental SkewBinomialHeap: 29 passed, 0 ignored, 0 failed Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../DListTest.fs | 30 +++++++++++++------ .../SkewBinomialHeapTest.fs | 26 +++++----------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/tests/FSharpx.Collections.Experimental.Tests/DListTest.fs b/tests/FSharpx.Collections.Experimental.Tests/DListTest.fs index 5b81d82d..6e26623f 100644 --- a/tests/FSharpx.Collections.Experimental.Tests/DListTest.fs +++ b/tests/FSharpx.Collections.Experimental.Tests/DListTest.fs @@ -20,19 +20,31 @@ module DListTest = test "test DList.length should return 5" { DList.length expected |> Expect.equal "" 5 } - ptest "test ofSeq should create a DList from a seq" { - let test = seq { for i in 0..4 -> i } - DList.ofSeq test |> Expect.equal "" expected + test "test ofSeq should create a DList from a seq" { + let input = seq { for i in 0..4 -> i } + + DList.ofSeq input + |> DList.toSeq + |> Seq.toList + |> Expect.equal "" [ 0; 1; 2; 3; 4 ] } - ptest "test ofSeq should create a DList from a list" { - let test = [ for i in 0..4 -> i ] - DList.ofSeq test |> Expect.equal "" expected + test "test ofSeq should create a DList from a list" { + let input = [ for i in 0..4 -> i ] + + DList.ofSeq input + |> DList.toSeq + |> Seq.toList + |> Expect.equal "" [ 0; 1; 2; 3; 4 ] } - ptest "test ofSeq should create a DList from an array" { - let test = [| for i in 0..4 -> i |] - DList.ofSeq test |> Expect.equal "" expected + test "test ofSeq should create a DList from an array" { + let input = [| for i in 0..4 -> i |] + + DList.ofSeq input + |> DList.toSeq + |> Seq.toList + |> Expect.equal "" [ 0; 1; 2; 3; 4 ] } test "test DList.cons should prepend 10 to the front of the original list" { diff --git a/tests/FSharpx.Collections.Experimental.Tests/SkewBinomialHeapTest.fs b/tests/FSharpx.Collections.Experimental.Tests/SkewBinomialHeapTest.fs index 53f1d14b..a126ce9f 100644 --- a/tests/FSharpx.Collections.Experimental.Tests/SkewBinomialHeapTest.fs +++ b/tests/FSharpx.Collections.Experimental.Tests/SkewBinomialHeapTest.fs @@ -191,20 +191,6 @@ module SkewBinomialHeapTest = } - //@@@@@@@@@@@@@@@@@@@ - let iComparableGen() : Gen = - gen { - let! t = - Arb.generate - |> Gen.filter(fun x -> - match x :> obj with - | :? System.IComparable -> true - | _ -> false) - - return t :> System.IComparable - } - //|> Arb.fromGen - let genDesc d = match d with | Some v -> Gen.constant v @@ -213,7 +199,8 @@ module SkewBinomialHeapTest = let emptyOnly d = gen { let! desc = genDesc d - let! s = Gen.listOf(Arb.generate<'T>) + let! n = Gen.choose(0, 12) + let! s = Gen.listOfLength n Arb.generate return { Heap = @@ -227,7 +214,8 @@ module SkewBinomialHeapTest = gen { let! desc = genDesc d let! t = Gen.elements [ true; false ] - let! s = Gen.nonEmptyListOf <| iComparableGen() + let! n = Gen.length1thru12 + let! s = Gen.listOfLength n Arb.generate let! ndel = if t then @@ -302,7 +290,7 @@ module SkewBinomialHeapTest = (Prop.forAll(Arb.fromGen heapStringGen) <| fun (heap, orig) -> heap |> SkewBinomialHeap.toSeq |> Seq.toList = sortList heap orig) - ptestPropertyWithConfig + testPropertyWithConfig config10k "toList returns the same as toSeq |> List.ofSeq" (Prop.forAll(comparableAndComparable()) @@ -535,7 +523,7 @@ module SkewBinomialHeapTest = // |> SkewBinomialHeap.toList // |> Expect.equal "" (orig1 |> List.append orig2 |> sortList heap1)) - ptestPropertyWithConfig + testPropertyWithConfig config10k "merge throws when both heaps have diferent ordering" (Prop.forAll(differentOrdered()) @@ -592,7 +580,7 @@ module SkewBinomialHeapTest = ////Maybe the distribution of the hash should be checked ////to avoid bad hashes, I don't know if that should be done as part of unit testPropertyWithConfig config10king - ptestPropertyWithConfig + testPropertyWithConfig config10k "Equality reflexivity" (Prop.forAll(comparableAndComparable()) From 4fa827265ed80df0690955e0a7f87f0eaaad6396 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 9 Mar 2026 13:14:25 +0000 Subject: [PATCH 2/2] ci: trigger checks