ESAPI-C 1.0
The OWASP Enterprise Security API for C

test/include/minunit.h

Go to the documentation of this file.
00001 #ifndef MINUNIT_H_
00002 #define MINUNIT_H_
00003 #include <stdio.h>      // fprintf
00004 #include <string.h>     // strcmp
00005 
00006 int passed = 0, failed = 0;
00007 
00008  #define mu_assert(message, test) do { if (!(test)) return message; } while (0)
00009  #define mu_run_test(test) do { char *message = test(); tests_run++; \
00010                                 if (message) return message; } while (0)
00011 
00012 #define TEST(test)    \
00013    if (test) {  \
00014        ++passed;       \
00015        (void) fprintf(stdout, \
00016          " PASS: test %.d at line %.d\n", (passed + failed), __LINE__); \
00017    } else {      \
00018        ++failed; \
00019        (void) fprintf(stdout, \
00020          " FAIL: test %.d at line %.d\n", (passed + failed), __LINE__); \
00021    }
00022 
00023 #endif /* MINUNIT_H_ */
 All Data Structures Files Functions Variables Typedefs Defines