A lightweight compositor for X11
Go to file
Yuxuan Shui a84877df68
Run run_tests automatically
Make unittest facility less visible.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-03-21 20:11:20 +00:00
examples/trivial_tests Run run_tests automatically 2019-03-21 20:11:20 +00:00
README.md Run run_tests automatically 2019-03-21 20:11:20 +00:00
meson.build Add a meson.build to test.h 2019-03-18 21:46:23 +00:00
test.h Run run_tests automatically 2019-03-21 20:11:20 +00:00

README.md

test.h

A very simple, light weight, header only C unit test framework.

Features

  • Easy to use, no dependencies, no setup needed.
  • Keep test cases close to the code they test.
  • Automatic registration of the test cases.

Usage

Setup

Just include the header

#include "test.h"

Defining test cases

TEST_CASE(test_case_name) {
	// Your code here
	// ...
	TEST_EQUAL(1, 0); // Fail
}

Run the test cases

Build your program with -DUNIT_TEST, then run your program with ./program --unittest.

Hooks

If you define a function test_h_unittest_setup, it will be called before any test cases are run.