A minimalistic test harness for c code.
# Testing bools [OK] 1 == true [OK] 0 == false # Testing ints [OK] 1 == 1 [FAIL] 0 == 1 (at line 17) # Result [OK] 3 [FAIL] 1
Exposes the following set of macros:
Call this macro at file scope. This sets up test counters.
Print out a text and call function
Evaluate an expression. Does the following:
trueprint out message and increment counter for successful tests
falseprint out message (using
__LINE__) and increment counter for failed tests
ASSERT(expr) but exits process directly. Useful if you don't want to continue testing for some reason to not end up in infinite loops etc.
Print out test report.
Return this in your
main (or use with
exit()) for proper exit code.