• Stars
    star
    1,926
  • Rank 23,132 (Top 0.5 %)
  • Language
    C
  • License
    MIT License
  • Created over 9 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A cross-platform C and C++ unit testing framework for the 21st century

Criterion Logo

Build Status Coverage Status License Version Documentation (Stable) Documentation (Bleeding)

A dead-simple, yet extensible, C and 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 suites, 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, macOS, and Windows (Compiling with MinGW GCC and Visual Studio 2015+).

Downloads

Packages

Platform Command
Ubuntu (>=21.04) / Debian (>=11) apt-get install libcriterion-dev
Gentoo emerge -a dev-libs/criterion
Arch Linux (AUR) pacaur -S criterion
macOS brew install criterion
Nix nix-env -iA nixpkgs.criterion
FreeBSD pkg install criterion

If you'd like to see Criterion included in your favorite distribution, please reach out to their package maintainers team.

Binary archives

Binary releases for Linux x86_64 are available on the release page.

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

Developer Resources

Documentation

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

Samples

Sample tests can be found in the sample directory.

Getting help

Channel Description
Ask a question in GitHub discussions Ask a question in GitHub discussions
Subscribe to the mailing list Criterion mailing list on freelists.org

Misc

Credits

Criterion is built with the following projects:

Logo made by Paul Bouigue.

More Repositories

1

libcsptr

Smart pointers for the (GNU) C programming language
CMake
1,478
star
2

wssdl

Wireshark-Specific Dissector Language
Lua
194
star
3

Mimick

A KISS, cross-platform C mocking library
C
148
star
4

fmem

A cross-platform library for opening memory-backed libc streams.
C
59
star
5

dot-git

Managing your dotfiles the Git Wayâ„¢
Shell
44
star
6

BoxFort

Convenient & cross-platform sandboxing C library
C
40
star
7

python-rst2ansi

A python utility for rendering RST in the terminal
Python
32
star
8

confloose

The best startup scripts to prank IT people with
22
star
9

table2ascii

A simple proof of concept for rendering tables in ascii
Python
21
star
10

malloc

Simple malloc implementation for POSIX systems w/ sbrk(2)
C
18
star
11

toy-containers

Fast, lightweight toy container system
Go
11
star
12

Tizzy

A C library dedicated to error handling and panicking.
C
9
star
13

dyncall

Git mirror of http://hg.dyncall.org/pub/dyncall/dyncall
C
8
star
14

Insight

A reflection library for C and C++
C++
5
star
15

lastpass-ssh-agent

A SSH agent that authenticates you from keys in your lastpass vault
C
5
star
16

gitlab-runner-kubevirt

A gitlab-runner custom executor driver for running jobs with Kubevirt
Go
4
star
17

ttysend

A simplistic C utility to send data to other tty/pts.
C
4
star
18

colorutils

A small linux (command-line) utility to make the framebuffer a splashscreen
C
3
star
19

Tequila

A Minecraft server manager
Python
3
star
20

x-nix

A linux compatibility layer for multiple platforms
C
3
star
21

go-htutil

Go HTTP utilities, with no dependencies
Go
2
star
22

arm-stm32l1

A sample project for the stm32l1 using libopencm3
C
2
star
23

.files

My dotfiles. Check https://github.com/Snaipe/dot-git for the workflow.
Python
2
star
24

go-pass

Prompting passwords securely in Go
Go
2
star
25

sweet

A sway-to-i3 IPC compatibility layer
Go
2
star
26

Thieves

A thief plugin for Bukkit
Java
2
star
27

boa

Better configuration management in Go
Go
2
star
28

articles

Articles on http://snaipe.me/
2
star
29

metaheuristic

Python
2
star
30

packages

Packaging sources for my software
Shell
1
star
31

go-pager

A Go writer that abstracts `$PAGER` in a POSIX-compliant way.
Go
1
star
32

BlackDog

A Bukkitdev-to-maven-repository mapper
Python
1
star
33

go-hterrors

Convenience library for handling non-2xx HTTP errors
Go
1
star
34

Vapor

A java library for p2p sharing
Java
1
star
35

docker-alpine-qemu

Foreign-arch docker images running on x86_64 hosts.
Shell
1
star
36

meson-check

A meson module to conveniently check for features
Python
1
star
37

Damon

Functional constructs for the D programming language
D
1
star
38

libdwarfplusplus

A C++ wrapper over libdwarf
C++
1
star