A cross-platform C and C++ unit testing framework for the 21th century
C C++ CMake Perl Shell Objective-C Other
Failed to load latest commit information.
.cmake release: Merge branch 'bleeding' Feb 7, 2017
.githooks hooks,style: Added exclusion pattern to pre-commit Nov 28, 2016
dependencies dependencies: Moved packageable dependencies out of the submodule system Nov 23, 2016
dev contrib-autotools: Added some more details on how the sample works. Feb 3, 2017
doc release: Merge branch 'bleeding' Feb 7, 2017
include/criterion logging.h:+ static for c++ logging streams Feb 20, 2017
po debug: Added support for --debug=idle. Fixes #154. Sep 16, 2016
samples cmake: Removed wrong -DCRITERION_BUILDING_DLL definition when buildin… Feb 7, 2017
src cmake: move generated config.h into build dir Feb 7, 2017
test cram: fixed timing failures for xml reports Feb 16, 2017
.bumpversion.cfg release: Merge branch 'bleeding' Feb 7, 2017
.gitignore Merge branch 'features/io-rewrite-nanopb' into bleeding Jan 18, 2016
.gitmodules dependencies: Moved packageable dependencies out of the submodule system Nov 23, 2016
.travis.yml travis: Fixed deploy path Oct 28, 2016
.uncrustify.cfg stats: Stop reporting passing assertions. Jan 20, 2017
AUTHORS authors: added contributors for #174 and #188 Feb 20, 2017
CMakeLists.txt CMakeLists:git->https Feb 20, 2017
CONTRIBUTING.md contributing: Added bit on commit messages Sep 6, 2016
ChangeLog changelog: added 2.3.1 changes Feb 7, 2017
LICENSE license: We're in 2017. Jan 21, 2017
README.md readme: switched AUR install method from yaourt to pacaur Feb 7, 2017
appveyor.yml release: Merge branch 'bleeding' Feb 7, 2017
debian.copyright license: We're in 2017. Jan 21, 2017
description.txt Added missing files for ppa builds Nov 28, 2015


Criterion Logo

Unix Build Status Windows Build Status Coverage Status License Version

A dead-simple, yet extensible, C and C++ unit testing framework.



Most test frameworks for C require a lot of boilerplate code to set up tests and test suites -- you need to create a main, then register new test suites, then register the tests within these suits, and finally call the right functions.

This gives the user great control, at the unfortunate cost of simplicity.

Criterion follows the KISS principle, while keeping the control the user would have with other frameworks:

  • C99 and C++11 compatible.
  • Tests are automatically registered when declared.
  • Implements a xUnit framework structure.
  • A default entry point is provided, no need to declare a main unless you want to do special handling.
  • Test are isolated in their own process, crashes and signals can be reported and tested.
  • Unified interface between C and C++: include the criterion header and it just works.
  • Supports parameterized tests and theories.
  • Progress and statistics can be followed in real time with report hooks.
  • TAP output format can be enabled with an option.
  • Runs on Linux, FreeBSD, Mac OS X, and Windows (Compiling with MinGW GCC and Visual Studio 2015+).



  • Mac OS X: brew install snaipe/soft/criterion
  • AUR: pacaur -S criterion
  • Ubuntu/Debian:

    $ sudo add-apt-repository ppa:snaipewastaken/ppa
    $ sudo apt-get update
    $ sudo apt-get install criterion-dev

Binary archives

Binary releases are available on the release page

If you have a different platform, you can still build the library from source

Developer Resources


An online documentation is available on ReadTheDocs (PDF | Zip | Epub)


Sample tests can be found in the sample directory.

Getting help

Channel Description
Subscribe to the mailing list Criterion mailing list on freelists.org
Join the chat at https://gitter.im/Snaipe/Criterion Snaipe/Criterion on gitter.im
Join #criterion on freenode #criterion on irc.freenode.net



Criterion is built with the following projects:

Logo made by Paul Bouigue.