Last active
December 24, 2018 00:30
-
-
Save erip/c4810f781606263e0c733cc8e35230fa 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
use "ponytest" | |
use "ponycheck" | |
use ".." | |
interface val _TestSemigroupAssociativity[T] is UnitTest | |
fun semigroup(): Semigroup[T] | |
fun t(): String | |
fun name(): String => "laws/associative/" + t() | |
fun gen(): Generator[(T, T, T)] val | |
fun is_associative(h: TestHelper)? => | |
let sg = semigroup() | |
Ponycheck.for_all[(T, T, T)](gen(), h)( | |
{(args, ph) => | |
(let x, let y, let z) = args | |
// can't find definition of 'T' | |
ph.assert_eq[T]( | |
sg.combine(sg.combine(x, y), z), | |
sg.combine(x, sg.combine(y, z)) | |
) | |
})? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment