Skip to content

Commit

Permalink
Merge pull request #952 from ceedubs/scalacheck-params
Browse files Browse the repository at this point in the history
Reduce maxSize and minSuccessful in Scalacheck params
  • Loading branch information
ceedubs committed Apr 18, 2016
2 parents f529669 + 2e7b4ff commit ed194a7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
5 changes: 4 additions & 1 deletion laws/src/main/scala/cats/laws/discipline/Eq.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cats
package laws
package discipline

import catalysts.Platform
import algebra.Eq
import cats.std.string._
import org.scalacheck.Arbitrary
Expand All @@ -13,8 +14,10 @@ object eq {
* and comparing the application of the two functions.
*/
implicit def function1Eq[A, B](implicit A: Arbitrary[A], B: Eq[B]): Eq[A => B] = new Eq[A => B] {
val sampleCnt: Int = if (Platform.isJvm) 50 else 5

def eqv(f: A => B, g: A => B): Boolean = {
val samples = List.fill(100)(A.arbitrary.sample).collect{
val samples = List.fill(sampleCnt)(A.arbitrary.sample).collect{
case Some(a) => a
case None => sys.error("Could not generate arbitrary values to compare two functions")
}
Expand Down
9 changes: 6 additions & 3 deletions tests/src/test/scala/cats/tests/CatsSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import catalysts.Platform
import cats.std.AllInstances
import cats.syntax.{AllSyntax, EqOps}

import org.scalactic.anyvals.{PosZDouble, PosInt}
import org.scalactic.anyvals.{PosZDouble, PosInt, PosZInt}
import org.scalatest.{FunSuite, Matchers}
import org.scalatest.prop.{Configuration, GeneratorDrivenPropertyChecks}
import org.typelevel.discipline.scalatest.Discipline
Expand All @@ -20,8 +20,11 @@ trait TestSettings extends Configuration with Matchers {

lazy val checkConfiguration: PropertyCheckConfiguration =
PropertyCheckConfiguration(
minSuccessful = if (Platform.isJvm) PosInt(100) else PosInt(10),
maxDiscardedFactor = if (Platform.isJvm) PosZDouble(5.0) else PosZDouble(50.0))
minSuccessful = if (Platform.isJvm) PosInt(50) else PosInt(5),
maxDiscardedFactor = if (Platform.isJvm) PosZDouble(5.0) else PosZDouble(50.0),
minSize = PosZInt(0),
sizeRange = if (Platform.isJvm) PosZInt(10) else PosZInt(5),
workers = PosInt(1))

lazy val slowCheckConfiguration: PropertyCheckConfiguration =
if (Platform.isJvm) checkConfiguration
Expand Down

0 comments on commit ed194a7

Please sign in to comment.