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

Writing the First Test

The test list is done, so let’s get started. A natural first test is to test that initialization is correct. LEDs are supposed to be off after initialization.

First we’ll create the LedDriver test file. By convention, I call it LedDriverTest.c. I usually place test code in a different directory from the production code. I’ll put this code in the unity/LedDriver directory and adjust my makefile so it compiles and links with the new test file. Choosing a suitable test name for what we are trying to accomplish, the file should look like this:

unity/LedDriver/LedDriverTest.c
 
#include "unity_fixture.h"
 
TEST_GROUP(LedDriver);
 
 
TEST_SETUP(LedDriver)
 
{
 
}
 
 
TEST_TEAR_DOWN(LedDriver)
 
{
 
}
 
 
TEST(LedDriver, LedsOffAfterCreate) ...
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