Skip to content

Instantly share code, notes, and snippets.

@erip
Created December 23, 2018 16:08
Show Gist options
  • Save erip/0076be380ffb143f569d2f6764f4c20a to your computer and use it in GitHub Desktop.
Save erip/0076be380ffb143f569d2f6764f4c20a to your computer and use it in GitHub Desktop.
A simple property test
use "ponytest"
use "ponycheck"
class iso AdditionAssociativeProperty is UnitTest
fun name(): String => "u8/addition-associative"
fun apply(h: TestHelper)? =>
let g = recover val Generators.zip3[U8, U8, U8](
Generators.u8(), Generators.u8(), Generators.u8()
) end
Ponycheck.for_all[(U8, U8, U8)](g, h)(
{(args, ph) =>
(var arg0, var arg1, var arg2) = args
ph.assert_eq[U8](
(arg0 + arg1) + arg2,
arg0 + (arg1 + arg2)
)
})?
actor Main is TestList
new create(env: Env) =>
PonyTest(env, this)
fun tag tests(test: PonyTest) =>
test(AdditionAssociativeProperty)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment