[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Andrew Gacek <andrew.gacek@g...> |
| Subject: | Re: [Caml-list] Building and Tests |
One thing I find helpful is to define tests anonymously inside of a
single test group. So inside of say list_test.ml I have
let tests =
"List" >::: [
"Empty list should have size zero" >::
(fun () ->
assert_equal 0 (List.length [])) ;
"Singleton list should have size one" >::
(fun () ->
assert_equal 1 (List.length [0])) ;
...
]
Then I have a single file for the project called test.ml which
includes all the module tests explicitly and runs them. For example,
let tests = "Project Tests" >:::
[
List_test.tests ;
Array_test.tests ;
String_test.tests ;
...
]
let _ = run_test_tt_main tests
Finally in my OMakefile I have
TEST_FILES[] =
$(rootname $(find . -name *_test.ml))
test
.PHONY: test
test: $(OCamlProgram unit_test, $(OUNIT) $(FILES) $(TEST_FILES))
./unit_test -verbose
The end result of all of this is that when I add a new test to an
existing module, I don't have to explicitly include it to be run. The
only thing I have to do explicitly is list my module tests in the
master test.ml file, and this list rarely changes.
-Andrew
On 8/18/07, Robert Fischer <robert@fischerventure.com> wrote:
> Is there any kind of automation that other people have built for OUnit?
> I'm wondering if anyone has pulled together OMake or shell scripts to
> execute all the tests in multiple different files, or a test-then-build
> structure?
>
> ~~ Robert.
>
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>