diff --git a/build.sbt b/build.sbt index 3727d6b..8acce14 100644 --- a/build.sbt +++ b/build.sbt @@ -34,7 +34,6 @@ lazy val cell = defineModule("cell")(project) .dependsOn(numeric) lazy val geometry = defineModule("geometry")(project) - .dependsOn(testing % Test) lazy val io = defineModule("io")(project) .dependsOn(geometry, syntax) @@ -65,7 +64,7 @@ lazy val pan = defineModule("pan")(project) lazy val syntax = defineModule("syntax")(project) lazy val testing = defineModule("testing", false)(project) - .dependsOn(imaging, numeric) + .dependsOn(geometry, imaging, numeric) .settings(libraryDependencies ++= Seq( scalacheck, ironScalacheck, diff --git a/modules/testing/src/main/scala/GeometricInstances.scala b/modules/testing/src/main/scala/GeometricInstances.scala new file mode 100644 index 0000000..a18f9e2 --- /dev/null +++ b/modules/testing/src/main/scala/GeometricInstances.scala @@ -0,0 +1,19 @@ +package at.ac.oeaw.imba.gerlich.gerlib.testing + +import cats.syntax.all.* +import org.scalacheck.* + +import at.ac.oeaw.imba.gerlich.gerlib.geometry.* + +trait GeometricInstances extends CatsScalacheckInstances: + given arbitraryForXCoordinate[C](using c: Arbitrary[C]): Arbitrary[XCoordinate[C]] = c.fmap(XCoordinate.apply) + + given arbitraryForYCoordinate[C](using c: Arbitrary[C]): Arbitrary[YCoordinate[C]] = c.fmap(YCoordinate.apply) + + given arbitraryForZCoordinate[C](using c: Arbitrary[C]): Arbitrary[ZCoordinate[C]] = c.fmap(ZCoordinate.apply) + + given arbitraryForPoint3D[C](using + x: Arbitrary[XCoordinate[C]], + y: Arbitrary[YCoordinate[C]], + z: Arbitrary[ZCoordinate[C]], + ): Arbitrary[Point3D[C]] = (x, y, z).mapN(Point3D.apply)