Checkout both extlib-dev
and
extlib-test
modules from CVS. Currently the
directory layout is fixed, so you need the following organization
in order to get the tester to compile:
$root/extlib-dev (ExtLib source code) $root/extlib-test (Testing suite source code)
Go to extlib-test
directory and run
make
. This will make the tester. You can execute
the test by running make run
.
If you want to build native code version of the tester, run
make opt
. You can run it with make
run
.
Since you don't always want to build ExtLib when you're
building the test suite, you can build just the tester and link
against prebuilt ExtLib. You can do this by using
test.mak
instead of Makefile
. E.g.,
to build the tester, run make -f test.mak
. This
assumes that ExtLib has already been built.
Make plays a very small role in all of this. The test
executable is actually buit by a small program called
mktest
.
Tests need to be named according to a specific syntax. Files
that match this syntax are scanned from the
extlib-test
directory and automatically included
into the test.
Test_<xy>_<module_name>_<test_name>.ml
.
where <xy> is author's initials (e.g., jh);
<module_name> is the module that is tested (e.g., ExtString); and
<test> is the name for the test (e.g., 001).
assert
. Existing tests serve as good example
code.Util.run_test
function. Example: let test
() = Util.run_test ~test_name:"jh_BitSet.create"
test_create
. The entrypoint must be named
test
and its type must be unit->unit.
extlib-test
directory.make -f test.mak && make -f test.mak run
The test suite is compiled using a program called
mktest
. It scans the test directory for tests and
builds them. Author and module masks can be given on the command
line to control which tests are built into the test
executable. Try running ./mktest --help
for more
info.