1Tests 2============= 3 4Unit tests 5-------------- 6 7There is a comprehensive test suite employing CMocka_. You can run all of them using ``ctest`` in the build directory. Individual tests are themselves runnable. Please refer to `CTest <http://www.cmake.org/Wiki/CMake/Testing_With_CTest>`_ documentation for detailed information on how to specify particular subset of tests. 8 9.. _CMocka: http://cmocka.org/ 10 11Testing for memory leaks 12------------------------ 13 14Every release is tested for memory correctness. You can run these tests by passing the ``-T memcheck`` flag to ``ctest``. [#]_ 15 16.. [#] Project should be configured with ``-DCMAKE_BUILD_TYPE=Debug`` to obtain meaningful description of location of the leak. You might also need ``--dsymutil=yes`` on OS X. 17 18 19Code coverage 20------------------- 21 22Every release is inspected using `GCOV/LCOV <http://ltp.sourceforge.net/coverage/lcov.php>`_. Platform-independent code should be fully covered by the test suite. Simply run 23 24.. code-block:: bash 25 26 make coverage 27 28 29or alternatively run ``lcov`` by hand using 30 31.. code-block:: bash 32 33 lcov --capture --directory . --output-file coverage.info 34 genhtml coverage.info --output-directory out 35 36Fuzz testing 37----------------- 38 39Every release is tested using a fuzz test. In this test, a huge buffer filled with random data is passed to the decoder. We require that it either succeeds or fail with a sensible error, without leaking any memory. This is intended to simulate real-world situations where data received from the network are CBOR-decoded before any further processing. 40