Created
December 9, 2013 22:10
-
-
Save klaeufer/7881910 to your computer and use it in GitHub Desktop.
minimal ScalaCheck example
This file contains hidden or 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
| import org.scalacheck.Properties | |
| import org.scalacheck.Prop.forAll | |
| object IntAbelianGroup extends Properties("Int") { | |
| property("Associativity") = forAll { (a: Int, b: Int, c: Int) => | |
| (a + b) + c == a + (b + c) | |
| } | |
| } | |
| // Closure | |
| // For all a, b in A, the result of the operation a • b is also in A. | |
| // Associativity | |
| // For all a, b and c in A, the equation (a • b) • c = a • (b • c) holds. | |
| // Identity element | |
| // There exists an element e in A, such that for all elements a in A, the equation e • a = a • e = a holds. | |
| // Inverse element | |
| // For each a in A, there exists an element b in A such that a • b = b • a = e, where e is the identity element. | |
| // Commutativity | |
| // For all a, b in A, a • b = b • a. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment