Commit 1185652b authored by Julien Lopez's avatar Julien Lopez

More OUnit tests added

parent 44e3ba54
......@@ -10,11 +10,32 @@ let rot13 b = if (b >= 'a' && b <= 'z') then
* (if char_of_int res <= 'Z' then 0 else 1))
else b;;
let id x = x;;
let tests = "A" >:::
[
"f" >:: ( fun () ->
assert_equal "Hello!" (A.f id "Hello!");
assert_equal "Uryyb!" (A.f rot13 "Hello!")
);
"g" >:: ( fun () ->
A.x := 'b';
assert_equal 'b' !A.x;
A.g A.x;
assert_equal 'a' !A.x;
A.g A.x;
assert_equal 'a' !A.x;
);
"re" >:: ( fun () ->
assert_equal 0.2 (A.re { x=0.2; y=0.8 })
);
"diag" >:: ( fun () ->
let res : A.complex = { x=3.14; y=3.14 } in
assert_equal res (A.diag 3.14)
);
]
let _ = run_test_tt ~verbose:true tests
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment