This repository has been archived by the owner on Jul 29, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6988a9b
commit 561a76b
Showing
2 changed files
with
5 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 4 additions & 3 deletions
7
re/shared/src/it/scala/pl/writeonly/re/shared/CalculatorIT.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
} | ||
} |