Compile executable with -D UNIT_TESTING to enable tests
#define UNIT_MAIN
#include <unit.h>
SUITE( suite name ) {
DESCRIBE( subcase name ) {
IT("is test behaviour") {
WARN("use WARN_* to print failed assumptions");
CHECK("use CHECK_* to continue execute assertions on fail");
REQUIRE("use REQUIRE_* to skip next assertions on fail");
}
}
}--version,-v: Prints the version ofunitlibrary--help,-h: Prints usage help message--list,-l: Prints all available tests--animate,-a: Simulate waits for printing messages, just for making fancy printing animation--ascii: Don't use colors and fancy unicode symbols in the output--short-filenames,-S: Use only basename for displaying file-pos information--quiet,-q: Disables all output-r=xml: Special switch prints XML report in DocTest-friendly format (for CLion test run configuration)
- Written in Pure C: only standard
libcis used - Simplicity and tiny build-size
- No dynamic memory allocations: only static memory is used for reporting test running infrastructure.
- Single-header library: easy to integrate
- Embedded runner & pretty reporter: build self-executable test
- Disable test code: allow you to write tests for your private implementation right at the end of
impl.cfile - Cross-platform: should work for Linux / macOS / Windows / WebAssembly
- Cross-compiler support: no
MSVCsupport, onlyclangis tested - Multithreading and parallel test running
- Tricky test matchers design
- Fixtures,
before/afteror mocking - Crash tests and signal interception
- Fuzz testing
In any case, if you have a desire, you can support and contribute! Feel free to ask me any feature you need. Thank you for your interest!
