Back to home

kronklab

A simple test framework in C.

Overview

KronkLab is a light test and benchmark framework in C. Declare tests with Test(suite, name), check them with the Assert macros, and run the executable to get a report.

A test that crashes (segfault…) is reported as failed and does not stop the others. KronkLab builds on Linux and Windows. Kronkpool uses it for its tests.

Examples

Writing tests
#include "kronklab/kronklab.h"

Test(math, addition)
{
    AssertEq(1 + 1, 2, "1 + 1 should be 2");
}

Test(str, equal)
{
    AssertStrEq("kronk", "kronk", "strings differ");
}
Benchmarks
Bench(perf, loop)
{
    BenchStart();
    for (size_t i = 0; i < 10000000; ++i)
        ;
    BenchEnd();
    BenchReport();
}