module OUnit:The OUnit library can be used to implement unittestssig..end
To uses this library link with
ocamlc oUnit.cmo
or
ocamlopt oUnit.cmx
Author(s): Maas-Maarten Zeeman
Assertions are the basic building blocks of unittests.
val assert_failure : string -> 'aFailure to signal a failureval assert_bool : string -> bool -> unitFailure to signal a failureval (@?) : string -> bool -> unitFailure to signal a failureval assert_string : string -> unitFailure to signal a failureval assert_equal : ?cmp:('a -> 'a -> bool) ->
?printer:('a -> string) -> ?msg:string -> 'a -> 'a -> unitFailure descriptionval assert_raises : ?msg:string -> exn -> (unit -> 'a) -> unitFailure descriptionval cmp_float : ?epsilon:float -> float -> float -> boolA bracket is a functional implementation of the commonly used setUp and tearDown feature in unittests. It can be used like this:
"MyTestCase" >:: (bracket test_set_up test_fun test_tear_down)
val bracket : (unit -> 'a) -> ('a -> 'b) -> ('a -> 'c) -> unit -> 'ctype test =
| |
TestCase of |
| |
TestList of |
| |
TestLabel of |
val (>:) : string -> test -> testval (>::) : string -> (unit -> unit) -> testval (>:::) : string -> test list -> testExamples:
"test1" >: TestCase((fun _ -> ())) =>
TestLabel("test2", TestCase((fun _ -> ())))"test2" >:: (fun _ -> ()) =>
TestLabel("test2", TestCase((fun _ -> ())))"test-suite" >::: ["test2" >:: (fun _ -> ());] =>
TestLabel("test-suite", TestSuite([TestLabel("test2", TestCase((fun _ -> ())))]))val test_case_count : test -> inttype node =
| |
ListItem of |
| |
Label of |
typepath =node list
val string_of_node : node -> stringval string_of_path : path -> stringval test_case_paths : test -> path listtype test_result =
| |
RSuccess of |
| |
RFailure of |
| |
RError of |
type test_event =
| |
EStart of |
| |
EEnd of |
| |
EResult of |
val perform_test : (test_event -> 'a) -> test -> test_result listval run_test_tt : ?verbose:bool -> test -> test_result listval run_test_tt_main : test -> test_result list