PageRenderTime 12ms CodeModel.GetById 1ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 1ms

/trunk/Examples/test-suite/ocaml/newobject1_runme.ml

#
OCaml | 26 lines | 21 code | 5 blank | 0 comment | 6 complexity | 73c4b6fd41130c43d6df5b116bdaa344 MD5 | raw file
 1open Swig
 2open Newobject1
 3
 4exception RuntimeError of string * int
 5
 6let foo1 = ref (_Foo_makeFoo C_void)
 7let _ = if get_int (_Foo_fooCount C_void) != 1 then
 8   raise (RuntimeError ("(1) Foo.fooCount != 1",
 9			get_int (_Foo_fooCount C_void)))
10
11let foo2 = ref ((invoke !foo1) "makeMore" C_void) 
12let _ = if get_int (_Foo_fooCount C_void) != 2 then
13   raise (RuntimeError ("(2) Foo.fooCount != 2",
14			get_int (_Foo_fooCount C_void)))
15
16let _ = begin
17  foo1 := C_void ; Gc.full_major () ;
18  (if get_int (_Foo_fooCount C_void) != 1 then
19	raise (RuntimeError ("(3) Foo.fooCount != 1",
20			     get_int (_Foo_fooCount C_void)))) ;
21
22  foo2 := C_void ; Gc.full_major () ;
23  (if get_int (_Foo_fooCount C_void) != 0 then
24	raise (RuntimeError ("(4) Foo.fooCount != 0",
25			     get_int (_Foo_fooCount C_void)))) ;
26end