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

MockIO

MockIO might seem like a mysterious thing. You might think that it’s extra work that won’t be needed and just takes time from the production code. Let’s clear up some of the mystery around MockIO and look at its full interface and some of its implementation. I hope you will see that it’s not that much trouble.

MockIO’s public interface consists of the usual create/destroy functions, along with the functions for programming the expectations and assuring that all expectations are met.

mocks/MockIO.h
 
#ifndef D_MockIO_H
 
#define D_MockIO_H
 
#include "IO.h"
 
void​ MockIO_Create(​int​ maxExpectations);
 
void​ MockIO_Destroy(​void​);
 
void​ MockIO_Expect_Write(ioAddress offset, ioData data);
 
void​ MockIO_Expect_ReadThenReturn(ioAddress ...
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