OUnit

stringとかfloatとかintとかboolに対しては、printerがすでに用意されているOUnit.assert_equal。

let assert_eq msg expected actual = 
  let printer x = 
    let tag = Obj.tag (Obj.repr x) in
      if tag = Obj.int_tag then string_of_int (Obj.magic x)
      else if tag = Obj.double_tag then string_of_float (Obj.magic x)
      else if tag = Obj.string_tag then (Obj.magic x)
      else "--"
  in
    OUnit.assert_equal ~msg:msg ~printer:printer expected actual

OUnit使ってる人はどのくらいいるんでしょう。

boolはtrueとfalseの代わりに1と0が出てきます。