1 (* Tiny unit test framework - really just to help find which line is busted *)
2 let exit_status = ref 0
4 let suite_name = ref ""
6 let group_name = ref ""
10 let print_checkpoints = false
13 group_name := !suite_name ^
"/" ^ name
;
15 if print_checkpoints then prerr_endline
(" " ^ name ^
"...")
17 let insist ?
(exit_on_fail
= false) cond
=
19 if not cond
then exit_status := 10;
20 ( match (print_checkpoints, cond
) with
24 ( "FAILED: " ^
!suite_name ^
"/" ^
!group_name ^
" #"
25 ^ string_of_int
!case_num )
26 | true, true -> prerr_endline
(" " ^ string_of_int
!case_num)
27 | true, false -> prerr_endline
(" " ^ string_of_int
!case_num ^
" FAIL") );
28 if exit_on_fail
&& not cond
then exit
!exit_status else ()
32 if print_checkpoints then prerr_endline
(name ^
":");