mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 11:15:31 -05:00
start testing of Enum
This commit is contained in:
parent
81e30d76bf
commit
a3182f131b
2 changed files with 26 additions and 0 deletions
|
|
@ -6,6 +6,7 @@ let suite =
|
|||
"all_tests" >:::
|
||||
[ Test_pHashtbl.suite;
|
||||
Test_vector.suite;
|
||||
Test_enum.suite;
|
||||
Test_deque.suite;
|
||||
Test_fHashtbl.suite;
|
||||
Test_fQueue.suite;
|
||||
|
|
|
|||
25
tests/test_enum.ml
Normal file
25
tests/test_enum.ml
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
|
||||
open OUnit
|
||||
open Enum.Infix
|
||||
|
||||
let pint i = string_of_int i
|
||||
|
||||
let test_singleton () =
|
||||
let e = Enum.singleton 42 in
|
||||
let gen = Enum.start e in
|
||||
OUnit.assert_equal 42 (Enum.next gen);
|
||||
OUnit.assert_raises Enum.EOG (fun () -> Enum.next gen);
|
||||
OUnit.assert_equal 1 (Enum.length e);
|
||||
()
|
||||
|
||||
let test_iter () =
|
||||
let e = 1 -- 10 in
|
||||
OUnit.assert_equal ~printer:pint 10 (Enum.length e);
|
||||
(* TODO *)
|
||||
()
|
||||
|
||||
let suite =
|
||||
"test_enum" >:::
|
||||
[ "test_singleton" >:: test_singleton;
|
||||
"test_iter" >:: test_iter;
|
||||
]
|
||||
Loading…
Add table
Reference in a new issue