Skip to Main Content
Test Driven Development for Embedded C
book

Test Driven Development for Embedded C

by James W. Grenning
April 2011
Intermediate to advanced content levelIntermediate to advanced
356 pages
8h 55m
English
Pragmatic Bookshelf
Content preview from Test Driven Development for Embedded C

Verifying Output with a Spy

In this section, we’ll look at a utility module, the CircularBuffer. A CircularBuffer can be created with a specified capacity; it can have integers added to it and removed from it. It behaves as a first-in first-out data structure. Some of the situations a CircularBuffer might find itself in are shown in Figure 19, CircularBuffer.

The CircularBuffer also must print itself out, oldest entry to newest, and not disturb the contents of the buffer. Given all the special cases, this is not quite as easy as it sounds. We’re coming into this problem with a working CircularBuffer and have to add the print capability. To get our test fixture in place, let’s start with the simplest case, printing an empty buffer. When ...

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

Design Patterns for Embedded Systems in C

Design Patterns for Embedded Systems in C

Bruce Powel Douglass

Publisher Resources

ISBN: 9781941222997Errata Page