From f7cf074cba7c9ebc994b7ce6c912d9cdaf6ee57b Mon Sep 17 00:00:00 2001 From: Christian Garbs Date: Wed, 25 Nov 2020 21:16:25 +0100 Subject: [PATCH] fix FAKE_VALUE_FUNC example Functions without arguments need FAKE_VALUE_FUNC0 instead of FAKE_VALUE_FUNC, otherwise C compiler will emit warnings like ISO C99 requires at least one argument for the "..." in a variadic macro --- README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a9757fd..4237c37 100644 --- a/README.md +++ b/README.md @@ -136,8 +136,8 @@ unsigned int DISPLAY_get_line_insert_index(); Here's how you would define fake functions for these in your test suite: ```c -FAKE_VALUE_FUNC(unsigned int, DISPLAY_get_line_capacity); -FAKE_VALUE_FUNC(unsigned int, DISPLAY_get_line_insert_index); +FAKE_VALUE_FUNC0(unsigned int, DISPLAY_get_line_capacity); +FAKE_VALUE_FUNC0(unsigned int, DISPLAY_get_line_insert_index); ``` And the unit test might look something like this: @@ -167,6 +167,10 @@ you would use a syntax like this: ```c FAKE_VALUE_FUNC(double, pow, double, double); ``` + +Note the difference between `FAKE_VALUE_FUNC0` for functions without arguments +and `FAKE_VALUE_FUNC` for functions with arguments. + ## Resetting a Fake Good tests are isolated tests, so it is important to reset the fakes for each