PageRenderTime 40ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/tags/rel-1.3.35/Examples/test-suite/ocaml/typename_runme.ml

#
OCaml | 12 lines | 8 code | 3 blank | 1 comment | 0 complexity | cff61cf98804ea72ca5916ec3816746a MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. (* Fun with type names -- stolen from the ruby runme *)
  2. open Swig
  3. open Typename
  4. let f = new_Foo C_void
  5. let b = new_Bar C_void
  6. let x = _twoFoo f
  7. let _ = match x with C_double f -> () | _ -> raise (Failure "not a float")
  8. let y = _twoBar b
  9. let _ = match y with C_int i -> () | _ -> raise (Failure "not an int")