6. Unit Tests

There are unit test for libmatchbox in libmatchbox/tests/. These are written using the Check unit testing framework (http://check.sf.net/), and currently test the .desktop file parser and the pixmap library.

To execute the tests, simply run make check in libmatchbox.

$ make check
...
Running suite(s): DotDesktop
100%: Checks: 5, Failures: 0, Errors: 0
PASS: dot-desktop
Running suite(s): MbPixbuf
100%: Checks: 13, Failures: 0, Errors: 0
PASS: pixbuf
==================
All 2 tests passed
==================

As can be seen, two test suites were executed (DotDesktop and MbPixbuf), and these both passed.

[Note]Note

At the time of writing there is a bug in MbPixbuf which results in a single test failing with the message “Composite image incorrect”. Also, unless you have support for the fr_FR locale, the DotDesktop test dotdesktop_l10n_present will fail.

The tests can also be run with gcov coverage reports. If libmatchbox is built with --enable-gcov, then executing tests/gcov.sh will run all of the unit tests and then display coverage information.

To extend the test suite, create a new C program which uses the Check library and provides a main entry point, then add it to check_PROGRAMS in libmatchbox/tests/Makefile.am. Once the Makefile has been remade, running make check will execute the new tests.