Embedded C/C++ Unit Testing Basics | Interrupt

Oops, I think I meant to add this to the post!

I typically define something like the following and then use this instead of static in my codebase for those functions that need to be unit tested.

#if UNIT_TESTING
#define TEST_STATIC 
#else
#define TEST_STATIC static
#endif

Then, for unit testing, TEST_STATIC becomes a no-op and your functions become global, but for normal firmware builds, static is inserted.