A KISS, non-intrusive cross-platform C unit testing framework
Find a file
2015-03-17 23:45:21 +01:00
dependencies Updated csptr to latest 2015-03-17 14:53:41 +01:00
doc Renamed equal asserts, added asserts sample in README, added abort_test 2015-03-17 16:11:32 +01:00
include/criterion [Issue #1] Added test timers 2015-03-17 23:43:20 +01:00
m4 Added m4 placeholder 2015-02-06 02:00:04 +01:00
samples Renamed equal asserts, added asserts sample in README, added abort_test 2015-03-17 16:11:32 +01:00
src Fixed compile error on OS X timers 2015-03-17 23:21:57 +01:00
.gitignore Added command-line tests 2015-03-11 19:45:06 +01:00
.gitmodules Switched build system to autotools 2015-02-06 01:53:01 +01:00
.travis.yml Display test logs after build 2015-03-17 01:06:41 +01:00
appveyor.yml Fixed appveyor version format 2015-03-17 23:45:21 +01:00
autogen.sh Added m4 placeholder 2015-02-06 02:00:04 +01:00
ChangeLog [v0.3] Merge branch 'bleeding'. This adds the following: 2015-03-11 19:14:32 +01:00
configure.ac Switched build system to autotools 2015-02-06 01:53:01 +01:00
LICENSE Initial commit 2015-01-31 13:45:12 +01:00
Makefile.am Added monotonic cross-platform timer 2015-03-17 01:08:40 +01:00
README.md Renamed equal asserts, added asserts sample in README, added abort_test 2015-03-17 16:11:32 +01:00

Criterion

Build Status Coverage Status License Version

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

Screencast

Philosophy

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:

  • Tests are automatically registered when declared.
  • 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.
  • 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 (compiles only with Cygwin for the moment).

Downloads

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

Documentation

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

Samples

Sample tests can be found in the sample directory.

F.A.Q.

Q. What's wrong with other test frameworks?
A. I worked with CUnit and Check, and I must say that they do their job very well -- the only thing that bugs me is that setting up a test suite from scratch is a pain, it should really be simpler. Most (if not all) high-level languages have test frameworks with automatic test registration, but all the ones for C require you to set up a main, manually register suites, then tests. Criterion tries to fix these shortcomings.

Q. Where has this been tested?
A. Currently, on Linux 2.6.32 and Linux 3.15.7, although it should work on most *nix systems; Mac OS X Yosemite 10.10, FreeBSD 10.0, and finally Windows 7 (with the Cygwin port of GCC).

Q. Can I use it on Windows without Cygwin?
A. Yes, you can, Cygwin is only required to compile the static library if you build it from source -- otherwise, a GNU C compatible compiler (like GCC or Clang) is needed to compile your tests with the library.