mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 19:25:28 -05:00
unit testing with oUnit
This commit is contained in:
parent
30b69a95a3
commit
3fe75af98e
4 changed files with 34 additions and 4 deletions
10
Makefile
10
Makefile
|
|
@ -3,14 +3,16 @@ INTERFACE_FILES = $(shell find -name '*.mli')
|
||||||
IMPLEMENTATION_FILES = $(shell find -name '*.ml')
|
IMPLEMENTATION_FILES = $(shell find -name '*.ml')
|
||||||
|
|
||||||
TARGETS_LIB = containers.cmxa containers.cma
|
TARGETS_LIB = containers.cmxa containers.cma
|
||||||
OPTIONS = -use-ocamlfind -lib sequence
|
OPTIONS = -use-ocamlfind -package sequence
|
||||||
|
|
||||||
all:
|
all:
|
||||||
ocamlbuild -use-ocamlfind $(TARGETS_LIB)
|
ocamlbuild $(OPTIONS) $(TARGETS_LIB)
|
||||||
|
|
||||||
|
tests:
|
||||||
|
ocamlbuild $(OPTIONS) -package oUnit -I . tests/tests.native
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
ocamlbuild -clean
|
ocamlbuild -clean
|
||||||
|
|
||||||
.PHONY: all clean
|
.PHONY: all clean tests
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,11 @@ Then:
|
||||||
|
|
||||||
$ make
|
$ make
|
||||||
|
|
||||||
|
To build and run tests (requires `oUnit`):
|
||||||
|
|
||||||
|
$ make tests
|
||||||
|
$ ./tests.native
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
This code is free, under the BSD license. The module `leftistheap` is due
|
This code is free, under the BSD license. The module `leftistheap` is due
|
||||||
|
|
|
||||||
12
tests/test_pHashtbl.ml
Normal file
12
tests/test_pHashtbl.ml
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
|
||||||
|
open OUnit
|
||||||
|
|
||||||
|
let test_add () =
|
||||||
|
let h = PHashtbl.create 5 in
|
||||||
|
PHashtbl.replace h 42 "foo";
|
||||||
|
OUnit.assert_equal (PHashtbl.find h 42) "foo"
|
||||||
|
|
||||||
|
let suite =
|
||||||
|
"test_pHashtbl" >:::
|
||||||
|
[ "test_add" >:: test_add;
|
||||||
|
]
|
||||||
11
tests/tests.ml
Normal file
11
tests/tests.ml
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
open OUnit
|
||||||
|
|
||||||
|
(* TODO more tests *)
|
||||||
|
|
||||||
|
let suite =
|
||||||
|
"all_tests" >:::
|
||||||
|
[ Test_pHashtbl.suite;
|
||||||
|
]
|
||||||
|
|
||||||
|
let _ =
|
||||||
|
run_test_tt_main suite
|
||||||
Loading…
Add table
Reference in a new issue