Skip to content

Commit

Permalink
Fix rare, flaky Gen.frequency test
Browse files Browse the repository at this point in the history
  • Loading branch information
Hydrotoast committed Jan 12, 2019
1 parent 2fee67a commit 1cf6d1b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion jvm/src/test/scala/org/scalacheck/GenSpecification.scala
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,15 @@ object GenSpecification extends Properties("Gen") {
forAll(g) { n => true }
}

property("frequency 3") = forAll(choose(0,100000)) { n =>
property("frequency 3") = forAll(choose(1,100000)) { n =>
forAll(frequency(List.fill(n)((1,const(0))): _*)) { _ == 0 }
}

property("frequency 4") =
Prop.throws(classOf[IllegalArgumentException]) {
frequency()
}

property("lzy") = forAll((g: Gen[Int]) => lzy(g) == g)

property("wrap") = forAll((g: Gen[Int]) => delay(g) == g)
Expand Down

0 comments on commit 1cf6d1b

Please sign in to comment.