diff --git a/Makefile b/Makefile index 69ea0b4..8b51c6e 100644 --- a/Makefile +++ b/Makefile @@ -40,8 +40,8 @@ configure: # OASIS_STOP -tests: - ocamlbuild -use-ocamlfind -pkg oUnit tests/run_tests.native +run-tests: + ./run_tests.native examples: ocamlbuild examples/test_sexpr.native diff --git a/_oasis b/_oasis index 9163e3b..4cfb6a9 100644 --- a/_oasis +++ b/_oasis @@ -9,7 +9,7 @@ Plugins: META (0.3), DevFiles (0.3) BuildTools: ocamlbuild Synopsis: Simple sequence (iterator) datatype and combinators -Description: +Description: Simple sequence datatype, intended to transfer a finite number of elements from one data structure to another. Some transformations on sequences, like `filter`, `map`, `take`, `drop` and `append` can be performed before the @@ -25,7 +25,7 @@ Flag invert Library "sequence" Path: . - Modules: Sequence + Modules: Sequence Library "invert" Path: invert @@ -46,7 +46,16 @@ Document sequence Test all Type: custom - Command: make tests + Command: make run-tests + Run$: flag(tests) + +Executable run_tests + Path: tests/ + Install: false + CompiledObject: native + MainIs: run_tests.ml + Build$: flag(tests) + BuildDepends: sequence,oUnit Executable benchs Path: bench diff --git a/tests/test_sequence.ml b/tests/test_sequence.ml index 8788249..bfd7dac 100644 --- a/tests/test_sequence.ml +++ b/tests/test_sequence.ml @@ -130,9 +130,10 @@ let test_uniq () = let test_product () = let stream = Stream.from (fun i -> if i < 3 then Some i else None) in - let inner = S.of_stream stream in - let outer = S.of_list ["a";"b";"c"] in - let s = S.product outer inner |> S.to_list in + let a = S.of_stream stream in + let b = S.of_list ["a";"b";"c"] in + let s = S.product a b |> S.map (fun (x,y) -> y,x) + |> S.to_list |> List.sort compare in OUnit.assert_equal ["a",0; "a", 1; "a", 2; "b",0; "b", 1; "b", 2; "c",0; "c", 1; "c", 2;] s