Just-Test is your Test-Harness software made in C for C
BSD-2-CLAUSE License
██╗██╗ ██╗███████╗████████╗ ████████╗███████╗███████╗████████╗
██║██║ ██║██╔════╝╚══██╔══╝ ╚══██╔══╝██╔════╝██╔════╝╚══██╔══╝
██║██║ ██║███████╗ ██║ █████╗ ██║ █████╗ ███████╗ ██║
██ ██║██║ ██║╚════██║ ██║ ╚════╝ ██║ ██╔══╝ ╚════██║ ██║
╚█████╔╝╚██████╔╝███████║ ██║ ██║ ███████╗███████║ ██║
╚════╝ ╚═════╝ ╚══════╝ ╚═╝ ╚═╝ ╚══════╝╚══════╝ ╚═╝
Just-Test or Jt for short is your test-harness made in C for C, with the goal of making it as easy as possible for C devs to integrate unit testing and test-driven development(TDD) into their workflow.
$> make lib
$> gcc -o Test MyTestFile.c jt.a
>> change FILE=<path_to_your_file>
$> make
$> make FILE=<path_to_your_file>
JTEST_START
and JTEST_END
, which defines the block where you call the tests.runTest
(); or run all tests using runAll
();Jsetup
() and Jcleanup
(), you can leave them empty if you don't need them. TEST_START(AddOutputChecks)
ASSERT_INT32_EQU(3, add(1,2));
ASSERT_INT32_EQU(-5, add(6, -11));
TEST_END
IGNORE_TEST
:
TEST_START(AddOutputChecks, IGNORE_TEST)
ASSERT_INT32_EQU(3, add(1,2));
ASSERT_INT32_EQU(-5, add(6, -11));
TEST_END
ASSERT_UINT32_EQU(3, add(1,2));
ASSERT_INT32_EQU(-5, add(6, -11));
ASSERT_FLOAT_EQU(3.14, PI);
ASSERT_HEX_EQU(0x45, 0x43);
ASSERT_STR_EQU("Hello", s);
ASSERT_DATA_EQU
for example:
/*More Information Available in the TestExamples.c*/
typedef struct vector{
int x;
int y;
} _vector;
_vector v1 = {.x = 0, .y = 6};
_vector v2 = {.x = 0, .y = 6};
ASSERT_DATA_EQU(&v1, &v2, cmpVector, printVector);
=> Jtest Work on the Standard Error By default making it easier to dump it's output to a log file. => Jtest offers a No-Colors mode to make it well presented in a log file where colors will not show up (check Makefile).
Contributions are very welcome! Feel free to open issues or pull requests for bug fixes, improvements, or new features.
atoiBase | jtestExample |
---|---|