Skip to main content


The Criterion testing framework is available in its Github repository. Reference for the Criterion API can be found here:

Basic Setup#

int add(int a, int b) {
return a + b;
#include <criterion/criterion.h>
int add(int, int);
Test(add_test, should_add_integers, .description = "should add integers") {
int a = 1;
int b = 1;
int expected = 2;
cr_assert_eq(expected, add(a, a), "add(%d, %d) == %d", a, b, expected);



Assertions reference can be found in the Criterion documentation.

  • assert vs except
  • messages