╔════════════╗
║ Preuve ║ A simple and ergonomic unit tests framework.
╚════════════╝
- C11 and up.
- Single header library.
- Works on Linux, Windows and MacOS.
- Works with GCC, Clang and MSVC.
- No warnings; even with
-Wall -Wextra -Wpedantic -Wconversionor/W4. - No dynamic memory allocation; everything is statically allocated.
- Support unicode tests name (even on Windows).
- Debugger aware; A failing test will trigger a breakpoint.
- Define your tests anywhere in your project.
#define PREUVE_IMPLEMENTATION //< To be defined once in your project.
#include "preuve.h"
TEST("strtol is 🔥", "it should parse negative numbers")
{
errno = 0;
long num = strtol("-123", NULL, 10);
VERIFY_EQUAL(num, -123);
VERIFY_EQUAL(errno, 0);
}
// v Skip this test for now
SKIP_TEST("strtol is 🔥", "it should parse explicit plus sign")
{
errno = 0;
char *end;
long num = strtol("+42", &end, 10);
VERIFY_EQUAL(num, 42);
VERIFY_EQUAL(errno, 0);
VERIFY_EQUAL(*end, '\0');
}What you will see on your terminal:
#define PREUVE_IMPLEMENTATION
#include "preuve.h"
TEST("string", "it should print the greatest hockey team of all time")
{
char *result = "Carolina Hurricanes";
char expected[] = "Montréal Canadiens";
VERIFY_EQUAL_CSTR(result, expected);
}What you will see on your terminal:
Simply download and include preuve.h in your project. Voilà!
No autoconf. No apt install. No dependency.
You can see full examples (including the build system) in the examples folder.
Preprocessor options:
- Define
PREUVE_API_WITH_PREFIXif you wantPREUVE_to prefix the API. See examples. - Define
PREUVE_NO_MAINif you want to define the main yourself. See examples.
// Tests
TEST(TEST_SUITE_NAME, TEST_CASE_NAME)
SKIP_TEST(TEST_SUITE_NAME, TEST_CASE_NAME)
// Verify
VERIFY(COND)
VERIFY_TRUE(COND)
VERIFY_FALSE(COND)
VERIFY_NULL(PTR)
VERIFY_EQUAL(LEFT, RIGHT)
VERIFY_EQUAL_CSTR(LEFT, RIGHT)
VERIFY_EQUAL_ARRAY(LEFT_LEN, LEFT, RIGHT_LEN, RIGHT)
VERIFY_NOT_NULL(PTR)
VERIFY_NOT_EQUAL(LEFT, RIGHT)
VERIFY_NOT_EQUAL_CSTR(LEFT, RIGHT)
VERIFY_NOT_EQUAL_ARRAY(LEFT_LEN, LEFT, RIGHT_LEN, RIGHT)Please don't send me GenAI slop.
Otherwise, suggestions, requests, and bug reports are welcome.
curl -s https://raw.githubusercontent.com/g-berthiaume/preuve.h/refs/heads/main/preuve.h | grep "#define PREUVE_VERSION"See License.

