Skip to content
This repository has been archived by the owner on Jul 29, 2021. It is now read-only.

Commit

Permalink
No Universal Equality
Browse files Browse the repository at this point in the history
  • Loading branch information
kamil-adam committed Jan 25, 2019
1 parent 6988a9b commit 561a76b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions build.sbt
Expand Up @@ -33,6 +33,7 @@ val SharedSettings = Seq(
libraryDependencies ++= Seq(
"com.github.scalaprops" %%% "scalaprops" % ScalaPropsVersion % "test,it",
"com.github.scalaprops" %%% "scalaprops-scalazlaws" % ScalaPropsVersion % "test,it",
"org.scalaz" %%% "scalaz-core" % "7.2.27",
),
libraryDependencies ++= Seq(
"biz.enef" %%% "slogging" % SloggingVersion,
Expand Down
@@ -1,22 +1,23 @@
package pl.writeonly.re.shared

import scalaprops.{Property, Scalaprops}
import scalaz.Scalaz._

object CalculatorIT extends Scalaprops {
val calculator = new Calculator()

val addition: (Int, Int) => Int = (x, y) => calculator.add(x, y)
val additionTest = Property.forAll { (a: Int, b: Int) =>
addition(a, b) == a + b
addition(a, b) === a + b
}

val multiplication: (Int, Int) => Int = (x, y) => calculator.mul(x, y)
val multiplicationTest = Property.forAll { (a: Int, b: Int) =>
multiplication(a, b) == a * b
multiplication(a, b) === a * b
}

val lessOrEqual: (Int, Int) => Boolean = (x, y) => calculator.leq(x, y)
val lessOrEqualTest = Property.forAll { (a: Int, b: Int) =>
lessOrEqual(a, b) == (a <= b)
lessOrEqual(a, b) === (a <= b)
}
}

0 comments on commit 561a76b

Please sign in to comment.