A very simple, light weight, header only C unit test framework.
- Easy to use, no dependencies, no setup needed.
- Keep test cases close to the code they test.
- Automatic registration of the test cases.
Just include the header
#include "test.h"
TEST_CASE(test_case_name) {
// Your code here
// ...
TEST_EQUAL(1, 0); // Fail
}
Build your program with -DUNIT_TEST
, then run your program with ./program --unittest
.
If you define a function test_h_unittest_setup
, it will be called before any test cases are run.