Commit 5a341c98 authored by Julien Lopez's avatar Julien Lopez

Example of OUnit usage with cdnum done.

Minor fix for Makefile verbose mode.
parent d10843ef
......@@ -20,7 +20,7 @@ PACKAGES = dynlink camlp4 ulex pcre num netstring
# Call make with VERBOSE=true to get a trace of commands
VERBOSE=false
VERBOSE?=false
ifneq ($(VERBOSE), true)
HIDE=@
......
......@@ -38,11 +38,16 @@ eval:
cdnum:
$(CAML) -c $@.mli
$(CDUCE) --compile $@.cd -I `ocamlfind query num`
ocamlfind $(CAML) -o $@ -pp "$(CDO2ML)" -impl $@.cdo -package cduce,num -linkpkg
$(CDUCE) --mlstub $@.cdo > $@.ml
ocamlfind ocamlc -package cduce,num,oUnit -linkpkg -o $@ $@.ml $@test.ml
./$@
# $(CAML) -c $@.mli
# $(CDUCE) --compile $@.cd -I `ocamlfind query num`
# ocamlfind $(CAML) -o $@ -pp "$(CDO2ML)" -impl $@.cdo -package cduce,num -linkpkg
# ./$@
clean:
rm -f *.cmo *.cmx *.o *.cdo *.cmi a.ml c.ml cdnum eval cdsdl cdmysql *~ a
rm -f *.cmo *.cmx *.o *.cdo *.cmi a.ml c.ml cdnum cdnum.ml eval cdsdl cdmysql a oUnit-anon.cache
check:
./check.sh
val fact: Big_int.big_int -> Big_int.big_int
open OUnit
open Big_int
let tests = "Cdnum" >:::
[
"fact" >:: ( fun () ->
assert_equal 2 (int_of_big_int (Cdnum.fact (big_int_of_int 2)));
assert_equal 1 (int_of_big_int (Cdnum.fact (big_int_of_int 0)));
assert_equal 120 (int_of_big_int (Cdnum.fact (big_int_of_int 5)));
);
]
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