Barebones Unit Testing In C
Posted on 15 Jan 2014
We all know those nights spent pounding away at a personal project. Let’s face it, unit testing in C is a pain in the butt. If you can’t be bothered to pull Check, ATF, or the like into your project, Jera Design presents an extremely simple testing framework – MinUnit:
/* file: minunit.h */
#define mu_assert(message, test) do { if (!(test)) return message; } while (0)
#define mu_run_test(test) do { char *message = test(); tests_run++; if (message) return message; } while (0)
extern int tests_run;
… and that’s all folks!
comments powered by Disqus