Commit 44e3ba54 authored by Julien Lopez's avatar Julien Lopez

OUnit tests added

parent 5a341c98
......@@ -3,7 +3,7 @@ CDUCE=../../cduce
CDO2ML=$(CDUCE) --mlstub
run:
ocamlc -c a.mli
$(CAML) -c a.mli
$(CDUCE) --compile c.cd
$(CDUCE) --compile a.cd
$(CDO2ML) c.cdo > c.ml
......@@ -14,10 +14,20 @@ ifeq ($(STATIC),-static)
endif
./a
.PHONY: a
a:
$(CAML) -c a.mli
$(CDUCE) --compile c.cd
$(CDUCE) --compile a.cd
$(CDO2ML) c.cdo > c.ml
$(CDO2ML) a.cdo > a.ml
ocamlfind ocamlc -g -package cduce,oUnit -linkpkg -o $@ c.ml $@.ml $@test.ml
./$@
.PHONY: cdsdl
cdsdl:
$(CDUCE) --compile cdsdl.cd -I `ocamlfind query ocamlsdl`
ocamlfind ocamlc -o cdsdl -pp "$(CDO2ML)" -impl cdsdl.cdo -package cduce,ocamlsdl -linkpkg
$(CDUCE) --compile cdsdl.cd -I `ocamlfind query sdl`
ocamlfind ocamlc -o cdsdl -pp "$(CDO2ML)" -impl cdsdl.cdo -package cduce,sdl -linkpkg
./cdsdl
.PHONY: cdmysql
......@@ -38,7 +48,7 @@ eval:
cdnum:
$(CAML) -c $@.mli
$(CDUCE) --compile $@.cd -I `ocamlfind query num`
$(CDUCE) --mlstub $@.cdo > $@.ml
$(CDO2ML) $@.cdo > $@.ml
ocamlfind ocamlc -package cduce,num,oUnit -linkpkg -o $@ $@.ml $@test.ml
./$@
# $(CAML) -c $@.mli
......
open OUnit
let rot13 b = if (b >= 'a' && b <= 'z') then
let res = int_of_char b+13 in
char_of_int (res - (int_of_char 'z' - int_of_char 'a' + 1)
* (if char_of_int res <= 'z' then 0 else 1))
else if (b >= 'A' && b <= 'Z') then
let res = int_of_char b+13 in
char_of_int (res - (int_of_char 'Z' - int_of_char 'A' + 1)
* (if char_of_int res <= 'Z' then 0 else 1))
else b;;
let tests = "A" >:::
[
"f" >:: ( fun () ->
assert_equal "Uryyb!" (A.f rot13 "Hello!")
);
]
let _ = run_test_tt ~verbose:true tests
......@@ -2,9 +2,8 @@ let sdl_version = string_of (Sdl.version [])
let [] =
print [ 'Sdl version' !sdl_version '\n' ];
Sdl.init `None [ `EVERYTHING ];
Sdl.init [ `true ] [ `EVERYTHING ];
let n = string_of (Sdlcdrom.get_num_drives []) in
print [ 'Drives:' !n '\n' ];
let cd = Sdlcdrom.cd_open 0 in
Sdlcdrom.cd_eject cd
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