A cross-platform C and C++ unit testing framework for the 21th century
Failed to load latest commit information.
.cmake Set /source-charset:utf-8 for MSVC Aug 26, 2018
.githooks asserts: Implemented new composable assertion API. Jul 1, 2017
dependencies asserts: Implemented new composable assertion API. Jul 1, 2017
dev autogen: stop redirecting std{out,err}. Jul 17, 2017
doc Fix a typo in the docs Oct 22, 2017
include/criterion Add missing parameter to the documented interface. Aug 26, 2018
po po: update line numbers Jul 16, 2017
samples new-assert: added stream tag. May 2, 2018
src output: add directory support to test reports Aug 26, 2018
test output: add directory support to test reports Aug 26, 2018
.bumpversion.cfg v2.3.2: merging bleeding back to master Apr 8, 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,osx: use xcode8 image for gcc-4.9 availability Jan 31, 2018
.uncrustify.cfg style: relax rules about brace removal & mandatory newlines after def… Apr 4, 2017
AUTHORS authors: added contributors for #174 and #188 Feb 20, 2017
CMakeLists.txt deps: updated boxfort to 106d7da4b365e8a775a6d67c423fb85777d8d81e May 1, 2018
CONTRIBUTING.md contributing: add section about testing changes Jan 31, 2018
ChangeLog v2.3.2: merging bleeding back to master Apr 8, 2017
LICENSE license: We're in 2017. Jan 21, 2017
README.md readme: fixed header in response to github/markup#1022 May 22, 2017
appveyor.yml appveyor: checkout quietly Aug 26, 2018
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.