Automated testing is used frequently in other languages like Python and Ruby, but rarely used in C. Part of the reason comes from the difficulty of automatically loading and testing pieces of C code. In this chapter, we’ll create a very small testing framework and get your skeleton directory to build an example test case.
The framework I’m going to use, and you’ll include in your
c-skeleton skeleton, is called minunit which started with a tiny snippet of code by Jera Design. I evolved it further, to be this:
1 #undef NDEBUG 2 #ifndef _minunit_h 3 #define _minunit_h 4 5 #include <stdio.h> 6 #include <dbg.h> 7 #include <stdlib.h> 8 9 #define ...