Is It Worth It?
Unlike the test doubles supporting the development of the LightScheduler, MockIO is much more complex. The mock is more than 200 lines of code. There are about 150 lines of Flash test code on top of that, all to test about 70 lines of production code. It seems like that might be a lot of investment.
It is worth it. For one thing, MockIO won’t just be used for the flash driver. It is a handy tool for testing anything that does I/O reads and writes. That investment will be leveraged across many drivers. Looking at the reference implementation from the manufacturer, there are almost 900 lines of C code. Much of this code is not as simple as Flash_Write—there is much looping and conditional logic. Given that, the effort to put ...
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.
Read now
Unlock full access