From d66e8a7d01bd2a2f38cd1214b995afe47fced7df Mon Sep 17 00:00:00 2001 From: Luka Jacobowitz Date: Wed, 20 Sep 2017 22:06:47 +0200 Subject: [PATCH] Port tests --- .../scala/cats/kernel/laws/LawTests.scala | 1 - .../test/scala/cats/tests/CategoryTests.scala | 4 +- .../test/scala/cats/tests/ComposeTest.scala | 4 +- .../test/scala/cats/tests/ConstTests.scala | 19 +++--- .../test/scala/cats/tests/EitherKTests.scala | 4 +- .../test/scala/cats/tests/EitherTTests.scala | 18 ++++-- .../test/scala/cats/tests/EitherTests.scala | 19 +++--- .../src/test/scala/cats/tests/EvalTests.scala | 21 ++++--- .../test/scala/cats/tests/FunctionTests.scala | 59 +++++++++++-------- .../test/scala/cats/tests/GroupTests.scala | 6 +- .../src/test/scala/cats/tests/IdTTests.scala | 9 ++- .../src/test/scala/cats/tests/IorTests.scala | 4 +- .../test/scala/cats/tests/KleisliTests.scala | 6 +- .../scala/cats/tests/NonEmptyListTests.scala | 17 ++++-- .../cats/tests/NonEmptyVectorTests.scala | 9 ++- .../test/scala/cats/tests/OneAndTests.scala | 9 ++- .../test/scala/cats/tests/OptionTTests.scala | 18 ++++-- .../test/scala/cats/tests/OrderTests.scala | 10 ++-- .../src/test/scala/cats/tests/SetTests.scala | 4 +- .../src/test/scala/cats/tests/TryTests.scala | 9 ++- .../test/scala/cats/tests/Tuple2KTests.scala | 12 ++-- .../scala/cats/tests/ValidatedTests.scala | 18 ++++-- .../test/scala/cats/tests/WriterTTests.scala | 16 +++-- 23 files changed, 184 insertions(+), 112 deletions(-) diff --git a/kernel-laws/src/test/scala/cats/kernel/laws/LawTests.scala b/kernel-laws/src/test/scala/cats/kernel/laws/LawTests.scala index ccda2e6cdb0..814f6646954 100644 --- a/kernel-laws/src/test/scala/cats/kernel/laws/LawTests.scala +++ b/kernel-laws/src/test/scala/cats/kernel/laws/LawTests.scala @@ -117,7 +117,6 @@ class LawTests extends FunSuite with Discipline { checkAll("Semilattice.asMeetPartialOrder[Set[Int]]", PartialOrderTests(Semilattice.asMeetPartialOrder[Set[Int]]).partialOrder) checkAll("Semilattice.asJoinPartialOrder[Set[Int]]", PartialOrderTests(Semilattice.asJoinPartialOrder[Set[Int]]).partialOrder) - checkAll("Order[Unit]", OrderTests[Unit].order) checkAll("Order[Unit]", OrderTests[Unit].order) checkAll("Order[Boolean]", OrderTests[Boolean].order) checkAll("Order[String]", OrderTests[String].order) diff --git a/tests/src/test/scala/cats/tests/CategoryTests.scala b/tests/src/test/scala/cats/tests/CategoryTests.scala index a052e7c9fee..4aa39e1aeb7 100644 --- a/tests/src/test/scala/cats/tests/CategoryTests.scala +++ b/tests/src/test/scala/cats/tests/CategoryTests.scala @@ -1,7 +1,7 @@ package cats package tests -import cats.kernel.laws.GroupLaws +import cats.kernel.laws.discipline.{MonoidTests => MonoidTypeclassTests} import cats.arrow.Category import cats.laws.discipline.{MonoidKTests, SerializableTests} @@ -15,5 +15,5 @@ class CategoryTest extends CatsSuite { checkAll("Category[Function1].algebraK", SerializableTests.serializable(functionCategory.algebraK)) val functionAlgebra = functionCategory.algebra[Int] - checkAll("Category[Function1].algebra[Int]", GroupLaws[Endo[Int]].monoid(functionAlgebra)) + checkAll("Category[Function1].algebra[Int]", MonoidTypeclassTests[Endo[Int]](functionAlgebra).monoid) } diff --git a/tests/src/test/scala/cats/tests/ComposeTest.scala b/tests/src/test/scala/cats/tests/ComposeTest.scala index d848901f2c5..ad62f4150b2 100644 --- a/tests/src/test/scala/cats/tests/ComposeTest.scala +++ b/tests/src/test/scala/cats/tests/ComposeTest.scala @@ -1,7 +1,7 @@ package cats package tests -import cats.kernel.laws.GroupLaws +import cats.kernel.laws.discipline.{SemigroupTests => SemigroupTypeclassTests} import cats.arrow.Compose import cats.laws.discipline.{SemigroupKTests, SerializableTests} @@ -15,7 +15,7 @@ class ComposeTest extends CatsSuite { checkAll("Compose[Function1].algebraK", SerializableTests.serializable(functionCompose.algebraK)) val functionAlgebra = functionCompose.algebra[Int] - checkAll("Compose[Function1].algebra[Int]", GroupLaws[Endo[Int]].semigroup(functionAlgebra)) + checkAll("Compose[Function1].algebra[Int]", SemigroupTypeclassTests[Endo[Int]](functionAlgebra).semigroup) test("syntax") { (((_: Int) + 1) <<< ((_: Int) / 2))(2) should be(2) diff --git a/tests/src/test/scala/cats/tests/ConstTests.scala b/tests/src/test/scala/cats/tests/ConstTests.scala index 9b9b8d8541f..ea7ba69eac3 100644 --- a/tests/src/test/scala/cats/tests/ConstTests.scala +++ b/tests/src/test/scala/cats/tests/ConstTests.scala @@ -1,8 +1,13 @@ package cats package tests -import cats.kernel.laws.{GroupLaws, OrderLaws} - +import cats.kernel.laws.discipline.{ + MonoidTests => MonoidTypeclassTests, + SemigroupTests => SemigroupTypeclassTests, + OrderTests => OrderTypeclassTests, + PartialOrderTests => PartialOrderTypeclassTests, + EqTests => EqTypeclassTests +} import cats.data.{Const, NonEmptyList} import cats.functor.Contravariant import cats.laws.discipline._ @@ -30,17 +35,17 @@ class ConstTests extends CatsSuite { } // Algebra checks for Serializability of instances as part of the laws - checkAll("Monoid[Const[Int, String]]", GroupLaws[Const[Int, String]].monoid) + checkAll("Monoid[Const[Int, String]]", MonoidTypeclassTests[Const[Int, String]].monoid) - checkAll("Const[NonEmptyList[Int], String]", GroupLaws[Const[NonEmptyList[Int], String]].semigroup) + checkAll("Const[NonEmptyList[Int], String]", SemigroupTypeclassTests[Const[NonEmptyList[Int], String]].semigroup) // Note while Eq is a superclass of PartialOrder and PartialOrder a superclass // of Order, you can get different instances with different (more general) constraints. // For instance, you can get an Order for Const if the first type parameter has an Order, // but you can also get just an Eq for Const if the first type parameter has just an Eq - checkAll("Const[Map[Int, Int], String]", OrderLaws[Const[Map[Int, Int], String]].eqv) - checkAll("PartialOrder[Const[Set[Int], String]]", OrderLaws[Const[Set[Int], String]].partialOrder) - checkAll("Order[Const[Int, String]]", OrderLaws[Const[Int, String]].order) + checkAll("Const[Map[Int, Int], String]", EqTypeclassTests[Const[Map[Int, Int], String]].eqv) + checkAll("PartialOrder[Const[Set[Int], String]]", PartialOrderTypeclassTests[Const[Set[Int], String]].partialOrder) + checkAll("Order[Const[Int, String]]", OrderTypeclassTests[Const[Int, String]].order) checkAll("Const[String, Int]", ContravariantTests[Const[String, ?]].contravariant[Int, Int, Int]) checkAll("Contravariant[Const[String, ?]]", SerializableTests.serializable(Contravariant[Const[String, ?]])) diff --git a/tests/src/test/scala/cats/tests/EitherKTests.scala b/tests/src/test/scala/cats/tests/EitherKTests.scala index c7b2998adb1..7d2c766e979 100644 --- a/tests/src/test/scala/cats/tests/EitherKTests.scala +++ b/tests/src/test/scala/cats/tests/EitherKTests.scala @@ -1,7 +1,7 @@ package cats.tests import cats._ -import cats.kernel.laws.OrderLaws +import cats.kernel.laws.discipline.{EqTests => EqTypeclassTests} import cats.data.EitherK import cats.functor.Contravariant import cats.laws.discipline._ @@ -28,7 +28,7 @@ class EitherKTests extends CatsSuite { checkAll("CoflatMap[EitherK[Eval, Eval, ?]]", SerializableTests.serializable(CoflatMap[EitherK[Eval, Eval, ?]])) } - checkAll("EitherK[Option, Option, Int]", OrderLaws[EitherK[Option, Option, Int]].eqv) + checkAll("EitherK[Option, Option, Int]", EqTypeclassTests[EitherK[Option, Option, Int]].eqv) checkAll("Eq[EitherK[Option, Option, Int]]", SerializableTests.serializable(Eq[EitherK[Option, Option, Int]])) checkAll("EitherK[Show, Show, ?]", ContravariantTests[EitherK[Show, Show, ?]].contravariant[Int, Int, Int]) diff --git a/tests/src/test/scala/cats/tests/EitherTTests.scala b/tests/src/test/scala/cats/tests/EitherTTests.scala index 01663ee5ac1..11aefbd8d03 100644 --- a/tests/src/test/scala/cats/tests/EitherTTests.scala +++ b/tests/src/test/scala/cats/tests/EitherTTests.scala @@ -6,7 +6,13 @@ import cats.functor.Bifunctor import cats.functor._ import cats.laws.discipline._ import cats.laws.discipline.arbitrary._ -import cats.kernel.laws.{GroupLaws, OrderLaws} +import cats.kernel.laws.discipline.{ +MonoidTests => MonoidTypeclassTests, +SemigroupTests => SemigroupTypeclassTests, +OrderTests => OrderTypeclassTests, +PartialOrderTests => PartialOrderTypeclassTests, +EqTests => EqTypeclassTests +} class EitherTTests extends CatsSuite { @@ -20,7 +26,7 @@ class EitherTTests extends CatsSuite { { implicit val F = ListWrapper.order[Either[String, Int]] - checkAll("EitherT[List, String, Int]", OrderLaws[EitherT[ListWrapper, String, Int]].order) + checkAll("EitherT[List, String, Int]", OrderTypeclassTests[EitherT[ListWrapper, String, Int]].order) checkAll("Order[EitherT[List, String, Int]]", SerializableTests.serializable(Order[EitherT[ListWrapper, String, Int]])) } @@ -100,14 +106,14 @@ class EitherTTests extends CatsSuite { { implicit val F = ListWrapper.partialOrder[Either[String, Int]] - checkAll("EitherT[ListWrapper, String, Int]", OrderLaws[EitherT[ListWrapper, String, Int]].partialOrder) + checkAll("EitherT[ListWrapper, String, Int]", PartialOrderTypeclassTests[EitherT[ListWrapper, String, Int]].partialOrder) checkAll("PartialOrder[EitherT[ListWrapper, String, Int]]", SerializableTests.serializable(PartialOrder[EitherT[ListWrapper, String, Int]])) } { implicit val F = ListWrapper.semigroup[Either[String, Int]] - checkAll("EitherT[ListWrapper, String, Int]", GroupLaws[EitherT[ListWrapper, String, Int]].semigroup) + checkAll("EitherT[ListWrapper, String, Int]", SemigroupTypeclassTests[EitherT[ListWrapper, String, Int]].semigroup) checkAll("Semigroup[EitherT[ListWrapper, String, Int]]", SerializableTests.serializable(Semigroup[EitherT[ListWrapper, String, Int]])) } @@ -116,14 +122,14 @@ class EitherTTests extends CatsSuite { Semigroup[EitherT[ListWrapper, String, Int]] - checkAll("EitherT[ListWrapper, String, Int]", GroupLaws[EitherT[ListWrapper, String, Int]].monoid) + checkAll("EitherT[ListWrapper, String, Int]", MonoidTypeclassTests[EitherT[ListWrapper, String, Int]].monoid) checkAll("Monoid[EitherT[ListWrapper, String, Int]]", SerializableTests.serializable(Monoid[EitherT[ListWrapper, String, Int]])) } { implicit val F = ListWrapper.eqv[Either[String, Int]] - checkAll("EitherT[ListWrapper, String, Int]", OrderLaws[EitherT[ListWrapper, String, Int]].eqv) + checkAll("EitherT[ListWrapper, String, Int]", EqTypeclassTests[EitherT[ListWrapper, String, Int]].eqv) checkAll("Eq[EitherT[ListWrapper, String, Int]]", SerializableTests.serializable(Eq[EitherT[ListWrapper, String, Int]])) } diff --git a/tests/src/test/scala/cats/tests/EitherTests.scala b/tests/src/test/scala/cats/tests/EitherTests.scala index 47f1c7db2fb..3c48abdd8ab 100644 --- a/tests/src/test/scala/cats/tests/EitherTests.scala +++ b/tests/src/test/scala/cats/tests/EitherTests.scala @@ -3,13 +3,19 @@ package tests import cats.data.EitherT import cats.laws.discipline._ -import cats.kernel.laws.{GroupLaws, OrderLaws} +import cats.kernel.laws.discipline.{ + MonoidTests => MonoidTypeclassTests, + SemigroupTests => SemigroupTypeclassTests, + OrderTests => OrderTypeclassTests, + PartialOrderTests => PartialOrderTypeclassTests, + EqTests => EqTypeclassTests +} import scala.util.Try class EitherTests extends CatsSuite { implicit val iso = CartesianTests.Isomorphisms.invariant[Either[Int, ?]] - checkAll("Either[String, Int]", GroupLaws[Either[String, Int]].monoid) + checkAll("Either[String, Int]", MonoidTypeclassTests[Either[String, Int]].monoid) checkAll("Monoid[Either[String, Int]]", SerializableTests.serializable(Monoid[Either[String, Int]])) checkAll("Either[Int, Int]", CartesianTests[Either[Int, ?]].cartesian[Int, Int, Int]) @@ -29,7 +35,7 @@ class EitherTests extends CatsSuite { checkAll("Either[ListWrapper[String], ?]", SemigroupKTests[Either[ListWrapper[String], ?]].semigroupK[Int]) checkAll("SemigroupK[Either[ListWrapper[String], ?]]", SerializableTests.serializable(SemigroupK[Either[ListWrapper[String], ?]])) - checkAll("Either[ListWrapper[String], Int]", GroupLaws[Either[ListWrapper[String], Int]].semigroup) + checkAll("Either[ListWrapper[String], Int]", SemigroupTypeclassTests[Either[ListWrapper[String], Int]].semigroup) checkAll("Semigroup[Either[ListWrapper[String], Int]]", SerializableTests.serializable(Semigroup[Either[ListWrapper[String], Int]])) val partialOrder = catsStdPartialOrderForEither[Int, String] @@ -40,13 +46,12 @@ class EitherTests extends CatsSuite { { implicit val S = ListWrapper.eqv[String] implicit val I = ListWrapper.eqv[Int] - checkAll("Either[ListWrapper[String], ListWrapper[Int]]", OrderLaws[Either[ListWrapper[String], ListWrapper[Int]]].eqv) + checkAll("Either[ListWrapper[String], ListWrapper[Int]]", EqTypeclassTests[Either[ListWrapper[String], ListWrapper[Int]]].eqv) checkAll("Eq[Either[ListWrapper[String], ListWrapper[Int]]]", SerializableTests.serializable(Eq[Either[ListWrapper[String], ListWrapper[Int]]])) } - val orderLaws = OrderLaws[Either[Int, String]] - checkAll("Either[Int, String]", orderLaws.partialOrder(partialOrder)) - checkAll("Either[Int, String]", orderLaws.order(order)) + checkAll("Either[Int, String]", PartialOrderTypeclassTests[Either[Int, String]](partialOrder).partialOrder) + checkAll("Either[Int, String]", OrderTypeclassTests[Either[Int, String]](order).order) test("Left/Right cast syntax") { forAll { (e: Either[Int, String]) => diff --git a/tests/src/test/scala/cats/tests/EvalTests.scala b/tests/src/test/scala/cats/tests/EvalTests.scala index d67d6500a67..bb66ce27031 100644 --- a/tests/src/test/scala/cats/tests/EvalTests.scala +++ b/tests/src/test/scala/cats/tests/EvalTests.scala @@ -5,7 +5,14 @@ import scala.math.min import cats.laws.ComonadLaws import cats.laws.discipline.{BimonadTests, CartesianTests, ReducibleTests, SerializableTests} import cats.laws.discipline.arbitrary._ -import cats.kernel.laws.{GroupLaws, OrderLaws} +import cats.kernel.laws.discipline.{ + MonoidTests => MonoidTypeclassTests, + SemigroupTests => SemigroupTypeclassTests, + GroupTests => GroupTypeclassTests, + OrderTests => OrderTypeclassTests, + PartialOrderTests => PartialOrderTypeclassTests, + EqTests => EqTypeclassTests +} class EvalTests extends CatsSuite { implicit val eqThrow: Eq[Throwable] = Eq.allEqual @@ -95,31 +102,31 @@ class EvalTests extends CatsSuite { checkAll("Eval[Int]", ReducibleTests[Eval].reducible[Option, Int, Int]) checkAll("Reducible[Eval]", SerializableTests.serializable(Reducible[Eval])) - checkAll("Eval[Int]", GroupLaws[Eval[Int]].group) + checkAll("Eval[Int]", GroupTypeclassTests[Eval[Int]].group) { implicit val A = ListWrapper.monoid[Int] - checkAll("Eval[ListWrapper[Int]]", GroupLaws[Eval[ListWrapper[Int]]].monoid) + checkAll("Eval[ListWrapper[Int]]", MonoidTypeclassTests[Eval[ListWrapper[Int]]].monoid) } { implicit val A = ListWrapper.semigroup[Int] - checkAll("Eval[ListWrapper[Int]]", GroupLaws[Eval[ListWrapper[Int]]].semigroup) + checkAll("Eval[ListWrapper[Int]]", SemigroupTypeclassTests[Eval[ListWrapper[Int]]].semigroup) } { implicit val A = ListWrapper.order[Int] - checkAll("Eval[ListWrapper[Int]]", OrderLaws[Eval[ListWrapper[Int]]].order) + checkAll("Eval[ListWrapper[Int]]", OrderTypeclassTests[Eval[ListWrapper[Int]]].order) } { implicit val A = ListWrapper.partialOrder[Int] - checkAll("Eval[ListWrapper[Int]]", OrderLaws[Eval[ListWrapper[Int]]].partialOrder) + checkAll("Eval[ListWrapper[Int]]", PartialOrderTypeclassTests[Eval[ListWrapper[Int]]].partialOrder) } { implicit val A = ListWrapper.eqv[Int] - checkAll("Eval[ListWrapper[Int]]", OrderLaws[Eval[ListWrapper[Int]]].eqv) + checkAll("Eval[ListWrapper[Int]]", EqTypeclassTests[Eval[ListWrapper[Int]]].eqv) } // The following tests check laws which are a different formulation of diff --git a/tests/src/test/scala/cats/tests/FunctionTests.scala b/tests/src/test/scala/cats/tests/FunctionTests.scala index 6d12d52486d..d7dcefe9a6a 100644 --- a/tests/src/test/scala/cats/tests/FunctionTests.scala +++ b/tests/src/test/scala/cats/tests/FunctionTests.scala @@ -1,12 +1,25 @@ package cats package tests -import cats.arrow.{CommutativeArrow, Choice} +import cats.arrow.{Choice, CommutativeArrow} import cats.functor.Contravariant +import cats.kernel.laws.discipline.{ + MonoidTests => MonoidTypeclassTests, + SemigroupTests => SemigroupTypeclassTests, + EqTests => EqTypeclassTests, + CommutativeSemigroupTests, + PartialOrderTests => PartialOrderTypeclassTests, + OrderTests => OrderTypeclassTests, + BandTests, + SemilatticeTests, + CommutativeMonoidTests, + BoundedSemilatticeTests, + GroupTests => GroupTypeclassTests, + CommutativeGroupTests +} import cats.laws.discipline._ import cats.laws.discipline.eq._ import cats.laws.discipline.arbitrary._ -import cats.kernel.laws.{ GroupLaws, OrderLaws } import cats.kernel.{ CommutativeSemigroup, CommutativeMonoid, CommutativeGroup } import cats.kernel.{ Band, Semilattice, BoundedSemilattice } @@ -41,18 +54,18 @@ class FunctionTests extends CatsSuite { // law checks for the various Function0-related instances - checkAll("Function0[Eqed]", OrderLaws[Function0[Eqed]].eqv) - checkAll("Function0[POrd]", OrderLaws[Function0[POrd]].partialOrder) - checkAll("Function0[Ord]", OrderLaws[Function0[Ord]].order) - checkAll("Function0[Semi]", GroupLaws[Function0[Semi]].semigroup) - checkAll("Function0[CSemi]", GroupLaws[Function0[CSemi]].commutativeSemigroup) - checkAll("Function0[Bnd]", GroupLaws[Function0[Bnd]].band) - checkAll("Function0[SL]", GroupLaws[Function0[SL]].semilattice) - checkAll("Function0[BSL]", GroupLaws[Function0[BSL]].boundedSemilattice) - checkAll("Function0[Mono]", GroupLaws[Function0[Mono]].monoid) - checkAll("Function0[CMono]", GroupLaws[Function0[CMono]].commutativeMonoid) - checkAll("Function0[Grp]", GroupLaws[Function0[Grp]].group) - checkAll("Function0[CGrp]", GroupLaws[Function0[CGrp]].commutativeGroup) + checkAll("Function0[Eqed]", EqTypeclassTests[Function0[Eqed]].eqv) + checkAll("Function0[POrd]", PartialOrderTypeclassTests[Function0[POrd]].partialOrder) + checkAll("Function0[Ord]", OrderTypeclassTests[Function0[Ord]].order) + checkAll("Function0[Semi]", SemigroupTypeclassTests[Function0[Semi]].semigroup) + checkAll("Function0[CSemi]", CommutativeSemigroupTests[Function0[CSemi]].commutativeSemigroup) + checkAll("Function0[Bnd]", BandTests[Function0[Bnd]].band) + checkAll("Function0[SL]", SemilatticeTests[Function0[SL]].semilattice) + checkAll("Function0[BSL]", BoundedSemilatticeTests[Function0[BSL]].boundedSemilattice) + checkAll("Function0[Mono]", MonoidTypeclassTests[Function0[Mono]].monoid) + checkAll("Function0[CMono]", CommutativeMonoidTests[Function0[CMono]].commutativeMonoid) + checkAll("Function0[Grp]", GroupTypeclassTests[Function0[Grp]].group) + checkAll("Function0[CGrp]", CommutativeGroupTests[Function0[CGrp]].commutativeGroup) // serialization tests for the various Function0-related instances checkAll("Eq[() => Eqed]", SerializableTests.serializable(Eq[() => Eqed])) @@ -70,15 +83,15 @@ class FunctionTests extends CatsSuite { // law checks for the various Function1-related instances - checkAll("Function1[String, Semi]", GroupLaws[Function1[String, Semi]].semigroup) - checkAll("Function1[String, CSemi]", GroupLaws[Function1[String, CSemi]].commutativeSemigroup) - checkAll("Function1[String, Bnd]", GroupLaws[Function1[String, Bnd]].band) - checkAll("Function1[String, SL]", GroupLaws[Function1[String, SL]].semilattice) - checkAll("Function1[String, BSL]", GroupLaws[Function1[String, BSL]].boundedSemilattice) - checkAll("Function1[String, Mono]", GroupLaws[Function1[String, Mono]].monoid) - checkAll("Function1[String, CMono]", GroupLaws[Function1[String, CMono]].commutativeMonoid) - checkAll("Function1[String, Grp]", GroupLaws[Function1[String, Grp]].group) - checkAll("Function1[String, CGrp]", GroupLaws[Function1[String, CGrp]].commutativeGroup) + checkAll("Function1[String, Semi]", SemigroupTypeclassTests[Function1[String, Semi]].semigroup) + checkAll("Function1[String, CSemi]", CommutativeSemigroupTests[Function1[String, CSemi]].commutativeSemigroup) + checkAll("Function1[String, Bnd]", BandTests[Function1[String, Bnd]].band) + checkAll("Function1[String, SL]", SemilatticeTests[Function1[String, SL]].semilattice) + checkAll("Function1[String, BSL]", BoundedSemilatticeTests[Function1[String, BSL]].boundedSemilattice) + checkAll("Function1[String, Mono]", MonoidTypeclassTests[Function1[String, Mono]].monoid) + checkAll("Function1[String, CMono]", CommutativeMonoidTests[Function1[String, CMono]].commutativeMonoid) + checkAll("Function1[String, Grp]", GroupTypeclassTests[Function1[String, Grp]].group) + checkAll("Function1[String, CGrp]", CommutativeGroupTests[Function1[String, CGrp]].commutativeGroup) // serialization tests for the various Function1-related instances checkAll("Semigroup[String => Semi]", SerializableTests.serializable(Semigroup[String => Semi])) diff --git a/tests/src/test/scala/cats/tests/GroupTests.scala b/tests/src/test/scala/cats/tests/GroupTests.scala index 03d80a5fc9e..475e48efa7e 100644 --- a/tests/src/test/scala/cats/tests/GroupTests.scala +++ b/tests/src/test/scala/cats/tests/GroupTests.scala @@ -1,7 +1,7 @@ package cats package tests -import cats.kernel.laws.GroupLaws +import cats.kernel.laws.discipline.{GroupTests => GroupTypeclassTests} class GroupTests extends CatsSuite { test("combine minValue") { @@ -18,9 +18,9 @@ class GroupTests extends CatsSuite { Group[Int].remove(1, 2) should ===(-1) } - checkAll("Int", GroupLaws[Int].group) + checkAll("Int", GroupTypeclassTests[Int].group) // float and double are *not* associative, and scalacheck knows // checkAll("Double", GroupLaws[Double].group) // checkAll("Float", GroupLaws[Float].group) - checkAll("Long", GroupLaws[Long].group) + checkAll("Long", GroupTypeclassTests[Long].group) } diff --git a/tests/src/test/scala/cats/tests/IdTTests.scala b/tests/src/test/scala/cats/tests/IdTTests.scala index 24a0daf25c9..3321fe4df63 100644 --- a/tests/src/test/scala/cats/tests/IdTTests.scala +++ b/tests/src/test/scala/cats/tests/IdTTests.scala @@ -2,7 +2,10 @@ package cats package tests import cats.data.{IdT, NonEmptyList} -import cats.kernel.laws.OrderLaws +import cats.kernel.laws.discipline.{ + OrderTests => OrderTypeclassTests, + EqTests => EqTypeclassTests +} import cats.laws.discipline._ import cats.laws.discipline.arbitrary._ @@ -13,14 +16,14 @@ class IdTTests extends CatsSuite { { implicit val F = ListWrapper.eqv[Option[Int]] - checkAll("IdT[ListWrapper, Int]", OrderLaws[IdT[ListWrapper, Int]].eqv) + checkAll("IdT[ListWrapper, Int]", EqTypeclassTests[IdT[ListWrapper, Int]].eqv) checkAll("Eq[IdT[ListWrapper, Int]]", SerializableTests.serializable(Eq[IdT[ListWrapper, Int]])) } { implicit val F = ListWrapper.order[Int] - checkAll("IdT[ListWrapper, Int]", OrderLaws[IdT[ListWrapper, Int]].order) + checkAll("IdT[ListWrapper, Int]", OrderTypeclassTests[IdT[ListWrapper, Int]].order) checkAll("Order[IdT[ListWrapper, Int]]", SerializableTests.serializable(Order[IdT[ListWrapper, Int]])) } diff --git a/tests/src/test/scala/cats/tests/IorTests.scala b/tests/src/test/scala/cats/tests/IorTests.scala index 2b6d4a30ed7..7d1fd3149d7 100644 --- a/tests/src/test/scala/cats/tests/IorTests.scala +++ b/tests/src/test/scala/cats/tests/IorTests.scala @@ -1,7 +1,7 @@ package cats package tests -import cats.kernel.laws.GroupLaws +import cats.kernel.laws.discipline.{SemigroupTests => SemigroupTypeclassTests} import cats.laws.discipline.{BifunctorTests, CartesianTests, MonadErrorTests, SerializableTests, TraverseTests} import cats.data.{Ior, NonEmptyList, EitherT} import cats.laws.discipline.arbitrary._ @@ -23,7 +23,7 @@ class IorTests extends CatsSuite { checkAll("Traverse[String Ior ?]", SerializableTests.serializable(Traverse[String Ior ?])) checkAll("? Ior ?", BifunctorTests[Ior].bifunctor[Int, Int, Int, String, String, String]) - checkAll("Semigroup[Ior[A: Semigroup, B: Semigroup]]", GroupLaws[Ior[List[Int], List[Int]]].semigroup) + checkAll("Semigroup[Ior[A: Semigroup, B: Semigroup]]", SemigroupTypeclassTests[Ior[List[Int], List[Int]]].semigroup) checkAll("SerializableTest Semigroup[Ior[A: Semigroup, B: Semigroup]]", SerializableTests.serializable(Semigroup[Ior[List[Int], List[Int]]])) test("left Option is defined left and both") { diff --git a/tests/src/test/scala/cats/tests/KleisliTests.scala b/tests/src/test/scala/cats/tests/KleisliTests.scala index c368ec1fb23..1fcbed677b5 100644 --- a/tests/src/test/scala/cats/tests/KleisliTests.scala +++ b/tests/src/test/scala/cats/tests/KleisliTests.scala @@ -8,7 +8,7 @@ import cats.laws.discipline._ import cats.laws.discipline.arbitrary._ import cats.laws.discipline.eq._ import org.scalacheck.Arbitrary -import cats.kernel.laws.GroupLaws +import cats.kernel.laws.discipline.{MonoidTests => MonoidTypeclassTests, SemigroupTests => SemigroupTypeclassTests} import cats.laws.discipline.{SemigroupKTests, MonoidKTests} class KleisliTests extends CatsSuite { @@ -107,13 +107,13 @@ class KleisliTests extends CatsSuite { { implicit val catsDataMonoidForKleisli = Kleisli.catsDataMonoidForKleisli[Option, Int, String] - checkAll("Kleisli[Option, Int, String]", GroupLaws[Kleisli[Option, Int, String]].monoid) + checkAll("Kleisli[Option, Int, String]", MonoidTypeclassTests[Kleisli[Option, Int, String]].monoid) checkAll("Monoid[Kleisli[Option, Int, String]]", SerializableTests.serializable(catsDataMonoidForKleisli)) } { implicit val catsDataSemigroupForKleisli = Kleisli.catsDataSemigroupForKleisli[Option, Int, String] - checkAll("Kleisli[Option, Int, String]", GroupLaws[Kleisli[Option, Int, String]].semigroup) + checkAll("Kleisli[Option, Int, String]", SemigroupTypeclassTests[Kleisli[Option, Int, String]].semigroup) checkAll("Semigroup[Kleisli[Option, Int, String]]", SerializableTests.serializable(catsDataSemigroupForKleisli)) } diff --git a/tests/src/test/scala/cats/tests/NonEmptyListTests.scala b/tests/src/test/scala/cats/tests/NonEmptyListTests.scala index 55261d2aa57..071df28c7a5 100644 --- a/tests/src/test/scala/cats/tests/NonEmptyListTests.scala +++ b/tests/src/test/scala/cats/tests/NonEmptyListTests.scala @@ -1,7 +1,12 @@ package cats package tests -import cats.kernel.laws.{GroupLaws, OrderLaws} +import cats.kernel.laws.discipline.{ + SemigroupTests => SemigroupTypeclassTests, + OrderTests => OrderTypeclassTests, + PartialOrderTests => PartialOrderTypeclassTests, + EqTests => EqTypeclassTests +} import cats.data.{NonEmptyList, NonEmptyVector} import cats.laws.discipline.arbitrary._ @@ -12,7 +17,7 @@ class NonEmptyListTests extends CatsSuite { implicit override val generatorDrivenConfig: PropertyCheckConfiguration = PropertyCheckConfiguration(minSuccessful = 20, sizeRange = 5) - checkAll("NonEmptyList[Int]", OrderLaws[NonEmptyList[Int]].order) + checkAll("NonEmptyList[Int]", OrderTypeclassTests[NonEmptyList[Int]].order) checkAll("NonEmptyList[Int] with Option", NonEmptyTraverseTests[NonEmptyList].nonEmptyTraverse[Option, Int, Int, Int, Int, Option, Option]) checkAll("NonEmptyTraverse[NonEmptyList[A]]", SerializableTests.serializable(NonEmptyTraverse[NonEmptyList])) @@ -26,18 +31,18 @@ class NonEmptyListTests extends CatsSuite { checkAll("NonEmptyList[Int]", SemigroupKTests[NonEmptyList].semigroupK[Int]) checkAll("SemigroupK[NonEmptyList[A]]", SerializableTests.serializable(SemigroupK[NonEmptyList])) - checkAll("NonEmptyList[Int]", GroupLaws[NonEmptyList[Int]].semigroup) + checkAll("NonEmptyList[Int]", SemigroupTypeclassTests[NonEmptyList[Int]].semigroup) checkAll("Semigroup[NonEmptyList[Int]]", SerializableTests.serializable(Semigroup[NonEmptyList[Int]])) checkAll("NonEmptyList[Int]", ComonadTests[NonEmptyList].comonad[Int, Int, Int]) checkAll("Comonad[NonEmptyList]", SerializableTests.serializable(Comonad[NonEmptyList])) - checkAll("NonEmptyList[ListWrapper[Int]]", OrderLaws[NonEmptyList[ListWrapper[Int]]].eqv) + checkAll("NonEmptyList[ListWrapper[Int]]", EqTypeclassTests[NonEmptyList[ListWrapper[Int]]].eqv) checkAll("Eq[NonEmptyList[ListWrapper[Int]]]", SerializableTests.serializable(Eq[NonEmptyList[ListWrapper[Int]]])) { implicit val A = ListWrapper.partialOrder[Int] - checkAll("NonEmptyList[ListWrapper[Int]]", OrderLaws[NonEmptyList[ListWrapper[Int]]].partialOrder) + checkAll("NonEmptyList[ListWrapper[Int]]", PartialOrderTypeclassTests[NonEmptyList[ListWrapper[Int]]].partialOrder) checkAll("PartialOrder[NonEmptyList[ListWrapper[Int]]]", SerializableTests.serializable(PartialOrder[NonEmptyList[ListWrapper[Int]]])) Eq[NonEmptyList[ListWrapper[Int]]] @@ -45,7 +50,7 @@ class NonEmptyListTests extends CatsSuite { { implicit val A = ListWrapper.order[Int] - checkAll("NonEmptyList[ListWrapper[Int]]", OrderLaws[NonEmptyList[ListWrapper[Int]]].order) + checkAll("NonEmptyList[ListWrapper[Int]]", OrderTypeclassTests[NonEmptyList[ListWrapper[Int]]].order) checkAll("Order[NonEmptyList[ListWrapper[Int]]]", SerializableTests.serializable(Order[NonEmptyList[ListWrapper[Int]]])) Eq[NonEmptyList[ListWrapper[Int]]] diff --git a/tests/src/test/scala/cats/tests/NonEmptyVectorTests.scala b/tests/src/test/scala/cats/tests/NonEmptyVectorTests.scala index 3b271e1b2fa..997f559d675 100644 --- a/tests/src/test/scala/cats/tests/NonEmptyVectorTests.scala +++ b/tests/src/test/scala/cats/tests/NonEmptyVectorTests.scala @@ -3,7 +3,10 @@ package tests import catalysts.Platform -import cats.kernel.laws.{GroupLaws, OrderLaws} +import cats.kernel.laws.discipline.{ + SemigroupTests => SemigroupTypeclassTests, + EqTests => EqTypeclassTests +} import cats.data.NonEmptyVector import cats.laws.discipline.{ComonadTests, SemigroupKTests, FoldableTests, SerializableTests, NonEmptyTraverseTests, ReducibleTests, MonadTests} @@ -16,7 +19,7 @@ class NonEmptyVectorTests extends CatsSuite { implicit override val generatorDrivenConfig: PropertyCheckConfiguration = PropertyCheckConfiguration(minSuccessful = 20, sizeRange = 5) - checkAll("NonEmptyVector[Int]", OrderLaws[NonEmptyVector[Int]].eqv) + checkAll("NonEmptyVector[Int]", EqTypeclassTests[NonEmptyVector[Int]].eqv) checkAll("NonEmptyVector[Int] with Option", NonEmptyTraverseTests[NonEmptyVector].nonEmptyTraverse[Option, Int, Int, Int, Int, Option, Option]) checkAll("NonEmptyTraverse[NonEmptyVector[A]]", SerializableTests.serializable(NonEmptyTraverse[NonEmptyVector])) @@ -28,7 +31,7 @@ class NonEmptyVectorTests extends CatsSuite { // Test instances that have more general constraints checkAll("NonEmptyVector[Int]", SemigroupKTests[NonEmptyVector].semigroupK[Int]) - checkAll("NonEmptyVector[Int]", GroupLaws[NonEmptyVector[Int]].semigroup) + checkAll("NonEmptyVector[Int]", SemigroupTypeclassTests[NonEmptyVector[Int]].semigroup) checkAll("SemigroupK[NonEmptyVector]", SerializableTests.serializable(SemigroupK[NonEmptyVector])) checkAll("Semigroup[NonEmptyVector[Int]]", SerializableTests.serializable(Semigroup[NonEmptyVector[Int]])) diff --git a/tests/src/test/scala/cats/tests/OneAndTests.scala b/tests/src/test/scala/cats/tests/OneAndTests.scala index bd0cd523598..365b4f9cfa8 100644 --- a/tests/src/test/scala/cats/tests/OneAndTests.scala +++ b/tests/src/test/scala/cats/tests/OneAndTests.scala @@ -1,7 +1,10 @@ package cats package tests -import cats.kernel.laws.{GroupLaws, OrderLaws} +import cats.kernel.laws.discipline.{ + SemigroupTests => SemigroupTypeclassTests, + EqTests => EqTypeclassTests +} import cats.instances.stream._ import cats.data.{NonEmptyStream, OneAnd} @@ -13,7 +16,7 @@ class OneAndTests extends CatsSuite { implicit override val generatorDrivenConfig: PropertyCheckConfiguration = PropertyCheckConfiguration(minSuccessful = 20, sizeRange = 5) - checkAll("OneAnd[Stream, Int]", OrderLaws[OneAnd[Stream, Int]].eqv) + checkAll("OneAnd[Stream, Int]", EqTypeclassTests[OneAnd[Stream, Int]].eqv) checkAll("OneAnd[Stream, Int] with Option", NonEmptyTraverseTests[OneAnd[Stream, ?]].nonEmptyTraverse[Option, Int, Int, Int, Int, Option, Option]) checkAll("NonEmptyTraverse[OneAnd[Stream, A]]", SerializableTests.serializable(NonEmptyTraverse[OneAnd[Stream, ?]])) @@ -46,7 +49,7 @@ class OneAndTests extends CatsSuite { { implicit val alternative = ListWrapper.alternative checkAll("OneAnd[ListWrapper, Int]", SemigroupKTests[OneAnd[ListWrapper, ?]].semigroupK[Int]) - checkAll("OneAnd[Stream, Int]", GroupLaws[OneAnd[Stream, Int]].semigroup) + checkAll("OneAnd[Stream, Int]", SemigroupTypeclassTests[OneAnd[Stream, Int]].semigroup) checkAll("SemigroupK[OneAnd[ListWrapper, A]]", SerializableTests.serializable(SemigroupK[OneAnd[ListWrapper, ?]])) checkAll("Semigroup[NonEmptyStream[Int]]", SerializableTests.serializable(Semigroup[OneAnd[Stream, Int]])) } diff --git a/tests/src/test/scala/cats/tests/OptionTTests.scala b/tests/src/test/scala/cats/tests/OptionTTests.scala index 450b4e915ec..a67186d9a11 100644 --- a/tests/src/test/scala/cats/tests/OptionTTests.scala +++ b/tests/src/test/scala/cats/tests/OptionTTests.scala @@ -2,7 +2,13 @@ package cats package tests import cats.data.OptionT -import cats.kernel.laws.{GroupLaws, OrderLaws} +import cats.kernel.laws.discipline.{ + MonoidTests => MonoidTypeclassTests, + SemigroupTests => SemigroupTypeclassTests, + OrderTests => OrderTypeclassTests, + PartialOrderTests => PartialOrderTypeclassTests, + EqTests => EqTypeclassTests +} import cats.laws.discipline._ import cats.laws.discipline.arbitrary._ @@ -12,14 +18,14 @@ class OptionTTests extends CatsSuite { { implicit val F = ListWrapper.eqv[Option[Int]] - checkAll("OptionT[ListWrapper, Int]", OrderLaws[OptionT[ListWrapper, Int]].eqv) + checkAll("OptionT[ListWrapper, Int]", EqTypeclassTests[OptionT[ListWrapper, Int]].eqv) checkAll("Eq[OptionT[ListWrapper, Int]]", SerializableTests.serializable(Eq[OptionT[ListWrapper, Int]])) } { implicit val F = ListWrapper.partialOrder[Option[Int]] - checkAll("OptionT[ListWrapper, Int]", OrderLaws[OptionT[ListWrapper, Int]].partialOrder) + checkAll("OptionT[ListWrapper, Int]", PartialOrderTypeclassTests[OptionT[ListWrapper, Int]].partialOrder) checkAll("PartialOrder[OptionT[ListWrapper, Int]]", SerializableTests.serializable(PartialOrder[OptionT[ListWrapper, Int]])) Eq[OptionT[ListWrapper, Int]] @@ -28,7 +34,7 @@ class OptionTTests extends CatsSuite { { implicit val F = ListWrapper.order[Option[Int]] - checkAll("OptionT[ListWrapper, Int]", OrderLaws[OptionT[ListWrapper, Int]].order) + checkAll("OptionT[ListWrapper, Int]", OrderTypeclassTests[OptionT[ListWrapper, Int]].order) checkAll("Order[OptionT[ListWrapper, Int]]", SerializableTests.serializable(Order[OptionT[ListWrapper, Int]])) PartialOrder[OptionT[ListWrapper, Int]] @@ -108,7 +114,7 @@ class OptionTTests extends CatsSuite { // F[Option[A]] has a monoid implicit val FA: Monoid[ListWrapper[Option[Int]]] = ListWrapper.monoid[Option[Int]] - checkAll("OptionT[ListWrapper, Int]", GroupLaws[OptionT[ListWrapper, Int]].monoid) + checkAll("OptionT[ListWrapper, Int]", MonoidTypeclassTests[OptionT[ListWrapper, Int]].monoid) checkAll("Monoid[OptionT[ListWrapper, Int]]", SerializableTests.serializable(Monoid[OptionT[ListWrapper, Int]])) Semigroup[OptionT[ListWrapper, Int]] @@ -118,7 +124,7 @@ class OptionTTests extends CatsSuite { // F[Option[A]] has a semigroup implicit val FA: Semigroup[ListWrapper[Option[Int]]] = ListWrapper.semigroup[Option[Int]] - checkAll("OptionT[ListWrapper, Int]", GroupLaws[OptionT[ListWrapper, Int]].semigroup) + checkAll("OptionT[ListWrapper, Int]", SemigroupTypeclassTests[OptionT[ListWrapper, Int]].semigroup) checkAll("Semigroup[OptionT[ListWrapper, Int]]", SerializableTests.serializable(Semigroup[OptionT[ListWrapper, Int]])) } diff --git a/tests/src/test/scala/cats/tests/OrderTests.scala b/tests/src/test/scala/cats/tests/OrderTests.scala index 7ac6d845cab..670fec4f705 100644 --- a/tests/src/test/scala/cats/tests/OrderTests.scala +++ b/tests/src/test/scala/cats/tests/OrderTests.scala @@ -2,7 +2,7 @@ package cats package tests import cats.functor._ -import cats.kernel.laws.OrderLaws +import cats.kernel.laws.discipline.{OrderTests => OrderTypeclassTests} class OrderTests extends CatsSuite { { @@ -10,10 +10,10 @@ class OrderTests extends CatsSuite { Contravariant[Order] } - checkAll("Int", OrderLaws[Int].order) - checkAll("Double", OrderLaws[Double].order) - checkAll("Float", OrderLaws[Float].order) - checkAll("Long", OrderLaws[Long].order) + checkAll("Int", OrderTypeclassTests[Int].order) + checkAll("Double", OrderTypeclassTests[Double].order) + checkAll("Float", OrderTypeclassTests[Float].order) + checkAll("Long", OrderTypeclassTests[Long].order) } object OrderTests { diff --git a/tests/src/test/scala/cats/tests/SetTests.scala b/tests/src/test/scala/cats/tests/SetTests.scala index 3dfb7055824..78e6c08481e 100644 --- a/tests/src/test/scala/cats/tests/SetTests.scala +++ b/tests/src/test/scala/cats/tests/SetTests.scala @@ -2,9 +2,9 @@ package cats package tests import cats.laws.discipline.{FoldableTests, MonoidKTests, SerializableTests} - +import cats.kernel.laws.discipline.{MonoidTests => MonoidTypeclassTests} class SetTests extends CatsSuite { - checkAll("Set[Int]", cats.kernel.laws.GroupLaws[Set[Int]].monoid) + checkAll("Set[Int]", MonoidTypeclassTests[Set[Int]].monoid) checkAll("Set[Int]", MonoidKTests[Set].monoidK[Int]) checkAll("MonoidK[Set]", SerializableTests.serializable(MonoidK[Set])) diff --git a/tests/src/test/scala/cats/tests/TryTests.scala b/tests/src/test/scala/cats/tests/TryTests.scala index 7fe11c32932..7cbab91b98e 100644 --- a/tests/src/test/scala/cats/tests/TryTests.scala +++ b/tests/src/test/scala/cats/tests/TryTests.scala @@ -1,7 +1,10 @@ package cats package tests -import cats.kernel.laws.GroupLaws +import cats.kernel.laws.discipline.{ + SemigroupTests => SemigroupTypeclassTests, + MonoidTests => MonoidTypeclassTests +} import cats.laws.{ApplicativeLaws, CoflatMapLaws, FlatMapLaws, MonadLaws} import cats.laws.discipline._ import cats.laws.discipline.arbitrary._ @@ -29,11 +32,11 @@ class TryTests extends CatsSuite { { implicit val F = ListWrapper.semigroup[Int] - checkAll("Try[ListWrapper[Int]]", GroupLaws[Try[ListWrapper[Int]]].semigroup) + checkAll("Try[ListWrapper[Int]]", SemigroupTypeclassTests[Try[ListWrapper[Int]]].semigroup) checkAll("Semigroup[Try[ListWrapper[Int]]", SerializableTests.serializable(Semigroup[Try[ListWrapper[Int]]])) } - checkAll("Try[Int]", GroupLaws[Try[Int]].monoid) + checkAll("Try[Int]", MonoidTypeclassTests[Try[Int]].monoid) checkAll("Monoid[Try[Int]]", SerializableTests.serializable(Monoid[Try[Int]])) test("show") { diff --git a/tests/src/test/scala/cats/tests/Tuple2KTests.scala b/tests/src/test/scala/cats/tests/Tuple2KTests.scala index fa041999fae..0edbfb59a87 100644 --- a/tests/src/test/scala/cats/tests/Tuple2KTests.scala +++ b/tests/src/test/scala/cats/tests/Tuple2KTests.scala @@ -6,7 +6,11 @@ import cats.functor.Contravariant import cats.laws.discipline._ import cats.laws.discipline.arbitrary._ import cats.laws.discipline.eq._ -import cats.kernel.laws.OrderLaws +import cats.kernel.laws.discipline.{ + OrderTests => OrderTypeclassTests, + PartialOrderTests => PartialOrderTypeclassTests, + EqTests => EqTypeclassTests +} class Tuple2KTests extends CatsSuite { implicit val iso = CartesianTests.Isomorphisms.invariant[Tuple2K[Option, List, ?]] @@ -77,9 +81,9 @@ class Tuple2KTests extends CatsSuite { implicit val O = ListWrapper.order[Int] implicit val P = ListWrapper.partialOrder[Int] - checkAll("Tuple2K[ListWrapper, ListWrapper, Int]", OrderLaws[Tuple2K[ListWrapper, ListWrapper, Int]].eqv) - checkAll("Tuple2K[ListWrapper, ListWrapper, Int]", OrderLaws[Tuple2K[ListWrapper, ListWrapper, Int]].order) - checkAll("Tuple2K[ListWrapper, ListWrapper, Int]", OrderLaws[Tuple2K[ListWrapper, ListWrapper, Int]].partialOrder) + checkAll("Tuple2K[ListWrapper, ListWrapper, Int]", EqTypeclassTests[Tuple2K[ListWrapper, ListWrapper, Int]].eqv) + checkAll("Tuple2K[ListWrapper, ListWrapper, Int]", OrderTypeclassTests[Tuple2K[ListWrapper, ListWrapper, Int]].order) + checkAll("Tuple2K[ListWrapper, ListWrapper, Int]", PartialOrderTypeclassTests[Tuple2K[ListWrapper, ListWrapper, Int]].partialOrder) } test("show") { diff --git a/tests/src/test/scala/cats/tests/ValidatedTests.scala b/tests/src/test/scala/cats/tests/ValidatedTests.scala index dc152a5340d..cc3306e6822 100644 --- a/tests/src/test/scala/cats/tests/ValidatedTests.scala +++ b/tests/src/test/scala/cats/tests/ValidatedTests.scala @@ -7,7 +7,13 @@ import cats.laws.discipline._ import org.scalacheck.Arbitrary._ import cats.laws.discipline.SemigroupKTests import cats.laws.discipline.arbitrary._ -import cats.kernel.laws.{GroupLaws, OrderLaws} +import cats.kernel.laws.discipline.{ + MonoidTests => MonoidTypeclassTests, + SemigroupTests => SemigroupTypeclassTests, + OrderTests => OrderTypeclassTests, + PartialOrderTests => PartialOrderTypeclassTests, + EqTests => EqTypeclassTests +} import scala.util.Try @@ -27,12 +33,12 @@ class ValidatedTests extends CatsSuite { checkAll("Validated[String, Int] with Option", TraverseTests[Validated[String,?]].traverse[Int, Int, Int, Int, Option, Option]) checkAll("Traverse[Validated[String, ?]]", SerializableTests.serializable(Traverse[Validated[String,?]])) - checkAll("Validated[String, Int]", OrderLaws[Validated[String, Int]].order) + checkAll("Validated[String, Int]", OrderTypeclassTests[Validated[String, Int]].order) checkAll("Order[Validated[String, Int]]", SerializableTests.serializable(Order[Validated[String, Int]])) - checkAll("Validated[String, Int]", GroupLaws[Validated[String, Int]].monoid) + checkAll("Validated[String, Int]", MonoidTypeclassTests[Validated[String, Int]].monoid) - checkAll("Validated[String, NonEmptyList[Int]]", GroupLaws[Validated[String, NonEmptyList[Int]]].semigroup) + checkAll("Validated[String, NonEmptyList[Int]]", SemigroupTypeclassTests[Validated[String, NonEmptyList[Int]]].semigroup) { implicit val L = ListWrapper.semigroup[String] @@ -43,14 +49,14 @@ class ValidatedTests extends CatsSuite { { implicit val S = ListWrapper.partialOrder[String] implicit val I = ListWrapper.partialOrder[Int] - checkAll("Validated[ListWrapper[String], ListWrapper[Int]]", OrderLaws[Validated[ListWrapper[String], ListWrapper[Int]]].partialOrder) + checkAll("Validated[ListWrapper[String], ListWrapper[Int]]", PartialOrderTypeclassTests[Validated[ListWrapper[String], ListWrapper[Int]]].partialOrder) checkAll("PartialOrder[Validated[ListWrapper[String], ListWrapper[Int]]]", SerializableTests.serializable(PartialOrder[Validated[ListWrapper[String], ListWrapper[Int]]])) } { implicit val S = ListWrapper.eqv[String] implicit val I = ListWrapper.eqv[Int] - checkAll("Validated[ListWrapper[String], ListWrapper[Int]]", OrderLaws[Validated[ListWrapper[String], ListWrapper[Int]]].eqv) + checkAll("Validated[ListWrapper[String], ListWrapper[Int]]", EqTypeclassTests[Validated[ListWrapper[String], ListWrapper[Int]]].eqv) checkAll("Eq[Validated[ListWrapper[String], ListWrapper[Int]]]", SerializableTests.serializable(Eq[Validated[ListWrapper[String], ListWrapper[Int]]])) } diff --git a/tests/src/test/scala/cats/tests/WriterTTests.scala b/tests/src/test/scala/cats/tests/WriterTTests.scala index 1e6f420c0bc..e9a5a05417a 100644 --- a/tests/src/test/scala/cats/tests/WriterTTests.scala +++ b/tests/src/test/scala/cats/tests/WriterTTests.scala @@ -7,7 +7,11 @@ import cats.laws.discipline._ import cats.laws.discipline.arbitrary._ import cats.laws.discipline.eq._ -import cats.kernel.laws.OrderLaws +import cats.kernel.laws.discipline.{ + MonoidTests => MonoidTypeclassTests, + SemigroupTests => SemigroupTypeclassTests, + EqTests => EqTypeclassTests +} class WriterTTests extends CatsSuite { type Logged[A] = Writer[ListWrapper[Int], A] @@ -18,7 +22,7 @@ class WriterTTests extends CatsSuite { implicit override val generatorDrivenConfig: PropertyCheckConfiguration = checkConfiguration.copy(sizeRange = 5) - checkAll("WriterT[List, Int, Int]", OrderLaws[WriterT[List, Int, Int]].eqv) + checkAll("WriterT[List, Int, Int]", EqTypeclassTests[WriterT[List, Int, Int]].eqv) checkAll("Eq[WriterT[List, Int, Int]]", SerializableTests.serializable(Eq[WriterT[List, Int, Int]])) checkAll("WriterT[Show, Int, Int]", ContravariantTests[WriterT[Show, Int, ?]].contravariant[Int, Int, Int]) @@ -290,11 +294,11 @@ class WriterTTests extends CatsSuite { implicit val FLV: Monoid[ListWrapper[(Int, Int)]] = ListWrapper.monoid[(Int, Int)] Monoid[WriterT[ListWrapper, Int, Int]] - checkAll("WriterT[ListWrapper, Int, Int]", kernel.laws.GroupLaws[WriterT[ListWrapper, Int, Int]].monoid) + checkAll("WriterT[ListWrapper, Int, Int]", MonoidTypeclassTests[WriterT[ListWrapper, Int, Int]].monoid) checkAll("Monoid[WriterT[ListWrapper, Int, Int]]", SerializableTests.serializable(Monoid[WriterT[ListWrapper, Int, Int]])) Monoid[Writer[Int, Int]] - checkAll("Writer[Int, Int]", kernel.laws.GroupLaws[Writer[Int, Int]].monoid) + checkAll("Writer[Int, Int]", MonoidTypeclassTests[Writer[Int, Int]].monoid) } { @@ -302,11 +306,11 @@ class WriterTTests extends CatsSuite { implicit val FLV: Semigroup[ListWrapper[(Int, Int)]] = ListWrapper.semigroup[(Int, Int)] Semigroup[WriterT[ListWrapper, Int, Int]] - checkAll("WriterT[ListWrapper, Int, Int]", kernel.laws.GroupLaws[WriterT[ListWrapper, Int, Int]].semigroup) + checkAll("WriterT[ListWrapper, Int, Int]", SemigroupTypeclassTests[WriterT[ListWrapper, Int, Int]].semigroup) checkAll("Semigroup[WriterT[ListWrapper, Int, Int]]", SerializableTests.serializable(Semigroup[WriterT[ListWrapper, Int, Int]])) Semigroup[Writer[Int, Int]] - checkAll("Writer[Int, Int]", kernel.laws.GroupLaws[Writer[Int, Int]].semigroup) + checkAll("Writer[Int, Int]", SemigroupTypeclassTests[Writer[Int, Int]].semigroup) } {