Previous: , Up: Dico Module Interface   [Contents][Index]


6.4 Module Unit Testing

The dico_run_test member of struct dico_database_module (see dico_run_test) points to the function that serves as entry point for unit tests of that module. If it is NULL, the module does not support unit testing. Otherwise, unit tests can be run using the following command line syntax:

$ dicod --runtest module [test_args] [-- init_args]

As usual, square brackets denote optional parts. The module argument specifies the name of the module to test. The arguments that follow the --runtest (-r) option are collected into two arrays: arguments up to the ‘--’ marker form the vector that is passed to the module’s dico_run_test function. The ‘--’ marker is optional. If present, arguments that follow it are collected into a separate argument vector starting from slot 1, the slot 0 is set to point to the module name and the resulting vector is passed to the dico_init method of the module.

When running unit tests, configuration file is ignored. The diagnostic messages are printed to the standard error output.

Use the --load-dir (-L) command line option, if the module being tested cannot be found in the default load path (see load path), e.g.:

$ dicod -L ../lib --runtest metaphone2 build A B C