Epholys / BCUT

Barebones C Unit Tests

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

BCUT

Barebones C Unit Tests

Use

Declare and define every unit test with BCUT_TEST(). In each unit test, use BCUT_ASSERT() to validate a boolean expression. Finally, run a test suite by calling bcut_suite_run().

Exemple

#include"bcut.h"

bool greater(int x, int y) { return x > y; }

BCUT_TEST(greater_test)  { BCUT_ASSERT(greater(1337,42)); }

int main()
{
	bcut_suite_run("Dummy test", 1, greater_test);
	return 0;
}

Hacking

By default, if a unit test fails, a message containing func, LINE and the boolean expression tested is displayed. To avoid buffer overflows, this message has a limited size of 128 bytes defined by the macro BCUT_BUFFER_SIZE which you can easily override.

About

Barebones C Unit Tests

License:GNU General Public License v3.0


Languages

Language:C 100.0%