Crash to Pass
Adding the first test to legacy code is usually the hardest. Knowing what to expect and how to react can ease the process. The crash to pass algorithm can help you get through Michael’s legacy code change algorithm from Legacy Change Algorithm .
Here’s the situation. You want to test some existing legacy code. The function to exercise in the test is part of an interwoven mass of C data structures and functions. Just getting this data structure/function call free-for-all compiled in the test harness is a challenge. Getting the code to run in the test harness is enough to make you go for coffee and never come back.
In complex C code, data used by a legacy function may not be obvious. Deciding what to initialize and how to ...
Get Test Driven Development for Embedded C 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.