1
0
Fork 0
mirror of https://github.com/yshui/picom.git synced 2024-11-03 04:33:49 -05:00
picom/subprojects/test.h
Yuxuan Shui cfdbd11328 Add 'subprojects/test.h/' from commit 'a84877df68873f80ff3620f4993619b35b21f758'
git-subtree-dir: subprojects/test.h
git-subtree-mainline: 061f9aea9d
git-subtree-split: a84877df68
2019-03-23 14:36:27 +00:00
..
examples/trivial_tests Add 'subprojects/test.h/' from commit 'a84877df68873f80ff3620f4993619b35b21f758' 2019-03-23 14:36:27 +00:00
meson.build Add 'subprojects/test.h/' from commit 'a84877df68873f80ff3620f4993619b35b21f758' 2019-03-23 14:36:27 +00:00
README.md Add 'subprojects/test.h/' from commit 'a84877df68873f80ff3620f4993619b35b21f758' 2019-03-23 14:36:27 +00:00
test.h Add 'subprojects/test.h/' from commit 'a84877df68873f80ff3620f4993619b35b21f758' 2019-03-23 14:36:27 +00:00

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.