Skip to content

Instantly share code, notes, and snippets.

@bleis-tift
Created April 28, 2012 05:02
Show Gist options
  • Save bleis-tift/2516188 to your computer and use it in GitHub Desktop.
Save bleis-tift/2516188 to your computer and use it in GitHub Desktop.
SML#用の小さいテスティングフレームワーク
datatype 'a result =
Pass
| Failure of { Actual: 'a, Expected: 'a }
;
fun test [] = []
| test (x::xs) =
let
val actual = (#Target x)()
val expected = #Expected x
fun test' x =
if actual = expected then { Name = #Name x, Result = Pass }
else { Name = #Name x, Result = Failure { Actual = actual, Expected = expected } }
in
test' x :: (test xs)
end
;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment