Skip to Main Content
Learn C the Hard Way: Practical Exercises on the Computational Subjects You Keep Avoiding (Like C)
book

Learn C the Hard Way: Practical Exercises on the Computational Subjects You Keep Avoiding (Like C)

by Zed A. Shaw
July 2015
Intermediate to advanced content levelIntermediate to advanced
380 pages
10h 15m
English
Addison-Wesley Professional
Content preview from Learn C the Hard Way: Practical Exercises on the Computational Subjects You Keep Avoiding (Like C)

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:

minunit.h

  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 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Modern C for Absolute Beginners: A Friendly Introduction to the C Programming Language

Modern C for Absolute Beginners: A Friendly Introduction to the C Programming Language

Slobodan Dmitrović

Publisher Resources

ISBN: 9780133124385Purchase Link