Skip to content

Instantly share code, notes, and snippets.

@michahoiting
Created July 11, 2013 14:48
Show Gist options
  • Save michahoiting/5976104 to your computer and use it in GitHub Desktop.
Save michahoiting/5976104 to your computer and use it in GitHub Desktop.
Resetting a list of fakes
/* List of fakes used by this unit tester */
#define FFF_FAKES_LIST(FAKE) \
FAKE(DISPLAY_init) \
FAKE(DISPLAY_clear) \
FAKE(DISPLAY_output_message) \
FAKE(DISPLAY_get_line_capacity) \
FAKE(DISPLAY_get_line_insert_index)
void setup()
{
/* Register resets */
FFF_FAKES_LIST(RESET_FAKE);
/* reset common FFF internal structures */
FFF_RESET_HISTORY();
}
@gsrunion
Copy link

If you like this trick you should check out a technique called X-Macros.

@kaos
Copy link

kaos commented Oct 24, 2013

Oh, wow.
I've used X-Macros before, but never knew that the technique had a name..! :p

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment