This is a simple and lightweight C library that will allow you to test your application and see the test results right in the console.
Copy ctest.c and ctest.h to your project and import it in main.c or another file.
Examples
int main() {
enable_virtual_terminal();
DESCRIBE("TESTS") {
CTEST_EQ_INT(1, 1);
CTEST_NE_INT(1, 1);
CTEST_EQ_STR("Hello!", "Hello!");
CTEST_NE_STR("Hello!", "Shalom!");
CTEST_NULL(NULL);
CTEST_NOT_NULL("Hi!");
CTEST_GE_INT(4, 1);
CTEST_PRINT_TOTAL();
}
return 0;
}And view result:
DESCRIBE TESTS
PASS C:/.../main.c:8
FAIL C:/.../main.c:9
CTEST_NE_INT failed
Actual: 1
Expected: 1
PASS C:/.../main.c:10
PASS C:/.../main.c:11
PASS C:/.../main.c:12
PASS C:/.../main.c:13
PASS C:/.../main.c:14
TOTAL 7
FAILED 1