libunittest C++ library Get the latest

libunittest is a portable C++ library for unit testing. By relying on the C++11 standard and heavy use of templates, a portable, feature-rich, and easy-to-use library has been developed. A minimal example: #include <libunittest/all.hpp>

const bool value = true;

Features include:

  • unit testing framework for C++
  • great for test-driven-development (TDD) in C++
  • follows the xUnit test patterns plus extensions
  • formatted XML output of the test results (JUnit-compatible)
  • comes with rich assertions and is easily extendable
  • assertions capture call signature and assert location
  • support for deadly (default) and non-deadly assertions
  • tests can be run in parallel
  • supports templated tests
  • option to run specific tests without recompiling
  • option to turn off exception handling for debugging purposes
  • supports setting timeouts for specific tests or all tests
  • supports test contexts that are shared across multiple tests
  • tests can be skipped while leaving a message explaining the skip
  • functionality to easily produce random values and containers
  • portable across various operating systems and compilers
  • comes with tests and examples