/** * utest.h * Sam's favorite unit testing macros. Make sure to link your file * with utest.o. */ #ifndef __UTEST_H__ #define __UTEST_H__ // +--------+--------------------------------------------------------- // | Macros | // +--------+ #define CHECK_INT(COMMAND, EXPECTED) check_int (#COMMAND, COMMAND, EXPECTED) #define CHECK_STR(COMMAND, EXPECTED) check_str (#COMMAND, COMMAND, EXPECTED) // +---------+-------------------------------------------------------- // | Globals | // +---------+ extern int errors; // +-----------+------------------------------------------------------ // | Functions | // +-----------+ void check_int (char *command, int result, int expected); void check_str (char *command, char *result, char *expected); #endif // __UTEST_H__