Skip to content

Commit 6d4a446

Browse files
armanbilgepikinier20
authored andcommitted
Start migrating tests
1 parent 4df5ad0 commit 6d4a446

File tree

11 files changed

+33
-55
lines changed

11 files changed

+33
-55
lines changed

algebra-laws/shared/src/main/scala/algebra/laws/BaseLaws.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@ import org.typelevel.discipline.Laws
66

77
import org.scalacheck.{Arbitrary, Prop}
88

9+
@deprecated("No replacement", since = "2.7.0")
910
object BaseLaws {
1011
def apply[A: Eq: Arbitrary]: BaseLaws[A] = new BaseLaws[A] {
1112
def Equ = Eq[A]
1213
def Arb = implicitly[Arbitrary[A]]
1314
}
1415
}
1516

17+
@deprecated("No replacement", since = "2.7.0")
1618
trait BaseLaws[A] extends Laws {
1719

1820
implicit def Equ: Eq[A]

algebra-laws/shared/src/main/scala/algebra/laws/CheckSupport.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ package algebra.laws
88
* (Since algebra-instances has no dependencies, its types can't
99
* define Arbitrary instances in companions.)
1010
*/
11+
@deprecated("No replacement", since = "2.7.0")
1112
object CheckSupport {}

algebra-laws/shared/src/main/scala/algebra/laws/DeMorganLaws.scala

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,16 @@ import org.scalacheck.{Arbitrary, Prop}
66
import org.scalacheck.Prop._
77
import org.typelevel.discipline.Laws
88

9+
@deprecated("Laws moved to LogicLaws", since = "2.7.0")
910
object DeMorganLaws {
1011
def apply[A: Eq: Arbitrary: LatticeLaws] = new DeMorganLaws[A] {
1112
def Equ = Eq[A]
1213
def Arb = implicitly[Arbitrary[A]]
1314
def LL = implicitly[LatticeLaws[A]]
1415
}
1516
}
16-
/* TODO:
17-
* This is separated for LogicLaws for binary compatibility reasons.
18-
* Merge with LogicLaws when possible.
19-
*/
17+
18+
@deprecated("Laws moved to LogicLaws", since = "2.7.0")
2019
trait DeMorganLaws[A] extends Laws {
2120

2221
implicit def Equ: Eq[A]

algebra-laws/shared/src/main/scala/algebra/laws/GroupLaws.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@ import org.typelevel.discipline.Laws
88
import org.scalacheck.{Arbitrary, Prop}
99
import org.scalacheck.Prop._
1010

11+
@deprecated("Provided by cats.kernel.laws", since = "2.7.0")
1112
object GroupLaws {
1213
def apply[A: Eq: Arbitrary]: GroupLaws[A] = new GroupLaws[A] {
1314
def Equ = Eq[A]
1415
def Arb = implicitly[Arbitrary[A]]
1516
}
1617
}
1718

19+
@deprecated("Provided by cats.kernel.laws", since = "2.7.0")
1820
trait GroupLaws[A] extends Laws {
1921

2022
implicit def Equ: Eq[A]

algebra-laws/shared/src/main/scala/algebra/laws/IsSerializable.scala

Lines changed: 0 additions & 41 deletions
This file was deleted.

algebra-laws/shared/src/main/scala/algebra/laws/LatticeLaws.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import algebra.lattice._
55

66
import org.scalacheck.{Arbitrary, Prop}
77
import org.scalacheck.Prop._
8+
import scala.annotation.nowarn
89

910
object LatticeLaws {
1011
def apply[A: Eq: Arbitrary] = new LatticeLaws[A] {
@@ -13,6 +14,7 @@ object LatticeLaws {
1314
}
1415
}
1516

17+
@nowarn("msg=deprecated")
1618
trait LatticeLaws[A] extends GroupLaws[A] {
1719

1820
implicit def Equ: Eq[A]

algebra-laws/shared/src/main/scala/algebra/laws/LogicLaws.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import algebra.lattice.{Bool, GenBool, Heyting}
55

66
import org.scalacheck.{Arbitrary, Prop}
77
import org.scalacheck.Prop._
8+
import scala.annotation.nowarn
89

910
object LogicLaws {
1011
def apply[A: Eq: Arbitrary] = new LogicLaws[A] {
@@ -13,7 +14,10 @@ object LogicLaws {
1314
}
1415
}
1516

16-
trait LogicLaws[A] extends LatticeLaws[A] {
17+
@nowarn("msg=deprecated")
18+
trait LogicLaws[A] extends LatticeLaws[A] with DeMorganLaws[A] {
19+
20+
final def LL: LatticeLaws[A] = this
1721

1822
def heyting(implicit A: Heyting[A]) = new LogicProperties(
1923
name = "heyting",

algebra-laws/shared/src/main/scala/algebra/laws/OrderLaws.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import org.scalacheck.Prop._
99

1010
import cats.kernel.instances.all._
1111

12+
@deprecated("Provided by cats.kernel.laws", since = "2.7.0")
1213
object OrderLaws {
1314
def apply[A: Eq: Arbitrary: Cogen]: OrderLaws[A] =
1415
new OrderLaws[A] {
@@ -18,6 +19,7 @@ object OrderLaws {
1819
}
1920
}
2021

22+
@deprecated("Provided by cats.kernel.laws", since = "2.7.0")
2123
trait OrderLaws[A] extends Laws {
2224

2325
implicit def Equ: Eq[A]

algebra-laws/shared/src/main/scala/algebra/laws/RingLaws.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import org.typelevel.discipline.Predicate
1010
import org.scalacheck.{Arbitrary, Prop}
1111
import org.scalacheck.Arbitrary._
1212
import org.scalacheck.Prop._
13+
import scala.annotation.nowarn
1314

1415
object RingLaws {
1516
def apply[A: Eq: Arbitrary: AdditiveMonoid]: RingLaws[A] =
@@ -20,13 +21,15 @@ object RingLaws {
2021
def withPred[A](pred0: Predicate[A])(implicit eqv: Eq[A], arb: Arbitrary[A]): RingLaws[A] = new RingLaws[A] {
2122
def Arb = arb
2223
def pred = pred0
24+
@nowarn("msg=deprecated")
2325
val nonZeroLaws = new GroupLaws[A] {
2426
def Arb = Arbitrary(arbitrary[A](arb).filter(pred))
2527
def Equ = eqv
2628
}
2729
}
2830
}
2931

32+
@nowarn("msg=deprecated")
3033
trait RingLaws[A] extends GroupLaws[A] { self =>
3134

3235
// must be a val (stable identifier)

algebra-laws/shared/src/main/scala/algebra/laws/Rules.scala

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import cats.kernel._
44
import org.scalacheck.Prop._
55
import org.scalacheck.{Arbitrary, Prop}
66
import cats.kernel.instances.boolean._
7+
import cats.kernel.laws.discipline.SerializableTests
78

89
object Rules {
910

@@ -92,12 +93,7 @@ object Rules {
9293
(m(a(x, y), z) ?== a(m(x, z), m(y, z)))
9394
}
9495

95-
// ugly platform-specific code follows
96-
96+
@deprecated("Provided by cats.kernel.laws", since = "2.7.0")
9797
def serializable[M](m: M): (String, Prop) =
98-
"serializable" -> (if (IsSerializable()) {
99-
Prop(_ => Result(status = Proof))
100-
} else {
101-
Prop(_ => IsSerializable.testSerialization(m))
102-
})
98+
SerializableTests.serializable[M](m).props.head
10399
}

0 commit comments

Comments
 (0)