Skip to content

Commit

Permalink
condition the test on the necessary precondition
Browse files Browse the repository at this point in the history
  • Loading branch information
vreuter committed Oct 26, 2024
1 parent 66ee232 commit 0a59b37
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions modules/pan/src/test/scala/TestAtLeast2.scala
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,11 @@ class TestAtLeast2 extends AnyFunSuite, ScalaCheckPropertyChecks, should.Matcher
test("For sets, AtLeast2 is correct with apply-syntax."):
import at.ac.oeaw.imba.gerlich.gerlib.collections.AtLeast2.syntax.*
forAll: (xs: NonEmptySet[Int], x: Int) =>
val atLeast2 = AtLeast2(xs, x)
atLeast2 `contains` x shouldBe true
atLeast2.size shouldEqual (xs.length + (if xs `contains` x then 0 else 1))
// The test's principle is invalid if the "extra" element is already in the collection.
whenever(!xs.contains(x)):
val atLeast2 = AtLeast2(xs, x)
atLeast2 `contains` x shouldBe true
atLeast2.size shouldEqual (xs.length + (if xs `contains` x then 0 else 1))

test(
".map on a AtLeast2[C, *] value returns a refined value IF AND ONLY IF a functor is available for the underlying container type and the AtLeast2 syntax is imported"
Expand Down

0 comments on commit 0a59b37

Please sign in to comment.