Exercise 30. Automated Testing
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 ...
Get Learn C the Hard Way: A Clear & Direct Introduction To Modern C Programming now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.