Last active
August 27, 2019 06:06
-
-
Save Maragues/a713727b538327e893a330c9427b6523 to your computer and use it in GitHub Desktop.
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
class PropertyTestSum : StringSpec({ | |
"Sum is commutative " { | |
assertAll { a: Int, b: Int -> | |
sum(a, b) shouldBe sum(b, a) | |
} | |
} | |
"Sum is associative " { | |
assertAll { a: Int, b: Int, c: Int -> | |
sum(a, b, c) shouldBe sum(a, c, b) | |
sum(a, b, c) shouldBe sum(c, b, a) | |
sum(a, b, c) shouldBe sum(b, c, a) | |
} | |
} | |
"The sum of any number and zero is the original number" { | |
assertAll { a: Int -> | |
sum(a, 0) shouldBe a | |
} | |
} | |
"Sum is distributive " { | |
assertAll { a: Int, b: Int, c: Int -> | |
sum(a, b) * c shouldBe sum(a * c, b * c) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment