In certain condition test can be written but there is no point running it, because they are not significant (missing OS features for example). In this case this is not a failure nor a success. Following functions allow you to escape test, just as assertion but without the same error status.
A test skipped is counted as success. A test todo is counted as failure.
val skip_if : bool ->string -> unit
skip cond msg If cond is true, skip the test for the reason explain in msg. For example skip_if (Sys.os_type = "Win32") "Test a doesn't run on
windows".
val todo : string -> unit
The associated test is still to be done, for the reason given.
Compare Functions
val cmp_float : ?epsilon:float ->float ->float -> bool
Compare floats up to a given relative error.
In keeping with standard floating point semantics, NaN is not equal to anything: cmp_float nan nan = false.
parameterepsilon
if the difference is smaller epsilon values are equal
Bracket
A bracket is a registered object with setUp and tearDown in unit tests. Data generated during the setUp will be automatically tearDown when the test ends.
with_bracket_chdir test_ctxt dn f change directory to dn during execution of function f. In order to Sys.chdir, we need to take a lock to avoid other tests trying to do change the current directory at the same time. So this bracket is not directly accessible in order to use it only on shorter piece of code.
non_fatal ctxt f Run f but if an exception is raised or an assert fails, don't stop, just register the result. The global test running result will mix in the non fatal result to determine the success or failure of the test.