summaryrefslogtreecommitdiff
path: root/deps/fff
diff options
context:
space:
mode:
Diffstat (limited to 'deps/fff')
-rw-r--r--deps/fff/.github/ISSUE_TEMPLATE/bug_report.md28
-rw-r--r--deps/fff/.github/ISSUE_TEMPLATE/feature_request.md17
-rw-r--r--deps/fff/.github/PULL_REQUEST_TEMPLATE.md8
-rw-r--r--deps/fff/.github/workflows/verify_pr.yaml25
-rw-r--r--deps/fff/.gitignore40
-rw-r--r--deps/fff/.travis.yml8
-rw-r--r--deps/fff/CMakeLists.txt46
-rw-r--r--deps/fff/LICENSE25
-rw-r--r--deps/fff/README.md665
-rwxr-xr-xdeps/fff/buildandtest15
-rw-r--r--deps/fff/examples/CMakeLists.txt6
-rw-r--r--deps/fff/examples/driver_testing/CMakeLists.txt31
-rw-r--r--deps/fff/examples/driver_testing/include/driver.h11
-rw-r--r--deps/fff/examples/driver_testing/include/hardware_abstraction.h15
-rw-r--r--deps/fff/examples/driver_testing/include/registers.h13
-rw-r--r--deps/fff/examples/driver_testing/src/driver.c24
-rw-r--r--deps/fff/examples/driver_testing/src/driver.test.cpp50
-rw-r--r--deps/fff/examples/driver_testing/src/driver.test.fff.cpp63
-rw-r--r--deps/fff/examples/embedded_ui/CMakeLists.txt23
-rw-r--r--deps/fff/examples/embedded_ui/Kata.txt25
-rw-r--r--deps/fff/examples/embedded_ui/include/DISPLAY.h17
-rw-r--r--deps/fff/examples/embedded_ui/include/SYSTEM.h21
-rw-r--r--deps/fff/examples/embedded_ui/include/UI.h12
-rw-r--r--deps/fff/examples/embedded_ui/src/UI.c48
-rw-r--r--deps/fff/examples/embedded_ui/src/UI_test_ansic.c183
-rw-r--r--deps/fff/examples/embedded_ui/src/UI_test_cpp.cpp136
-rw-r--r--deps/fff/examples/weak_linking/CMakeLists.txt54
-rw-r--r--deps/fff/examples/weak_linking/config/config.h.in5
-rw-r--r--deps/fff/examples/weak_linking/include/bus.h6
-rw-r--r--deps/fff/examples/weak_linking/include/display.h5
-rw-r--r--deps/fff/examples/weak_linking/include/error.h7
-rw-r--r--deps/fff/examples/weak_linking/include/sensor.h6
-rw-r--r--deps/fff/examples/weak_linking/src/bus.c30
-rw-r--r--deps/fff/examples/weak_linking/src/display.c29
-rw-r--r--deps/fff/examples/weak_linking/src/error.c10
-rw-r--r--deps/fff/examples/weak_linking/src/main.c27
-rw-r--r--deps/fff/examples/weak_linking/src/sensor.c29
-rw-r--r--deps/fff/examples/weak_linking/test/include/bus.fake.h10
-rw-r--r--deps/fff/examples/weak_linking/test/include/display.fake.h10
-rw-r--r--deps/fff/examples/weak_linking/test/include/error.fake.h10
-rw-r--r--deps/fff/examples/weak_linking/test/include/sensor.fake.h13
-rw-r--r--deps/fff/examples/weak_linking/test/include/test_common.h13
-rw-r--r--deps/fff/examples/weak_linking/test/src/bus.fake.c4
-rw-r--r--deps/fff/examples/weak_linking/test/src/display.fake.c4
-rw-r--r--deps/fff/examples/weak_linking/test/src/display.test.c24
-rw-r--r--deps/fff/examples/weak_linking/test/src/error.fake.c4
-rw-r--r--deps/fff/examples/weak_linking/test/src/main.test.c26
-rw-r--r--deps/fff/examples/weak_linking/test/src/sensor.fake.c11
-rw-r--r--deps/fff/examples/weak_linking/test/src/sensor.test.c23
-rw-r--r--deps/fff/examples/weak_linking/test/src/test_common.c33
-rw-r--r--deps/fff/fakegen.rb698
-rw-r--r--deps/fff/fff.h6588
-rw-r--r--deps/fff/test/CMakeLists.txt87
-rw-r--r--deps/fff/test/include/c_test_framework.h15
-rw-r--r--deps/fff/test/include/custom_function.hpp10
-rw-r--r--deps/fff/test/include/fff_wrapper.hpp11
-rw-r--r--deps/fff/test/include/global_fakes.h49
-rw-r--r--deps/fff/test/src/fff_test_c.c132
-rw-r--r--deps/fff/test/src/fff_test_cpp.cpp101
-rw-r--r--deps/fff/test/src/fff_test_custom_function_template.cpp29
-rw-r--r--deps/fff/test/src/fff_test_global_c.c84
-rw-r--r--deps/fff/test/src/fff_test_global_cpp.cpp26
-rw-r--r--deps/fff/test/src/global_fakes.c34
-rw-r--r--deps/fff/test/src/test_cases.include544
64 files changed, 10356 insertions, 0 deletions
diff --git a/deps/fff/.github/ISSUE_TEMPLATE/bug_report.md b/deps/fff/.github/ISSUE_TEMPLATE/bug_report.md
new file mode 100644
index 0000000..fa04e0a
--- /dev/null
+++ b/deps/fff/.github/ISSUE_TEMPLATE/bug_report.md
@@ -0,0 +1,28 @@
+---
+name: Bug report
+about: Create a report to help us improve
+
+---
+
+**Describe the bug**
+A clear and concise description of what the bug is.
+
+**To Reproduce**
+Steps to reproduce the behavior:
+1. Go to '...'
+2. Click on '....'
+3. Scroll down to '....'
+4. See error
+
+**Expected behavior**
+A clear and concise description of what you expected to happen.
+
+**Screenshots**
+If applicable, add screenshots to help explain your problem.
+
+**Compiler, toolset, platform (please complete the following information):**
+ - OS: [e.g. Ubuntu 16.04 LTS]
+ - Compiler: [e.g. gcc (Ubuntu 5.4.0-6ubuntu1~16.04.10) 5.4.0 20160609]
+
+**Additional context**
+Add any other context about the problem here.
diff --git a/deps/fff/.github/ISSUE_TEMPLATE/feature_request.md b/deps/fff/.github/ISSUE_TEMPLATE/feature_request.md
new file mode 100644
index 0000000..066b2d9
--- /dev/null
+++ b/deps/fff/.github/ISSUE_TEMPLATE/feature_request.md
@@ -0,0 +1,17 @@
+---
+name: Feature request
+about: Suggest an idea for this project
+
+---
+
+**Is your feature request related to a problem? Please describe.**
+A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
+
+**Describe the solution you'd like**
+A clear and concise description of what you want to happen.
+
+**Describe alternatives you've considered**
+A clear and concise description of any alternative solutions or features you've considered.
+
+**Additional context**
+Add any other context or screenshots about the feature request here.
diff --git a/deps/fff/.github/PULL_REQUEST_TEMPLATE.md b/deps/fff/.github/PULL_REQUEST_TEMPLATE.md
new file mode 100644
index 0000000..10f1195
--- /dev/null
+++ b/deps/fff/.github/PULL_REQUEST_TEMPLATE.md
@@ -0,0 +1,8 @@
+Thank you for your contribution.
+
+Before submitting this PR, please make sure:
+
+- [ ] Your code builds clean without any errors or warnings
+- [ ] You are not breaking consistency
+- [ ] You have added unit tests
+- [ ] All tests and other checks pass
diff --git a/deps/fff/.github/workflows/verify_pr.yaml b/deps/fff/.github/workflows/verify_pr.yaml
new file mode 100644
index 0000000..588afac
--- /dev/null
+++ b/deps/fff/.github/workflows/verify_pr.yaml
@@ -0,0 +1,25 @@
+name: Check PR
+
+on:
+ pull_request:
+ branches:
+ - master
+ push:
+
+
+jobs:
+ check-pr:
+ runs-on: ${{ matrix.os }}
+ strategy:
+ matrix:
+ os: [ubuntu-latest, windows-latest, macos-latest]
+ steps:
+ - uses: actions/checkout@v3
+ - uses: seanmiddleditch/gha-setup-ninja@master
+ - name: Build
+ run: |
+ mkdir build
+ cmake -GNinja -B build
+ cmake --build build
+ ctest --test-dir build --output-on-failure
+
diff --git a/deps/fff/.gitignore b/deps/fff/.gitignore
new file mode 100644
index 0000000..42ff828
--- /dev/null
+++ b/deps/fff/.gitignore
@@ -0,0 +1,40 @@
+build/
+*~
+*.sublime-project
+*.sublime-workspace
+
+# User-specific files
+*.rsuser
+*.suo
+*.user
+*.userosscache
+*.sln.docstates
+
+# Build results
+[Dd]ebug/
+[Dd]ebugPublic/
+[Rr]elease/
+[Rr]eleases/
+x64/
+x86/
+bld/
+[Bb]in/
+[Oo]bj/
+[Ll]og/
+
+# Visual Studio 2015/2017 cache/options directory
+.vs/
+
+# IntelliJ IDE project directory
+.idea/
+
+# Visual C++ cache files
+ipch/
+*.aps
+*.ncb
+*.opendb
+*.opensdf
+*.sdf
+*.cachefile
+*.VC.db
+*.VC.VC.opendb
diff --git a/deps/fff/.travis.yml b/deps/fff/.travis.yml
new file mode 100644
index 0000000..cb7ea9b
--- /dev/null
+++ b/deps/fff/.travis.yml
@@ -0,0 +1,8 @@
+language: cpp
+compiler:
+ - clang
+ - gcc
+script: ./buildandtest
+os:
+ - linux
+ - osx
diff --git a/deps/fff/CMakeLists.txt b/deps/fff/CMakeLists.txt
new file mode 100644
index 0000000..1672943
--- /dev/null
+++ b/deps/fff/CMakeLists.txt
@@ -0,0 +1,46 @@
+# Copyright 2022 Google LLC
+# SPDX-License-Identifier: Apache-2.0
+
+cmake_minimum_required(VERSION 3.20.0)
+project(fff)
+
+set(CMAKE_CXX_STANDARD 11)
+
+# Enable ctest
+enable_testing()
+
+add_library(fff INTERFACE)
+
+option(FFF_GENERATE "If enabled, fff.h will be regenerated using ruby" OFF)
+
+# Generate fff.h if fakegen.rb changed
+if(FFF_GENERATE)
+ add_custom_command(
+ OUTPUT
+ ${CMAKE_CURRENT_LIST_DIR}/fff.h
+ COMMAND
+ ruby ${CMAKE_CURRENT_LIST_DIR}/fakegen.rb >> ${CMAKE_CURRENT_LIST_DIR}/fff.h
+ DEPENDS
+ ${CMAKE_CURRENT_LIST_DIR}/fakegen.rb
+ ${CMAKE_CURRENT_LIST_DIR}/LICENSE
+ )
+ add_custom_target(fff_h DEPENDS ${CMAKE_CURRENT_LIST_DIR}/fff.h)
+else()
+ add_library(fff_h INTERFACE)
+ set_target_properties(fff_h
+ PROPERTIES PUBLIC_HEADER "fff.h"
+ )
+endif()
+
+add_dependencies(fff fff_h)
+
+# Add an interface library for fff.h
+target_include_directories(fff INTERFACE ${CMAKE_CURRENT_LIST_DIR})
+
+option(FFF_UNIT_TESTING "If enabled, fff tests will be compiled and run" OFF)
+
+if(FFF_UNIT_TESTING)
+ # Add tests and samples
+ add_subdirectory(test)
+ add_subdirectory(examples)
+endif()
diff --git a/deps/fff/LICENSE b/deps/fff/LICENSE
new file mode 100644
index 0000000..7b3129b
--- /dev/null
+++ b/deps/fff/LICENSE
@@ -0,0 +1,25 @@
+/*
+LICENSE
+
+The MIT License (MIT)
+
+Copyright (c) 2010 Michael Long
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+*/ \ No newline at end of file
diff --git a/deps/fff/README.md b/deps/fff/README.md
new file mode 100644
index 0000000..0b10627
--- /dev/null
+++ b/deps/fff/README.md
@@ -0,0 +1,665 @@
+# Fake Function Framework (fff)
+-----------------------------
+
+[![Build Status](https://travis-ci.org/meekrosoft/fff.svg?branch=master)](https://travis-ci.org/meekrosoft/fff)
+[![Build status](https://ci.appveyor.com/api/projects/status/md1gn8cxnjkrkq3b/branch/master?svg=true)](https://ci.appveyor.com/project/wulfgarpro/fff/branch/master)
+[![Gitter chat](https://badges.gitter.im/gitterHQ/gitter.png)](https://gitter.im/wulfgarpro/fff?utm_source=share-link&utm_medium=link&utm_campaign=share-link)
+
+- [A Fake Function Framework for C](#a-fake-function-framework-for-c)
+- [Hello Fake World!](#hello-fake-world)
+- [Capturing Arguments](#capturing-arguments)
+- [Return Values](#return-values)
+- [Resetting a Fake](#resetting-a-fake)
+- [Call History](#call-history)
+- [Default Argument History](#default-argument-history)
+- [User Defined Argument History](#user-defined-argument-history)
+- [Function Return Value Sequences](#function-return-value-sequences)
+- [Custom Return Value Delegate](#custom-return-value-delegate)
+- [Return Value History](#return-value-history)
+- [Variadic Functions](#variadic-functions)
+- [Common Questions](#common-questions)
+- [Specifying GCC Function Attributes](#specifying-gcc-function-attributes)
+- [Find Out More](#find-out-more)
+- [Benefits](#benefits)
+- [Under the Hood](#under-the-hood)
+- [Cheat Sheet](#cheat-sheet)
+
+## A Fake Function Framework for C
+fff is a micro-framework for creating fake C functions for tests. Because life
+is too short to spend time hand-writing fake functions for testing.
+
+## Running all tests
+
+### Linux / MacOS
+To run all the tests and sample apps, simply call `$ buildandtest`. This script
+will call down into CMake with the following:
+
+```shell
+cmake -B build -DFFF_GENERATE=ON -DFFF_UNIT_TESTING=ON
+cmake --build build
+ctest --test-dir build --output-on-failure
+```
+
+## Hello Fake World!
+
+Say you are testing an embedded user interface and you have a function that
+you want to create a fake for:
+
+```c
+// UI.c
+...
+void DISPLAY_init();
+...
+```
+
+Here's how you would define a fake function for this in your test suite:
+
+```c
+// test.c(pp)
+#include "fff.h"
+DEFINE_FFF_GLOBALS;
+FAKE_VOID_FUNC(DISPLAY_init);
+```
+
+And the unit test might look something like this:
+
+```c
+TEST_F(GreeterTests, init_initialises_display)
+{
+ UI_init();
+ ASSERT_EQ(DISPLAY_init_fake.call_count, 1);
+}
+```
+
+So what has happened here? The first thing to note is that the framework is
+header only, all you need to do to use it is download `fff.h` and include
+it in your test suite.
+
+The magic is in the `FAKE_VOID_FUNC`. This
+expands a macro that defines a function returning `void`
+which has zero arguments. It also defines a struct
+`"function_name"_fake` which contains all the information about the fake.
+For instance, `DISPLAY_init_fake.call_count`is incremented every time the faked
+function is called.
+
+Under the hood it generates a struct that looks like this:
+
+```c
+typedef struct DISPLAY_init_Fake {
+ unsigned int call_count;
+ unsigned int arg_history_len;
+ unsigned int arg_histories_dropped;
+ void(*custom_fake)();
+} DISPLAY_init_Fake;
+DISPLAY_init_Fake DISPLAY_init_fake;
+```
+
+## Capturing Arguments
+
+Ok, enough with the toy examples. What about faking functions with arguments?
+
+```c
+// UI.c
+...
+void DISPLAY_output(char * message);
+...
+```
+
+Here's how you would define a fake function for this in your test suite:
+
+```c
+FAKE_VOID_FUNC(DISPLAY_output, char *);
+```
+
+And the unit test might look something like this:
+
+```c
+TEST_F(UITests, write_line_outputs_lines_to_display)
+{
+ char msg[] = "helloworld";
+ UI_write_line(msg);
+ ASSERT_EQ(DISPLAY_output_fake.call_count, 1);
+ ASSERT_EQ(strncmp(DISPLAY_output_fake.arg0_val, msg, 26), 0);
+}
+```
+
+
+There is no more magic here, the `FAKE_VOID_FUNC` works as in the
+previous example. The number of arguments that the function takes is calculated,
+ and the macro arguments following the function name defines the argument
+type (a char pointer in this example).
+
+A variable is created for every argument in the form
+`"function_name"fake.argN_val`
+
+## Return Values
+
+When you want to define a fake function that returns a value, you should use the
+`FAKE_VALUE_FUNC` macro. For instance:
+
+```c
+// UI.c
+...
+unsigned int DISPLAY_get_line_capacity();
+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);
+```
+
+And the unit test might look something like this:
+
+```c
+TEST_F(UITests, when_empty_lines_write_line_doesnt_clear_screen)
+{
+ // given
+ DISPLAY_get_line_insert_index_fake.return_val = 1;
+ char msg[] = "helloworld";
+ // when
+ UI_write_line(msg);
+ // then
+ ASSERT_EQ(DISPLAY_clear_fake.call_count, 0);
+}
+```
+
+Of course you can mix and match these macros to define a value function with
+arguments, for instance to fake:
+
+```c
+double pow(double base, double exponent);
+```
+
+you would use a syntax like this:
+
+```c
+FAKE_VALUE_FUNC(double, pow, double, double);
+```
+## Resetting a Fake
+
+Good tests are isolated tests, so it is important to reset the fakes for each
+unit test. All the fakes have a reset function to reset their arguments and
+call counts. It is good practice is to call the reset function for all the
+fakes in the setup function of your test suite.
+
+```c
+void setup()
+{
+ // Register resets
+ RESET_FAKE(DISPLAY_init);
+ RESET_FAKE(DISPLAY_clear);
+ RESET_FAKE(DISPLAY_output_message);
+ RESET_FAKE(DISPLAY_get_line_capacity);
+ RESET_FAKE(DISPLAY_get_line_insert_index);
+}
+```
+
+You might want to define a macro to do this:
+
+```c
+/* 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();
+}
+```
+
+## Call History
+Say you want to test that a function calls functionA, then functionB, then
+functionA again, how would you do that? Well fff maintains a call
+history so that it is easy to assert these expectations.
+
+Here's how it works:
+
+```c
+FAKE_VOID_FUNC(voidfunc2, char, char);
+FAKE_VALUE_FUNC(long, longfunc0);
+
+TEST_F(FFFTestSuite, calls_in_correct_order)
+{
+ longfunc0();
+ voidfunc2();
+ longfunc0();
+
+ ASSERT_EQ(fff.call_history[0], (void *)longfunc0);
+ ASSERT_EQ(fff.call_history[1], (void *)voidfunc2);
+ ASSERT_EQ(fff.call_history[2], (void *)longfunc0);
+}
+```
+
+They are reset by calling `FFF_RESET_HISTORY();`
+
+## Default Argument History
+
+The framework will by default store the arguments for the last ten calls made
+to a fake function.
+
+```c
+TEST_F(FFFTestSuite, when_fake_func_called_then_arguments_captured_in_history)
+{
+ voidfunc2('g', 'h');
+ voidfunc2('i', 'j');
+ ASSERT_EQ('g', voidfunc2_fake.arg0_history[0]);
+ ASSERT_EQ('h', voidfunc2_fake.arg1_history[0]);
+ ASSERT_EQ('i', voidfunc2_fake.arg0_history[1]);
+ ASSERT_EQ('j', voidfunc2_fake.arg1_history[1]);
+}
+```
+
+There are two ways to find out if calls have been dropped. The first is to
+check the dropped histories counter:
+
+```c
+TEST_F(FFFTestSuite, when_fake_func_called_max_times_plus_one_then_one_argument_history_dropped)
+{
+ int i;
+ for(i = 0; i < 10; i++)
+ {
+ voidfunc2('1'+i, '2'+i);
+ }
+ voidfunc2('1', '2');
+ ASSERT_EQ(1u, voidfunc2_fake.arg_histories_dropped);
+}
+```
+
+The other is to check if the call count is greater than the history size:
+
+```c
+ASSERT(voidfunc2_fake.arg_history_len < voidfunc2_fake.call_count);
+```
+
+The argument histories for a fake function are reset when the `RESET_FAKE`
+function is called
+
+## User Defined Argument History
+
+If you wish to control how many calls to capture for argument history you can
+override the default by defining it before include the `fff.h` like this:
+
+```c
+// Want to keep the argument history for 13 calls
+#define FFF_ARG_HISTORY_LEN 13
+// Want to keep the call sequence history for 17 function calls
+#define FFF_CALL_HISTORY_LEN 17
+
+#include "../fff.h"
+```
+
+## Function Return Value Sequences
+
+Often in testing we would like to test the behaviour of sequence of function call
+events. One way to do this with fff is to specify a sequence of return values
+with for the fake function. It is probably easier to describe with an example:
+
+```c
+// faking "long longfunc();"
+FAKE_VALUE_FUNC(long, longfunc0);
+
+TEST_F(FFFTestSuite, return_value_sequences_exhausted)
+{
+ long myReturnVals[3] = { 3, 7, 9 };
+ SET_RETURN_SEQ(longfunc0, myReturnVals, 3);
+ ASSERT_EQ(myReturnVals[0], longfunc0());
+ ASSERT_EQ(myReturnVals[1], longfunc0());
+ ASSERT_EQ(myReturnVals[2], longfunc0());
+ ASSERT_EQ(myReturnVals[2], longfunc0());
+ ASSERT_EQ(myReturnVals[2], longfunc0());
+}
+```
+
+By specifying a return value sequence using the `SET_RETURN_SEQ` macro,
+the fake will return the values given in the parameter array in sequence. When
+the end of the sequence is reached the fake will continue to return the last
+value in the sequence indefinitely.
+
+## Custom Return Value Delegate
+
+You can specify your own function to provide the return value for the fake. This
+is done by setting the `custom_fake` member of the fake. Here's an example:
+
+```c
+#define MEANING_OF_LIFE 42
+long my_custom_value_fake(void)
+{
+ return MEANING_OF_LIFE;
+}
+TEST_F(FFFTestSuite, when_value_custom_fake_called_THEN_it_returns_custom_return_value)
+{
+ longfunc0_fake.custom_fake = my_custom_value_fake;
+ long retval = longfunc0();
+ ASSERT_EQ(MEANING_OF_LIFE, retval);
+}
+```
+
+### Custom Return Value Delegate Sequences
+
+Say you have a function with an out parameter, and you want it to have a different behaviour
+on the first three calls, for example: set the value 'x' to the out parameter on the first call,
+the value 'y' to the out parameter on the second call, and the value 'z' to the out parameter
+on the third call. You can specify a sequence of custom functions to a non-variadic function
+using the `SET_CUSTOM_FAKE_SEQ` macro. Here's an example:
+
+```c
+void voidfunc1outparam_custom_fake1(char *a)
+{
+ *a = 'x';
+}
+
+void voidfunc1outparam_custom_fake2(char *a)
+{
+ *a = 'y';
+}
+
+void voidfunc1outparam_custom_fake3(char *a)
+{
+ *a = 'z';
+}
+
+TEST_F(FFFTestSuite, custom_fake_sequence_not_exausthed)
+{
+ void (*custom_fakes[])(char *) = {voidfunc1outparam_custom_fake1,
+ voidfunc1outparam_custom_fake2,
+ voidfunc1outparam_custom_fake3};
+ char a = 'a';
+
+ SET_CUSTOM_FAKE_SEQ(voidfunc1outparam, custom_fakes, 3);
+
+ voidfunc1outparam(&a);
+ ASSERT_EQ('x', a);
+ voidfunc1outparam(&a);
+ ASSERT_EQ('y', a);
+ voidfunc1outparam(&a);
+ ASSERT_EQ('z', a);
+}
+```
+
+The fake will call your custom functions in the order specified by the `SET_CUSTOM_FAKE_SEQ`
+macro. When the last custom fake is reached the fake will keep calling the last custom
+fake in the sequence. This macro works much like the `SET_RETURN_SEQ` macro.
+
+## Return Value History
+
+Say you have two functions f1 and f2. f2 must be called to release some resource
+allocated by f1, but only in the cases where f1 returns zero. f1 could be
+pthread_mutex_trylock and f2 could be pthread_mutex_unlock. fff will
+save the history of returned values so this can be easily checked, even when
+you use a sequence of custom fakes. Here's a simple example:
+
+ TEST_F(FFFTestSuite, return_value_sequence_saved_in_history)
+ {
+ long myReturnVals[3] = { 3, 7, 9 };
+ SET_RETURN_SEQ(longfunc0, myReturnVals, 3);
+ longfunc0();
+ longfunc0();
+ longfunc0();
+ ASSERT_EQ(myReturnVals[0], longfunc0_fake.return_val_history[0]);
+ ASSERT_EQ(myReturnVals[1], longfunc0_fake.return_val_history[1]);
+ ASSERT_EQ(myReturnVals[2], longfunc0_fake.return_val_history[2]);
+ }
+
+You access the returned values in the `return_val_history` field.
+
+## Variadic Functions
+
+You can fake variadic functions using the macros `FAKE_VALUE_FUNC_VARARG`
+and `FAKE_VOID_FUNC_VARARG`. For instance:
+
+ FAKE_VALUE_FUNC_VARARG(int, fprintf, FILE *, const char*, ...);
+
+In order to access the variadic parameters from a custom fake function, declare a
+`va_list` parameter. For instance, a custom fake for `fprintf()`
+could call the real `fprintf()` like this:
+
+ int fprintf_custom(FILE *stream, const char *format, va_list ap) {
+ if (fprintf0_fake.return_val < 0) // should we fail?
+ return fprintf0_fake.return_val;
+ return vfprintf(stream, format, ap);
+ }
+
+Just like [return value delegates](#custom-return-value-delegate-sequences), you can also specify sequences for variadic functions using `SET_CUSTOM_FAKE_SEQ`.
+See the test files for examples.
+
+## Common Questions
+
+### How do I specify calling conventions for my fake functions?
+
+fff has a limited capability for enabling specification of Microsoft's Visual C/C++ calling conventions, but this support must be enabled when generating fff's header file `fff.h`.
+
+```bash
+ruby fakegen.rb --with-calling-conventions > fff.h
+```
+
+By enabling this support, all of fff's fake function scaffolding will necessitate the specification of a calling convention, e.g. `__cdecl` for each VALUE or VOID fake.
+
+Here are some basic examples: take note that the placement of the calling convention being specified is different depending on whether the fake is a VOID or VALUE function.
+
+```c
+FAKE_VOID_FUNC(__cdecl, voidfunc1, int);
+FAKE_VALUE_FUNC(long, __cdecl, longfunc0);
+```
+
+### How do I fake a function that returns a value by reference?
+
+The basic mechanism that fff provides you in this case is the custom_fake field described in the *Custom Return Value Delegate* example above.
+
+You need to create a custom function (e.g. getTime_custom_fake) to produce the output optionally by use of a helper variable (e.g. getTime_custom_now) to retrieve that output from. Then some creativity to tie it all together. The most important part (IMHO) is to keep your test case readable and maintainable.
+
+In case your project uses a C compiler that supports nested functions (e.g. GCC), or when using C++ lambdas, you can even combine all this in a single unit test function so you can easily oversee all details of the test.
+
+```c
+#include <functional>
+
+/* Configure FFF to use std::function, which enables capturing lambdas */
+#define CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN, FUNCNAME, ...) \
+ std::function<RETURN (__VA_ARGS__)> FUNCNAME
+
+#include "fff.h"
+
+/* The time structure */
+typedef struct {
+ int hour, min;
+} Time;
+
+/* Our fake function */
+FAKE_VOID_FUNC(getTime, Time*);
+
+/* A test using the getTime fake function */
+TEST_F(FFFTestSuite, when_value_custom_fake_called_THEN_it_returns_custom_output)
+{
+ Time t;
+ Time getTime_custom_now = {
+ .hour = 13,
+ .min = 05,
+ };
+ getTime_fake.custom_fake = [getTime_custom_now](Time *now) {
+ *now = getTime_custom_now;
+ };
+
+ /* when getTime is called */
+ getTime(&t);
+
+ /* then the specific time must be produced */
+ ASSERT_EQ(t.hour, 13);
+ ASSERT_EQ(t.min, 05);
+}
+```
+
+### How do I fake a function with a function pointer parameter?
+
+Using fff to stub functions that have function pointer parameter can cause problems when trying to stub them. Presented here is an example how to deal with this situation.
+
+If you need to stub a function that has a function pointer parameter, e.g. something like:
+
+```c
+/* timer.h */
+typedef int timer_handle;
+extern int timer_start(timer_handle handle, long delay, void (*cb_function) (int arg), int arg);
+```
+
+Then creating a fake like below will horribly fail when trying to compile because the fff macro will internally expand into an illegal variable ```int (*)(int) arg2_val```.
+
+```c
+/* The fake, attempt one */
+FAKE_VALUE_FUNC(int,
+ timer_start,
+ timer_handle,
+ long,
+ void (*) (int argument),
+ int);
+```
+
+The solution to this problem is to create a bridging type that needs only to be visible in the unit tester. The fake will use that intermediate type. This way the compiler will not complain because the types match.
+
+```c
+/* Additional type needed to be able to use callback in fff */
+typedef void (*timer_cb) (int argument);
+
+/* The fake, attempt two */
+FAKE_VALUE_FUNC(int,
+ timer_start,
+ timer_handle,
+ long,
+ timer_cb,
+ int);
+```
+
+Here are some ideas how to create a test case with callbacks.
+
+```c
+/* Unit test */
+TEST_F(FFFTestSuite, test_fake_with_function_pointer)
+{
+ int cb_timeout_called = 0;
+ int result = 0;
+
+ void cb_timeout(int argument)
+ {
+ cb_timeout_called++;
+ }
+
+ int timer_start_custom_fake(timer_handle handle,
+ long delay,
+ void (*cb_function) (int arg),
+ int arg)
+ {
+ if (cb_function) cb_function(arg);
+ return timer_start_fake.return_val;
+ }
+
+ /* given the custom fake for timer_start */
+ timer_start_fake.return_val = 33;
+ timer_start_fake.custom_fake = timer_start_custom_fake;
+
+ /* when timer_start is called
+ * (actually you would call your own function-under-test
+ * that would then call the fake function)
+ */
+ result = timer_start(10, 100, cb_timeout, 55);
+
+ /* then the timer_start fake must have been called correctly */
+ ASSERT_EQ(result, 33);
+ ASSERT_EQ(timer_start_fake.call_count, 1);
+ ASSERT_EQ(timer_start_fake.arg0_val, 10);
+ ASSERT_EQ(timer_start_fake.arg1_val, 100);
+ ASSERT_EQ(timer_start_fake.arg2_val, cb_timeout); /* callback provided by unit tester */
+ ASSERT_EQ(timer_start_fake.arg3_val, 55);
+
+ /* and ofcourse our custom fake correctly calls the registered callback */
+ ASSERT_EQ(cb_timeout_called, 1);
+}
+```
+
+### How do I reuse a fake across multiple test-suites?
+
+fff functions like `FAKE_VALUE_FUNC` will perform both the declaration AND the definition of the fake function and the corresponding data structs. This cannot be placed in a header, since it will lead to multiple definitions of the fake functions.
+
+The solution is to separate declaration and definition of the fakes, and place the declaration into a public header file, and the definition into a private source file.
+
+Here is an example of how it could be done:
+
+```c
+/* Public header file */
+#include "fff.h"
+
+DECLARE_FAKE_VALUE_FUNC(int, value_function, int, int);
+DECLARE_FAKE_VOID_FUNC(void_function, int, int);
+DECLARE_FAKE_VALUE_FUNC_VARARG(int, value_function_vargs, const char *, int, ...);
+DECLARE_FAKE_VOID_FUNC_VARARG(void_function_vargs, const char *, int, ...);
+
+
+/* Private source file file */
+#include "public_header.h"
+
+DEFINE_FAKE_VALUE_FUNC(int, value_function, int, int);
+DEFINE_FAKE_VOID_FUNC(void_function, int, int);
+DEFINE_FAKE_VALUE_FUNC_VARARG(int, value_function_vargs, const char *, int, ...);
+DEFINE_FAKE_VOID_FUNC_VARARG(void_function_vargs, const char *, int, ...);
+
+```
+
+## Specifying GCC Function Attributes
+
+You can specify GCC function attributes for your fakes using the `FFF_GCC_FUNCTION_ATTRIBUTES` directive.
+
+### Weak Functions
+
+One usful attribute is the _weak_ attribute that marks a function such that it can be overridden by a non-weak variant at link time. Using weak functions in combination with fff can help simplify your testing approach.
+
+For example:
+* Define a library of fake functions, e.g. libfake.a.
+* Link a binary (you might have many) that defines a subset of real variants of the fake functions to the aforementioned fake library.
+* This has the benefit of allowing a binary to selectively use a subset of the required fake functions while testing the real variants without the need for many different make targets.
+
+You can mark all fakes with the weak attribute like so:
+```
+#define FFF_GCC_FUNCTION_ATTRIBUTES __attribute__((weak))
+#include "fff.h"
+```
+
+See the example project that demonstrates the above approach: _./examples/weak_linking_.
+
+## Find Out More
+
+Look under the examples directory for full length examples in both C and C++.
+There is also a test suite for the framework under the test directory.
+
+-------------------------
+
+## Benefits
+So whats the point?
+
+ * To make it easy to create fake functions for testing C code.
+ * It is simple - just include a header file and you are good to go.
+ * To work in both C and C++ test environments
+
+
+## Under the Hood
+ * The fff.h header file is generated by a ruby script
+ * There are tests under _./test_
+ * There is an example for testing an embedded UI and a hardware driver under _./examples_
+ * There is an example of weak_linking under _./examples_
+
+
+## Cheat Sheet
+| Macro | Description | Example |
+|-------|-------------|---------|
+| FAKE_VOID_FUNC(fn [,arg_types*]); | Define a fake function named fn returning void with n arguments | FAKE_VOID_FUNC(DISPLAY_output_message, const char*); |
+| FAKE_VALUE_FUNC(return_type, fn [,arg_types*]); | Define a fake function returning a value with type return_type taking n arguments | FAKE_VALUE_FUNC(int, DISPLAY_get_line_insert_index); |
+| FAKE_VOID_FUNC_VARARG(fn [,arg_types*], ...); | Define a fake variadic function returning void with type return_type taking n arguments and n variadic arguments | FAKE_VOID_FUNC_VARARG(fn, const char*, ...) |
+| FAKE_VALUE_FUNC_VARARG(return_type, fn [,arg_types*], ...); | Define a fake variadic function returning a value with type return_type taking n arguments and n variadic arguments | FAKE_VALUE_FUNC_VARARG(int, fprintf, FILE*, const char*, ...) |
+| RESET_FAKE(fn); | Reset the state of fake function called fn | RESET_FAKE(DISPLAY_init); |
diff --git a/deps/fff/buildandtest b/deps/fff/buildandtest
new file mode 100755
index 0000000..83ce4c3
--- /dev/null
+++ b/deps/fff/buildandtest
@@ -0,0 +1,15 @@
+#!/bin/bash
+set -e
+
+# Clear the environment
+rm -fr build fff.h
+mkdir build
+
+# Configure the build
+cmake -B build -DFFF_GENERATE=ON -DFFF_UNIT_TESTING=ON || exit -1
+
+# Build all targets
+cmake --build build || exit -1
+
+# Run all tests
+ctest --test-dir build --output-on-failure
diff --git a/deps/fff/examples/CMakeLists.txt b/deps/fff/examples/CMakeLists.txt
new file mode 100644
index 0000000..58a3d09
--- /dev/null
+++ b/deps/fff/examples/CMakeLists.txt
@@ -0,0 +1,6 @@
+# Copyright 2022 Google LLC
+# SPDX-License-Identifier: Apache-2.0
+
+add_subdirectory(driver_testing)
+add_subdirectory(embedded_ui)
+add_subdirectory(weak_linking)
diff --git a/deps/fff/examples/driver_testing/CMakeLists.txt b/deps/fff/examples/driver_testing/CMakeLists.txt
new file mode 100644
index 0000000..3580349
--- /dev/null
+++ b/deps/fff/examples/driver_testing/CMakeLists.txt
@@ -0,0 +1,31 @@
+# Copyright 2022 Google LLC
+# SPDX-License-Identifier: Apache-2.0
+
+# Create the driver test binary
+add_executable(driver_test
+ src/driver.c
+ src/driver.test.cpp
+)
+target_include_directories(driver_test PRIVATE include)
+target_link_libraries(driver_test PRIVATE GTest::gtest_main fff)
+target_compile_definitions(driver_test PUBLIC TEST_USER_OWN_TR1_TUPLE=1 TESTING)
+
+# Create the driver fff test binary
+add_executable(driver_fff_test
+ src/driver.c
+ src/driver.test.fff.cpp
+)
+target_include_directories(driver_fff_test PRIVATE include)
+target_link_libraries(driver_fff_test PRIVATE GTest::gtest_main fff)
+target_compile_definitions(driver_fff_test PUBLIC TEST_USER_OWN_TR1_TUPLE=1 TESTING)
+
+# Add tests to ctest
+add_test(
+ NAME driver_test
+ COMMAND $<TARGET_FILE:driver_test>
+)
+
+add_test(
+ NAME driver_fff_test
+ COMMAND $<TARGET_FILE:driver_fff_test>
+)
diff --git a/deps/fff/examples/driver_testing/include/driver.h b/deps/fff/examples/driver_testing/include/driver.h
new file mode 100644
index 0000000..b7406d4
--- /dev/null
+++ b/deps/fff/examples/driver_testing/include/driver.h
@@ -0,0 +1,11 @@
+
+#ifndef DRIVER
+#define DRIVER
+
+#include <stdint.h>
+
+void driver_write(uint8_t val);
+uint8_t driver_read();
+void driver_init_device();
+
+#endif /*include guard*/
diff --git a/deps/fff/examples/driver_testing/include/hardware_abstraction.h b/deps/fff/examples/driver_testing/include/hardware_abstraction.h
new file mode 100644
index 0000000..affa92e
--- /dev/null
+++ b/deps/fff/examples/driver_testing/include/hardware_abstraction.h
@@ -0,0 +1,15 @@
+#ifndef HARDWARE_ABSTRACTION
+#define HARDWARE_ABSTRACTION
+
+#include <stdint.h>
+
+#ifndef TESTING
+#define IO_MEM_RD8(ADDR) (*((volatile uint8_t *)(ADDR)))
+#define IO_MEM_WR8(ADDR, VAL_8) (*((volatile uint8_t *)(ADDR)) = (VAL_8))
+#else
+/* In testing use fake functions to record calls to IO memory */
+uint8_t IO_MEM_RD8(uint32_t reg);
+void IO_MEM_WR8(uint32_t reg, uint8_t val);
+#endif
+
+#endif /* Include guard */
diff --git a/deps/fff/examples/driver_testing/include/registers.h b/deps/fff/examples/driver_testing/include/registers.h
new file mode 100644
index 0000000..5c9e5a9
--- /dev/null
+++ b/deps/fff/examples/driver_testing/include/registers.h
@@ -0,0 +1,13 @@
+#ifndef REGISTERS_H_
+#define REGISTERS_H_
+
+#define DRIVER_OUTPUT_REGISTER 0xFFAAu
+#define DRIVER_INPUT_REGISTER 0XFFABu
+#define DRIVER_PERIPHERAL_ENABLE_REG 0xFFACu
+#define DRIVER_PERIPHERAL_INITIALIZE_REG 0xFFACu
+
+#define HARDWARE_VERSION_REGISTER 0xFF00u
+#define HARDWARE_REV_A 0x00u
+#define HARDWARE_REV_B 0x01u
+
+#endif /* REGISTERS_H_ */
diff --git a/deps/fff/examples/driver_testing/src/driver.c b/deps/fff/examples/driver_testing/src/driver.c
new file mode 100644
index 0000000..9454ba6
--- /dev/null
+++ b/deps/fff/examples/driver_testing/src/driver.c
@@ -0,0 +1,24 @@
+
+
+#include "hardware_abstraction.h"
+#include "registers.h"
+
+void driver_write(uint8_t val)
+{
+ IO_MEM_WR8(DRIVER_OUTPUT_REGISTER, val);
+}
+
+uint8_t driver_read()
+{
+ return IO_MEM_RD8(DRIVER_INPUT_REGISTER);
+}
+
+void driver_init_device()
+{
+ uint8_t hw_version = IO_MEM_RD8(HARDWARE_VERSION_REGISTER);
+ if(HARDWARE_REV_B == hw_version)
+ {
+ IO_MEM_WR8(DRIVER_PERIPHERAL_ENABLE_REG, 1);
+ }
+ IO_MEM_WR8(DRIVER_PERIPHERAL_INITIALIZE_REG, 1);
+}
diff --git a/deps/fff/examples/driver_testing/src/driver.test.cpp b/deps/fff/examples/driver_testing/src/driver.test.cpp
new file mode 100644
index 0000000..cd80bb3
--- /dev/null
+++ b/deps/fff/examples/driver_testing/src/driver.test.cpp
@@ -0,0 +1,50 @@
+extern "C"
+{
+#include "driver.h"
+#include "registers.h"
+}
+#include "../../../fff.h"
+#include <gtest/gtest.h>
+
+
+extern "C"
+{
+ static uint8_t readVal;
+ static int readCalled;
+ static uint32_t readRegister;
+ uint8_t IO_MEM_RD8(uint32_t reg)
+ {
+ readRegister = reg;
+ readCalled++;
+ return readVal;
+ }
+
+ static uint32_t writeRegister;
+ static uint8_t writeVal;
+ static int writeCalled;
+ void IO_MEM_WR8(uint32_t reg, uint8_t val)
+ {
+ writeRegister = reg;
+ writeVal = val;
+ writeCalled++;
+ }
+}
+
+TEST(Driver, When_writing_Then_writes_data_to_DRIVER_OUTPUT_REGISTER)
+{
+ driver_write(0x34);
+ ASSERT_EQ(1u, writeCalled);
+ ASSERT_EQ(0x34u, writeVal);
+ ASSERT_EQ(DRIVER_OUTPUT_REGISTER, writeRegister);
+}
+
+
+TEST(Driver, When_reading_data_Then_reads_from_DRIVER_INPUT_REGISTER)
+{
+ readVal = 0x55;
+ uint8_t returnedValue = driver_read();
+ ASSERT_EQ(1u, readCalled);
+ ASSERT_EQ(0x55u, returnedValue);
+ ASSERT_EQ(readRegister, DRIVER_INPUT_REGISTER);
+}
+
diff --git a/deps/fff/examples/driver_testing/src/driver.test.fff.cpp b/deps/fff/examples/driver_testing/src/driver.test.fff.cpp
new file mode 100644
index 0000000..56f6192
--- /dev/null
+++ b/deps/fff/examples/driver_testing/src/driver.test.fff.cpp
@@ -0,0 +1,63 @@
+extern "C"{
+ #include "driver.h"
+ #include "registers.h"
+ #include "hardware_abstraction.h"
+}
+#include "fff.h"
+#include <gtest/gtest.h>
+
+DEFINE_FFF_GLOBALS;
+
+FAKE_VOID_FUNC(IO_MEM_WR8, uint32_t, uint8_t);
+FAKE_VALUE_FUNC(uint8_t, IO_MEM_RD8, uint32_t);
+
+class DriverTestFFF : public testing::Test
+{
+public:
+ void SetUp()
+ {
+ RESET_FAKE(IO_MEM_WR8);
+ RESET_FAKE(IO_MEM_RD8);
+ FFF_RESET_HISTORY();
+ }
+
+};
+
+TEST_F(DriverTestFFF, When_writing_Then_writes_data_to_DRIVER_OUTPUT_REGISTER)
+{
+ driver_write(0x34);
+ ASSERT_EQ(1u, IO_MEM_WR8_fake.call_count);
+ ASSERT_EQ(0x34u, IO_MEM_WR8_fake.arg1_val);
+ ASSERT_EQ(DRIVER_OUTPUT_REGISTER, IO_MEM_WR8_fake.arg0_val);
+}
+
+
+TEST_F(DriverTestFFF, When_reading_data_Then_reads_from_DRIVER_INPUT_REGISTER)
+{
+ IO_MEM_RD8_fake.return_val = 0x55;
+ uint8_t returnedValue = driver_read();
+ ASSERT_EQ(1u, IO_MEM_RD8_fake.call_count);
+ ASSERT_EQ(0x55u, returnedValue);
+ ASSERT_EQ(IO_MEM_RD8_fake.arg0_val, DRIVER_INPUT_REGISTER);
+}
+
+TEST_F(DriverTestFFF, Given_revisionB_device_When_initialize_Then_enable_peripheral_before_initializing_it)
+{
+ // Given
+ IO_MEM_RD8_fake.return_val = HARDWARE_REV_B;
+ // When
+ driver_init_device();
+
+ //Then
+ // Gets the hardware revision
+ ASSERT_EQ((void*) IO_MEM_RD8, fff.call_history[0]);
+ ASSERT_EQ(HARDWARE_VERSION_REGISTER, IO_MEM_RD8_fake.arg0_history[0]);
+ // Enables Peripheral
+ ASSERT_EQ((void*) IO_MEM_WR8, fff.call_history[1]);
+ ASSERT_EQ(DRIVER_PERIPHERAL_ENABLE_REG, IO_MEM_WR8_fake.arg0_history[0]);
+ ASSERT_EQ(1, IO_MEM_WR8_fake.arg1_history[0]);
+ // Initializes Peripheral
+ ASSERT_EQ((void*) IO_MEM_WR8, fff.call_history[2]);
+ ASSERT_EQ(DRIVER_PERIPHERAL_INITIALIZE_REG,IO_MEM_WR8_fake.arg0_history[1]);
+ ASSERT_EQ(1, IO_MEM_WR8_fake.arg1_history[1]);
+}
diff --git a/deps/fff/examples/embedded_ui/CMakeLists.txt b/deps/fff/examples/embedded_ui/CMakeLists.txt
new file mode 100644
index 0000000..d2f3015
--- /dev/null
+++ b/deps/fff/examples/embedded_ui/CMakeLists.txt
@@ -0,0 +1,23 @@
+# Copyright 2022 Google LLC
+# SPDX-License-Identifier: Apache-2.0
+
+# Create the ui_test_ansic test binary
+add_executable(ui_test_ansic src/UI_test_ansic.c src/UI.c)
+target_include_directories(ui_test_ansic PRIVATE include)
+target_link_libraries(ui_test_ansic PRIVATE fff)
+
+# Create the ui_test_cpp test binary
+add_executable(ui_test_cpp src/UI_test_cpp.cpp src/UI.c)
+target_include_directories(ui_test_cpp PRIVATE include)
+target_link_libraries(ui_test_cpp PRIVATE GTest::gtest_main fff)
+
+# Add tests to ctest
+add_test(
+ NAME ui_test_ansic
+ COMMAND $<TARGET_FILE:ui_test_ansic>
+)
+
+add_test(
+ NAME ui_test_cpp
+ COMMAND $<TARGET_FILE:ui_test_cpp>
+)
diff --git a/deps/fff/examples/embedded_ui/Kata.txt b/deps/fff/examples/embedded_ui/Kata.txt
new file mode 100644
index 0000000..b466c36
--- /dev/null
+++ b/deps/fff/examples/embedded_ui/Kata.txt
@@ -0,0 +1,25 @@
+
+Problem Definition
+------------------
+The task is to write a user interface module for an embedded device.
+
+Interrupts:
+ * The user interface is responsible for initializing the display.
+ * The user interface will register an interrupt handler for GPIO input 2 (a
+ push button).
+ * It will be possible to register a callback function for button presses.
+ * When there is no callback function set the irq handler will increment a
+ missed irq counter.
+ * When the interrupt occurs the handler will schedule or execute the button
+ press callback if there is one registered.
+Output:
+ * Tasks can write messages to the user interface to be output on the display.
+ * The display is line oriented; when the last line of the display is written
+ the user interface is responsible for clearing the display.
+ * The display is 26 characters wide. Any string longer than that must be
+ truncated before being sent to the display. The string must be null
+ terminated and thus maximum 27 bytes long.
+
+ * BONUS: Have the display be scrolling, i.e. when the display is full, the
+ previous lines must be shifted up one and the new line written in the bottom
+ line.
diff --git a/deps/fff/examples/embedded_ui/include/DISPLAY.h b/deps/fff/examples/embedded_ui/include/DISPLAY.h
new file mode 100644
index 0000000..45ca62e
--- /dev/null
+++ b/deps/fff/examples/embedded_ui/include/DISPLAY.h
@@ -0,0 +1,17 @@
+/*
+ * DISPLAY.h
+ *
+ * Created on: Dec 17, 2010
+ * Author: mlong
+ */
+
+#ifndef DISPLAY_H_
+#define DISPLAY_H_
+
+void DISPLAY_init();
+void DISPLAY_clear();
+unsigned int DISPLAY_get_line_capacity();
+unsigned int DISPLAY_get_line_insert_index();
+void DISPLAY_output(char * message);
+
+#endif /* DISPLAY_H_ */
diff --git a/deps/fff/examples/embedded_ui/include/SYSTEM.h b/deps/fff/examples/embedded_ui/include/SYSTEM.h
new file mode 100644
index 0000000..080144f
--- /dev/null
+++ b/deps/fff/examples/embedded_ui/include/SYSTEM.h
@@ -0,0 +1,21 @@
+/*
+ * DISPLAY.h
+ *
+ * Created on: Dec 17, 2010
+ * Author: mlong
+ */
+
+#ifndef SYSTEM_H_
+#define SYSTEM_H_
+
+typedef void (*irq_func_t)(void);
+
+#define IRQ_GPIO_0 0x70
+#define IRQ_GPIO_1 0x71
+#define IRQ_GPIO_2 0x72
+#define IRQ_GPIO_3 0x73
+
+
+void SYSTEM_register_irq(irq_func_t, unsigned int irq);
+
+#endif /* SYSTEM_H_ */
diff --git a/deps/fff/examples/embedded_ui/include/UI.h b/deps/fff/examples/embedded_ui/include/UI.h
new file mode 100644
index 0000000..8a3fb5c
--- /dev/null
+++ b/deps/fff/examples/embedded_ui/include/UI.h
@@ -0,0 +1,12 @@
+#ifndef UI_H_
+#define UI_H_
+
+typedef void (*button_cbk_t)(void);
+
+void UI_init();
+unsigned int UI_get_missed_irqs();
+void UI_button_irq_handler();
+void UI_register_button_cbk(button_cbk_t cbk);
+void UI_write_line(char *line);
+
+#endif /* UI_H_ */
diff --git a/deps/fff/examples/embedded_ui/src/UI.c b/deps/fff/examples/embedded_ui/src/UI.c
new file mode 100644
index 0000000..8ce996e
--- /dev/null
+++ b/deps/fff/examples/embedded_ui/src/UI.c
@@ -0,0 +1,48 @@
+#include "UI.h"
+#include "DISPLAY.h"
+#include "SYSTEM.h"
+#include <string.h>
+
+static unsigned int missed_irq_counter;
+button_cbk_t button_cbk;
+
+
+void UI_init()
+{
+ DISPLAY_init();
+ SYSTEM_register_irq(UI_button_irq_handler, IRQ_GPIO_2);
+ button_cbk = 0;
+ missed_irq_counter = 0;
+}
+
+unsigned int UI_get_missed_irqs()
+{
+ return missed_irq_counter;
+}
+
+void UI_button_irq_handler()
+{
+ if(button_cbk)
+ {
+ button_cbk();
+ }
+ else
+ {
+ missed_irq_counter++;
+ }
+}
+
+void UI_register_button_cbk(button_cbk_t cbk)
+{
+ button_cbk = cbk;
+}
+
+void UI_write_line(char *line)
+{
+ static char out[27];
+ strncpy(out, line, 26);
+ out[26] = '\0';
+ if(DISPLAY_get_line_capacity() == DISPLAY_get_line_insert_index())
+ DISPLAY_clear();
+ DISPLAY_output(out);
+}
diff --git a/deps/fff/examples/embedded_ui/src/UI_test_ansic.c b/deps/fff/examples/embedded_ui/src/UI_test_ansic.c
new file mode 100644
index 0000000..3e3fce9
--- /dev/null
+++ b/deps/fff/examples/embedded_ui/src/UI_test_ansic.c
@@ -0,0 +1,183 @@
+#include "UI.h"
+#include "fff.h"
+#include "SYSTEM.h"
+#include "DISPLAY.h"
+
+#include <assert.h>
+#include <stdio.h>
+#include <string.h>
+
+/* Test Framework :-) */
+void setup();
+#define TEST_F(SUITE, NAME) void NAME()
+#define RUN_TEST(SUITE, TESTNAME) printf(" Running %s.%s: \n", #SUITE, #TESTNAME); setup(); TESTNAME(); printf(" SUCCESS\n");
+
+DEFINE_FFF_GLOBALS;
+
+/* SYSTEM.h */
+FAKE_VOID_FUNC2(SYSTEM_register_irq, irq_func_t, unsigned int);
+/* DISPLAY.h */
+FAKE_VOID_FUNC(DISPLAY_init);
+FAKE_VOID_FUNC(DISPLAY_clear);
+FAKE_VOID_FUNC(DISPLAY_output, char *);
+FAKE_VALUE_FUNC(unsigned int, DISPLAY_get_line_capacity);
+FAKE_VALUE_FUNC(unsigned int, DISPLAY_get_line_insert_index);
+
+FAKE_VOID_FUNC0(button_press_cbk);
+
+
+
+/* Initialializers called for every test */
+void setup()
+{
+ RESET_FAKE(SYSTEM_register_irq);
+
+ RESET_FAKE(DISPLAY_init)
+ RESET_FAKE(DISPLAY_clear)
+ RESET_FAKE(DISPLAY_output)
+ RESET_FAKE(DISPLAY_get_line_capacity)
+ RESET_FAKE(DISPLAY_get_line_insert_index);
+
+ RESET_FAKE(button_press_cbk);
+
+ FFF_RESET_HISTORY();
+
+ DISPLAY_get_line_capacity_fake.return_val = 2;
+}
+
+/* Tests go here */
+TEST_F(UITests, init_will_initialise_display)
+{
+ UI_init();
+ assert(DISPLAY_init_fake.call_count == 1);
+}
+
+TEST_F(UITests, init_will_register_interrupt_gpio2)
+{
+ UI_init();
+ assert(SYSTEM_register_irq_fake.call_count == 1);
+ assert(SYSTEM_register_irq_fake.arg0_val == UI_button_irq_handler);
+ assert(SYSTEM_register_irq_fake.arg1_val == IRQ_GPIO_2);
+}
+
+TEST_F(UITests, when_no_irq_then_missed_irq_counter_zero)
+{
+ assert(UI_get_missed_irqs() == 0);
+}
+
+TEST_F(UITests, when_one_irq_and_no_handler_then_missed_irq_counter_one)
+{
+ UI_button_irq_handler();
+ assert(UI_get_missed_irqs() == 1);
+}
+
+TEST_F(UITests, when_one_irq_and_valid_callback_then_missed_irq_counter_zero)
+{
+ UI_init();
+ UI_register_button_cbk(button_press_cbk);
+ UI_button_irq_handler();
+ assert(UI_get_missed_irqs() == 0);
+}
+
+TEST_F(UITests, when_one_irq_and_valid_callback_then_callback_called)
+{
+ UI_register_button_cbk(button_press_cbk);
+ UI_button_irq_handler();
+ assert(button_press_cbk_fake.call_count == 1);
+}
+
+TEST_F(UITests, write_line_outputs_lines_to_display)
+{
+ char msg[] = "helloworld";
+ UI_write_line(msg);
+ assert(DISPLAY_output_fake.call_count == 1);
+ assert(strncmp(DISPLAY_output_fake.arg0_val, msg, 26) == 0);
+}
+
+TEST_F(UITests, when_no_empty_lines_write_line_clears_screen_and_outputs_lines_to_display)
+{
+ DISPLAY_get_line_insert_index_fake.return_val = 2;
+ char msg[] = "helloworld";
+
+ UI_write_line(msg);
+
+ assert(DISPLAY_clear_fake.call_count == 1);
+ assert(DISPLAY_output_fake.call_count == 1);
+ // Check the order of the calls: Don't care about the first two:
+ // DISPLAY_get_line_capacity and DISPLAY_get_line_insert_index
+ assert(fff.call_history_idx == 4);
+ assert(fff.call_history[2] == (void *) DISPLAY_clear);
+ assert(fff.call_history[3] == (void *) DISPLAY_output);
+}
+
+TEST_F(UITests, when_empty_lines_write_line_doesnt_clear_screen)
+{
+ // given
+ DISPLAY_get_line_insert_index_fake.return_val = 1;
+ char msg[] = "helloworld";
+ // when
+ UI_write_line(msg);
+ // then
+ assert(DISPLAY_clear_fake.call_count == 0);
+}
+
+TEST_F(UITests, when_string_longer_than_26_then_truncated_string_output)
+{
+ // given
+ char input[] = "abcdefghijklmnopqrstuvwxyz0123456789";
+ char expected[] = "abcdefghijklmnopqrstuvwxyz";
+ // when
+ UI_write_line(input);
+ // then
+ assert(strncmp(expected, DISPLAY_output_fake.arg0_val, 37) == 0);
+}
+
+TEST_F(UITests, when_outputting_to_full_display_then_previous_inserted)
+{
+ // given
+ DISPLAY_get_line_insert_index_fake.return_val = 1;
+ char oldest[] = "oldest";
+ char newest[] = "newest";
+ // when
+ UI_write_line(oldest);
+ UI_write_line(newest);
+ // then
+
+ assert(DISPLAY_output_fake.call_count == 2);
+
+ // fills last line
+ assert(strncmp(oldest, DISPLAY_output_fake.arg0_history[0], 37) == 0);
+ //clears
+ assert(DISPLAY_clear_fake.call_count == 1);
+ // inserts old line at first
+ assert(strncmp(oldest, DISPLAY_output_fake.arg0_history[1], 37) == 0);
+ // then inserts new line
+ assert(strncmp(newest, DISPLAY_output_fake.arg0_history[2], 37) == 0);
+}
+
+int main()
+{
+ setbuf(stdout, NULL);
+ fprintf(stdout, "-------------\n");
+ fprintf(stdout, "Running Tests\n");
+ fprintf(stdout, "-------------\n\n");
+ fflush(0);
+
+ /* Run tests */
+ RUN_TEST(UITests, init_will_initialise_display);
+ RUN_TEST(UITests, init_will_register_interrupt_gpio2);
+ RUN_TEST(UITests, when_no_irq_then_missed_irq_counter_zero);
+ RUN_TEST(UITests, when_one_irq_and_no_handler_then_missed_irq_counter_one);
+ RUN_TEST(UITests, when_one_irq_and_valid_callback_then_missed_irq_counter_zero);
+ RUN_TEST(UITests, when_one_irq_and_valid_callback_then_callback_called);
+ RUN_TEST(UITests, write_line_outputs_lines_to_display);
+ RUN_TEST(UITests, when_no_empty_lines_write_line_clears_screen_and_outputs_lines_to_display);
+ RUN_TEST(UITests, when_empty_lines_write_line_doesnt_clear_screen);
+ RUN_TEST(UITests, when_string_longer_than_26_then_truncated_string_output);
+
+ printf("\n-------------\n");
+ printf("Complete\n");
+ printf("-------------\n\n");
+
+ return 0;
+}
diff --git a/deps/fff/examples/embedded_ui/src/UI_test_cpp.cpp b/deps/fff/examples/embedded_ui/src/UI_test_cpp.cpp
new file mode 100644
index 0000000..e7d9bba
--- /dev/null
+++ b/deps/fff/examples/embedded_ui/src/UI_test_cpp.cpp
@@ -0,0 +1,136 @@
+extern "C"{
+#include "UI.h"
+#include "SYSTEM.h"
+#include "DISPLAY.h"
+}
+#include <gtest/gtest.h>
+
+
+#include "fff.h"
+DEFINE_FFF_GLOBALS;
+
+/* SYSTEM.h */
+FAKE_VOID_FUNC(SYSTEM_register_irq, irq_func_t, unsigned int);
+/* DISPLAY.h */
+FAKE_VOID_FUNC(DISPLAY_init);
+FAKE_VOID_FUNC(DISPLAY_clear);
+FAKE_VOID_FUNC(DISPLAY_output, char *);
+FAKE_VALUE_FUNC(unsigned int, DISPLAY_get_line_capacity);
+FAKE_VALUE_FUNC(unsigned int, DISPLAY_get_line_insert_index);
+
+FAKE_VOID_FUNC(button_press_cbk);
+
+
+class UITests : public testing::Test
+{
+public:
+
+ void SetUp()
+ {
+ // Register resets
+ RESET_FAKE(SYSTEM_register_irq);
+
+ RESET_FAKE(DISPLAY_init)
+ RESET_FAKE(DISPLAY_clear)
+ RESET_FAKE(DISPLAY_output)
+ RESET_FAKE(DISPLAY_get_line_capacity)
+ RESET_FAKE(DISPLAY_get_line_insert_index);
+
+ RESET_FAKE(button_press_cbk);
+
+ FFF_RESET_HISTORY();
+ // non default init
+ DISPLAY_get_line_capacity_fake.return_val = 2;
+ }
+};
+
+
+
+/* Tests go here */
+TEST_F(UITests, init_will_initialise_display)
+{
+ UI_init();
+ ASSERT_EQ(DISPLAY_init_fake.call_count, 1);
+}
+
+TEST_F(UITests, init_will_register_interrupt_gpio2)
+{
+ UI_init();
+ ASSERT_EQ(SYSTEM_register_irq_fake.call_count, 1);
+ ASSERT_EQ((void *)SYSTEM_register_irq_fake.arg0_val, (void *)UI_button_irq_handler);
+ ASSERT_EQ(SYSTEM_register_irq_fake.arg1_val, IRQ_GPIO_2);
+}
+
+TEST_F(UITests, when_no_irq_then_missed_irq_counter_zero)
+{
+ ASSERT_EQ(UI_get_missed_irqs(), 0);
+}
+
+TEST_F(UITests, when_one_irq_and_no_handler_then_missed_irq_counter_one)
+{
+ UI_button_irq_handler();
+ ASSERT_EQ(UI_get_missed_irqs(), 1);
+}
+
+TEST_F(UITests, when_one_irq_and_valid_callback_then_missed_irq_counter_zero)
+{
+ UI_init();
+ UI_register_button_cbk(button_press_cbk);
+ UI_button_irq_handler();
+ ASSERT_EQ(UI_get_missed_irqs(), 0);
+}
+
+TEST_F(UITests, when_one_irq_and_valid_callback_then_callback_called)
+{
+ UI_register_button_cbk(button_press_cbk);
+ UI_button_irq_handler();
+ ASSERT_EQ(button_press_cbk_fake.call_count, 1);
+}
+
+TEST_F(UITests, write_line_outputs_lines_to_display)
+{
+ char msg[] = "helloworld";
+ UI_write_line(msg);
+ ASSERT_EQ(DISPLAY_output_fake.call_count, 1);
+ ASSERT_EQ(strncmp(DISPLAY_output_fake.arg0_val, msg, 26), 0);
+}
+
+TEST_F(UITests, when_no_empty_lines_write_line_clears_screen_and_outputs_lines_to_display)
+{
+ DISPLAY_get_line_insert_index_fake.return_val = 2;
+ char msg[] = "helloworld";
+
+ UI_write_line(msg);
+
+ ASSERT_EQ(DISPLAY_clear_fake.call_count, 1);
+ ASSERT_EQ(DISPLAY_output_fake.call_count, 1);
+ // Check the order of the calls: Don't care about the first two:
+ // DISPLAY_get_line_capacity and DISPLAY_get_line_insert_index
+ ASSERT_EQ(fff.call_history_idx, 4);
+ ASSERT_EQ(fff.call_history[2], (void *) DISPLAY_clear);
+ ASSERT_EQ(fff.call_history[3], (void *) DISPLAY_output);
+}
+
+TEST_F(UITests, when_empty_lines_write_line_doesnt_clear_screen)
+{
+ // given
+ DISPLAY_get_line_insert_index_fake.return_val = 1;
+ char msg[] = "helloworld";
+ // when
+ UI_write_line(msg);
+ // then
+ ASSERT_EQ(DISPLAY_clear_fake.call_count, 0);
+}
+
+TEST_F(UITests, when_string_longer_than_26_then_truncated_string_output)
+{
+ // given
+ char input[] = "abcdefghijklmnopqrstuvwxyz0123456789";
+ char expected[] = "abcdefghijklmnopqrstuvwxyz";
+ // when
+ UI_write_line(input);
+ // then
+ ASSERT_EQ(strncmp(expected, DISPLAY_output_fake.arg0_val, 37), 0);
+}
+
+
diff --git a/deps/fff/examples/weak_linking/CMakeLists.txt b/deps/fff/examples/weak_linking/CMakeLists.txt
new file mode 100644
index 0000000..b1d5679
--- /dev/null
+++ b/deps/fff/examples/weak_linking/CMakeLists.txt
@@ -0,0 +1,54 @@
+# Copyright 2022 Google LLC
+# SPDX-License-Identifier: Apache-2.0
+
+# Skip these tests for Windows
+if(WIN32)
+ message(STATUS "Weak linking requires __attribute__((weak)) which isn't supported on MS VS, skipping tests")
+ return()
+endif()
+
+# Set the global FFF_GCC_FUNCTION_ATTRIBUTES for config.h
+set(FFF_GCC_FUNCTION_ATTRIBUTES "__attribute__((weak))")
+configure_file(config/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
+
+# Create a libfakes static library that will be used in the executables below.
+# This library will depend on the above generated config.h which will add the
+# FFF 'weak' function attributes.
+add_library(libfakes STATIC
+ test/src/bus.fake.c
+ test/src/display.fake.c
+ test/src/error.fake.c
+ test/src/sensor.fake.c
+ test/src/test_common.c
+)
+target_precompile_headers(libfakes PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/config.h)
+target_include_directories(libfakes PUBLIC include test/include)
+target_link_libraries(libfakes PUBLIC fff)
+
+# Create the main test binary
+add_executable(test_main src/main.c test/src/main.test.c)
+target_link_libraries(test_main PRIVATE libfakes)
+
+# Create the sensor test binary
+add_executable(test_sensor src/sensor.c test/src/sensor.test.c)
+target_link_libraries(test_sensor PRIVATE libfakes)
+
+# Create the display test binary
+add_executable(test_display src/display.c test/src/display.test.c ${LIBFAKES_SRCS})
+target_link_libraries(test_display PRIVATE libfakes)
+
+# Add tests to ctest
+add_test(
+ NAME test_main
+ COMMAND $<TARGET_FILE:test_main>
+)
+
+add_test(
+ NAME test_sensor
+ COMMAND $<TARGET_FILE:test_sensor>
+)
+
+add_test(
+ NAME test_display
+ COMMAND $<TARGET_FILE:test_display>
+)
diff --git a/deps/fff/examples/weak_linking/config/config.h.in b/deps/fff/examples/weak_linking/config/config.h.in
new file mode 100644
index 0000000..30121ce
--- /dev/null
+++ b/deps/fff/examples/weak_linking/config/config.h.in
@@ -0,0 +1,5 @@
+/* Copyright 2022 Google LLC
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#cmakedefine FFF_GCC_FUNCTION_ATTRIBUTES @FFF_GCC_FUNCTION_ATTRIBUTES@
diff --git a/deps/fff/examples/weak_linking/include/bus.h b/deps/fff/examples/weak_linking/include/bus.h
new file mode 100644
index 0000000..84a56cf
--- /dev/null
+++ b/deps/fff/examples/weak_linking/include/bus.h
@@ -0,0 +1,6 @@
+#pragma once
+
+#include "error.h"
+
+bool bus_read_write( uint8_t dev, uint8_t registry, uint8_t* buffer, int len, bool assume_echo );
+bool bus_write( uint8_t dev, uint8_t registry, const uint8_t* buffer, int len, bool assume_echo );
diff --git a/deps/fff/examples/weak_linking/include/display.h b/deps/fff/examples/weak_linking/include/display.h
new file mode 100644
index 0000000..da1ee1f
--- /dev/null
+++ b/deps/fff/examples/weak_linking/include/display.h
@@ -0,0 +1,5 @@
+#pragma once
+#include "error.h"
+
+bool display_init();
+void display_update( const char* info );
diff --git a/deps/fff/examples/weak_linking/include/error.h b/deps/fff/examples/weak_linking/include/error.h
new file mode 100644
index 0000000..dd52269
--- /dev/null
+++ b/deps/fff/examples/weak_linking/include/error.h
@@ -0,0 +1,7 @@
+#pragma once
+
+#include <stdint.h>
+#include <stdbool.h>
+
+void runtime_error( const char* msg );
+char* runtime_error_nice_print( const char* msg );
diff --git a/deps/fff/examples/weak_linking/include/sensor.h b/deps/fff/examples/weak_linking/include/sensor.h
new file mode 100644
index 0000000..e199e45
--- /dev/null
+++ b/deps/fff/examples/weak_linking/include/sensor.h
@@ -0,0 +1,6 @@
+#pragma once
+
+#include "error.h"
+
+bool sensor_init();
+float sensor_read();
diff --git a/deps/fff/examples/weak_linking/src/bus.c b/deps/fff/examples/weak_linking/src/bus.c
new file mode 100644
index 0000000..5706932
--- /dev/null
+++ b/deps/fff/examples/weak_linking/src/bus.c
@@ -0,0 +1,30 @@
+#pragma once
+
+uint16_t* BUS_REGISTER_BASE = (uint16_t*)0xDEADBEEF;
+
+typedef struct
+{
+ uint16_t action;
+ uint16_t reg;
+ uint8_t input;
+ uint8_t output
+} BusDevice;
+
+BusDevice* BUS = (BusDevice*)BUS_REGISTER_BASE;
+
+bool bus_read_write( uint8_t dev, uint8_t registry, uint8_t* buffer, int len, bool assume_echo )
+{
+ // Something that we dont want to run, since the emulation would be hard.
+ BUS->action = 0x01;
+ BUS->reg = registry;
+ for ( int loop =0 ; loop < len; loop ++ )
+ {
+ char output = buffer[loop];
+ BUS->output = output;
+ buffer[loop] = BUS->input;
+
+ if ( ( assume_echo ) && ( buffer[loop] != output ) )
+ return false;
+ }
+ return true;
+}
diff --git a/deps/fff/examples/weak_linking/src/display.c b/deps/fff/examples/weak_linking/src/display.c
new file mode 100644
index 0000000..1b9a7d6
--- /dev/null
+++ b/deps/fff/examples/weak_linking/src/display.c
@@ -0,0 +1,29 @@
+#include <string.h>
+
+#include "display.h"
+#include "bus.h"
+
+#define DISPLAY_ADDRESS 0xAF
+#define DISPLAY_REG_INIT 0x10
+#define DISPLAY_REG_UPDATE 0x20
+
+bool display_init()
+{
+ char init_config[] = { 0xDE, 0xFE, 0x00 };
+ bus_read_write( DISPLAY_ADDRESS, DISPLAY_REG_INIT, (uint8_t*)init_config, 3, false );
+
+ if (init_config[2] != 0x10)
+ return false;
+
+ return true;
+}
+
+void display_update( const char* info )
+{
+ int len = strlen( info );
+
+ if ( bus_write( DISPLAY_ADDRESS, DISPLAY_REG_UPDATE, (const uint8_t*)info, len, true ) != true )
+ {
+ runtime_error("display update failed!");
+ }
+}
diff --git a/deps/fff/examples/weak_linking/src/error.c b/deps/fff/examples/weak_linking/src/error.c
new file mode 100644
index 0000000..5e7db63
--- /dev/null
+++ b/deps/fff/examples/weak_linking/src/error.c
@@ -0,0 +1,10 @@
+#include <assert.h>
+#include "error.h"
+
+char* runtime_error_nice_print( const char* msg )
+{
+ char* buffer = malloc(512);
+ snprintf(buffer, 512, "Got error: %s", msg );
+ buffer[511] = 0;
+ return buffer;
+}
diff --git a/deps/fff/examples/weak_linking/src/main.c b/deps/fff/examples/weak_linking/src/main.c
new file mode 100644
index 0000000..88be84c
--- /dev/null
+++ b/deps/fff/examples/weak_linking/src/main.c
@@ -0,0 +1,27 @@
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "display.h"
+#include "sensor.h"
+
+void give_error( const char* msg )
+{
+ char* buffer = runtime_error_nice_print( msg );
+ runtime_error( buffer );
+ free(buffer);
+}
+
+int update_main( void )
+{
+ if ( !sensor_init() )
+ runtime_error("sensor init failed");
+
+ if ( !display_init() )
+ runtime_error("display init failed");
+
+ char buffer[32];
+ float reading = sensor_read();
+ snprintf( buffer, 32, "Sensor: %0.1f", reading );
+ display_update( buffer );
+ return 0;
+}
diff --git a/deps/fff/examples/weak_linking/src/sensor.c b/deps/fff/examples/weak_linking/src/sensor.c
new file mode 100644
index 0000000..bff6642
--- /dev/null
+++ b/deps/fff/examples/weak_linking/src/sensor.c
@@ -0,0 +1,29 @@
+#include <string.h>
+
+#include "sensor.h"
+#include "bus.h"
+
+#define SENSOR_ADDRESS 0xAA
+#define SENSOR_REG_READ 0xF0
+
+float LOCAL_buffer[4];
+
+bool sensor_init()
+{
+ memset( LOCAL_buffer, 0x00, sizeof(LOCAL_buffer));
+ return true;
+}
+
+float sensor_read()
+{
+ char data[4] = { 0xFF, 0xFF, 0x00, 0x00 };
+ bus_read_write( SENSOR_ADDRESS, SENSOR_REG_READ, (uint8_t*)&data, 4, false );
+
+ if (data[0] != 0x10)
+ {
+ runtime_error("sensor read failed");
+ }
+
+ float ret_value = data[1] + data[2] / 256.0;
+ return ret_value;
+}
diff --git a/deps/fff/examples/weak_linking/test/include/bus.fake.h b/deps/fff/examples/weak_linking/test/include/bus.fake.h
new file mode 100644
index 0000000..170e45a
--- /dev/null
+++ b/deps/fff/examples/weak_linking/test/include/bus.fake.h
@@ -0,0 +1,10 @@
+#ifndef _AUTOFAKE_BUS_H
+#define _AUTOFAKE_BUS_H
+
+#include "fff.h"
+#include "bus.h"
+
+DECLARE_FAKE_VALUE_FUNC( bool, bus_read_write, uint8_t, uint8_t, uint8_t*, int, bool );
+DECLARE_FAKE_VALUE_FUNC( bool, bus_write, uint8_t, uint8_t, const uint8_t*, int, bool );
+
+#endif // _AUTOFAKE_BUS_H
diff --git a/deps/fff/examples/weak_linking/test/include/display.fake.h b/deps/fff/examples/weak_linking/test/include/display.fake.h
new file mode 100644
index 0000000..ef2adae
--- /dev/null
+++ b/deps/fff/examples/weak_linking/test/include/display.fake.h
@@ -0,0 +1,10 @@
+#ifndef _AUTOFAKE_DISPLAY_H
+#define _AUTOFAKE_DISPLAY_H
+
+#include "fff.h"
+#include "display.h"
+
+DECLARE_FAKE_VALUE_FUNC( bool, display_init );
+DECLARE_FAKE_VOID_FUNC( display_update, const char* );
+
+#endif // _AUTOFAKE_DISPLAY_H
diff --git a/deps/fff/examples/weak_linking/test/include/error.fake.h b/deps/fff/examples/weak_linking/test/include/error.fake.h
new file mode 100644
index 0000000..ee127ec
--- /dev/null
+++ b/deps/fff/examples/weak_linking/test/include/error.fake.h
@@ -0,0 +1,10 @@
+#ifndef _AUTOFAKE_ERROR_H
+#define _AUTOFAKE_ERROR_H
+
+#include "fff.h"
+#include "error.h"
+
+DECLARE_FAKE_VOID_FUNC( runtime_error, const char* );
+DECLARE_FAKE_VALUE_FUNC( char*, runtime_error_nice_print, const char* );
+
+#endif // _AUTOFAKE_ERROR_H
diff --git a/deps/fff/examples/weak_linking/test/include/sensor.fake.h b/deps/fff/examples/weak_linking/test/include/sensor.fake.h
new file mode 100644
index 0000000..ae363f8
--- /dev/null
+++ b/deps/fff/examples/weak_linking/test/include/sensor.fake.h
@@ -0,0 +1,13 @@
+
+#ifndef _AUTOMOCK_SENSOR_H
+#define _AUTOMOCK_SENSOR_H
+
+#include "fff.h"
+#include "sensor.h"
+
+DECLARE_FAKE_VALUE_FUNC( bool, sensor_init );
+DECLARE_FAKE_VALUE_FUNC( float, sensor_read );
+
+void TEST_sensor_generate_data( char* buffer, float value );
+
+#endif // _AUTOMOCK_SENSOR_H
diff --git a/deps/fff/examples/weak_linking/test/include/test_common.h b/deps/fff/examples/weak_linking/test/include/test_common.h
new file mode 100644
index 0000000..a282dd1
--- /dev/null
+++ b/deps/fff/examples/weak_linking/test/include/test_common.h
@@ -0,0 +1,13 @@
+#pragma once
+
+#include <assert.h>
+#include <stdio.h>
+
+#include "fff.h"
+#include "bus.fake.h"
+#include "error.fake.h"
+
+
+void init_tests();
+
+extern char GLOBAL_TEST_bus_read_ret[32];
diff --git a/deps/fff/examples/weak_linking/test/src/bus.fake.c b/deps/fff/examples/weak_linking/test/src/bus.fake.c
new file mode 100644
index 0000000..e3a9f76
--- /dev/null
+++ b/deps/fff/examples/weak_linking/test/src/bus.fake.c
@@ -0,0 +1,4 @@
+#include "bus.fake.h"
+
+DEFINE_FAKE_VALUE_FUNC( bool, bus_read_write, uint8_t, uint8_t, uint8_t*, int, bool );
+DEFINE_FAKE_VALUE_FUNC( bool, bus_write, uint8_t, uint8_t, const uint8_t*, int, bool );
diff --git a/deps/fff/examples/weak_linking/test/src/display.fake.c b/deps/fff/examples/weak_linking/test/src/display.fake.c
new file mode 100644
index 0000000..f8dec66
--- /dev/null
+++ b/deps/fff/examples/weak_linking/test/src/display.fake.c
@@ -0,0 +1,4 @@
+#include "display.fake.h"
+
+DEFINE_FAKE_VALUE_FUNC( bool, display_init );
+DEFINE_FAKE_VOID_FUNC( display_update, const char* );
diff --git a/deps/fff/examples/weak_linking/test/src/display.test.c b/deps/fff/examples/weak_linking/test/src/display.test.c
new file mode 100644
index 0000000..269ae32
--- /dev/null
+++ b/deps/fff/examples/weak_linking/test/src/display.test.c
@@ -0,0 +1,24 @@
+#include "test_common.h"
+#include "display.h"
+
+DEFINE_FFF_GLOBALS;
+
+
+int main(void)
+{
+ init_tests(); // Resets common and hook errors to asserts.
+
+ GLOBAL_TEST_bus_read_ret[2] = 0x10;
+ assert( display_init() == true );
+ assert( bus_read_write_fake.call_count == 1);
+
+ display_update( "TEST INFO" );
+ assert( bus_read_write_fake.call_count == 1 );
+ assert( bus_write_fake.call_count == 1 );
+
+ GLOBAL_TEST_bus_read_ret[2] = 0x00;
+ assert( display_init() == false );
+
+ printf("Test " __FILE__ " ok\n");
+ return 0;
+}
diff --git a/deps/fff/examples/weak_linking/test/src/error.fake.c b/deps/fff/examples/weak_linking/test/src/error.fake.c
new file mode 100644
index 0000000..0a39478
--- /dev/null
+++ b/deps/fff/examples/weak_linking/test/src/error.fake.c
@@ -0,0 +1,4 @@
+#include "error.fake.h"
+
+DEFINE_FAKE_VOID_FUNC( runtime_error, const char* );
+DEFINE_FAKE_VALUE_FUNC( char*, runtime_error_nice_print, const char* );
diff --git a/deps/fff/examples/weak_linking/test/src/main.test.c b/deps/fff/examples/weak_linking/test/src/main.test.c
new file mode 100644
index 0000000..6ac023c
--- /dev/null
+++ b/deps/fff/examples/weak_linking/test/src/main.test.c
@@ -0,0 +1,26 @@
+
+#include "display.fake.h"
+#include "sensor.fake.h"
+#include "test_common.h"
+
+DEFINE_FFF_GLOBALS;
+
+
+int update_main( void );
+
+int main(void)
+{
+ init_tests(); // Resets common and hook errors to asserts.
+
+ sensor_init_fake.return_val = true;
+ display_init_fake.return_val = true;
+
+ update_main();
+
+ assert( sensor_init_fake.call_count == 1 );
+ assert( display_init_fake.call_count == 1 );
+ assert( display_update_fake.call_count == 1 );
+
+ printf("Test " __FILE__ " ok\n");
+ return 0;
+}
diff --git a/deps/fff/examples/weak_linking/test/src/sensor.fake.c b/deps/fff/examples/weak_linking/test/src/sensor.fake.c
new file mode 100644
index 0000000..4fdaa66
--- /dev/null
+++ b/deps/fff/examples/weak_linking/test/src/sensor.fake.c
@@ -0,0 +1,11 @@
+#include "sensor.fake.h"
+
+DEFINE_FAKE_VALUE_FUNC( bool, sensor_init );
+DEFINE_FAKE_VALUE_FUNC( float, sensor_read );
+
+void TEST_sensor_generate_data( char* buffer, float value )
+{
+ buffer[0] = 0x10;
+ buffer[1] = (int)(value);
+ buffer[2] = (value - buffer[1])*255;
+}
diff --git a/deps/fff/examples/weak_linking/test/src/sensor.test.c b/deps/fff/examples/weak_linking/test/src/sensor.test.c
new file mode 100644
index 0000000..8126cb6
--- /dev/null
+++ b/deps/fff/examples/weak_linking/test/src/sensor.test.c
@@ -0,0 +1,23 @@
+#include <stdio.h>
+
+#include "test_common.h"
+
+#include "sensor.h"
+#include "sensor.fake.h"
+
+DEFINE_FFF_GLOBALS;
+
+
+int main(void)
+{
+ init_tests();
+
+ assert( sensor_init() == true );
+
+ TEST_sensor_generate_data( GLOBAL_TEST_bus_read_ret, 1.5f );
+ float value = sensor_read();
+ float value_error = value - 1.5f;
+ assert( value_error < 0.1f && value_error > -0.1f );
+ printf("Test " __FILE__ " ok\n");
+ return 0;
+}
diff --git a/deps/fff/examples/weak_linking/test/src/test_common.c b/deps/fff/examples/weak_linking/test/src/test_common.c
new file mode 100644
index 0000000..58c3b44
--- /dev/null
+++ b/deps/fff/examples/weak_linking/test/src/test_common.c
@@ -0,0 +1,33 @@
+#include "test_common.h"
+#include <assert.h>
+#include <stdio.h>
+
+char GLOBAL_TEST_bus_read_ret[32];
+
+
+void spoof_runtime_error( const char* info )
+{
+ fprintf(stderr, "Runtime error: %s\n", info );
+ assert(0);
+}
+
+bool spoof_bus_read_write( uint8_t dev, uint8_t registry, uint8_t* buffer, int len, bool assume_echo )
+{
+ memcpy( buffer, GLOBAL_TEST_bus_read_ret, len );
+ fprintf(stderr, "bus spoof %d %d\n", (int)dev, (int)registry );
+ return true;
+}
+
+void init_tests()
+{
+ memset( GLOBAL_TEST_bus_read_ret, 0x00, sizeof(GLOBAL_TEST_bus_read_ret));
+ FFF_RESET_HISTORY();
+
+ RESET_FAKE(bus_read_write);
+ RESET_FAKE(bus_write);
+ RESET_FAKE(runtime_error);
+
+ runtime_error_fake.custom_fake = spoof_runtime_error;
+ bus_read_write_fake.custom_fake = spoof_bus_read_write;
+ bus_write_fake.return_val = true;
+} \ No newline at end of file
diff --git a/deps/fff/fakegen.rb b/deps/fff/fakegen.rb
new file mode 100644
index 0000000..e3c0a86
--- /dev/null
+++ b/deps/fff/fakegen.rb
@@ -0,0 +1,698 @@
+
+# fakegen.rb
+# A simple code generator to create some C macros for defining test fake functions
+
+
+$cpp_output = true
+$MAX_ARGS = 20
+$DEFAULT_ARG_HISTORY = 50
+$MAX_CALL_HISTORY = 50
+
+def license
+ File.foreach("#{__dir__}/LICENSE") { |line| putd line }
+end
+
+def include_dependencies
+ putd "#include <stdarg.h>"
+ putd "#include <string.h> /* For memset and memcpy */"
+ puts
+end
+
+def output_constants
+ putd "#define FFF_MAX_ARGS (#{$MAX_ARGS}u)"
+ putd "#ifndef FFF_ARG_HISTORY_LEN"
+ indent {
+ putd "#define FFF_ARG_HISTORY_LEN (#{$DEFAULT_ARG_HISTORY}u)"
+ }
+ putd "#endif"
+ putd "#ifndef FFF_CALL_HISTORY_LEN"
+ indent {
+ putd "#define FFF_CALL_HISTORY_LEN (#{$MAX_CALL_HISTORY}u)"
+ }
+ putd "#endif"
+ putd "#ifndef FFF_GCC_FUNCTION_ATTRIBUTES"
+ indent {
+ putd "#define FFF_GCC_FUNCTION_ATTRIBUTES"
+ }
+ putd "#endif"
+
+end
+
+
+def output_default_function_pointer_macro(has_calling_conventions)
+ name = has_calling_conventions ? "(CALLING_CONVENTION *FUNCNAME)" : "(*FUNCNAME)"
+ calling_conv = has_calling_conventions ? ", CALLING_CONVENTION" : ""
+ putd "#ifndef CUSTOM_FFF_FUNCTION_TEMPLATE"
+ putd_backslash "#define CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN#{calling_conv}, FUNCNAME, ...)"
+ indent {
+ putd "RETURN#{name}(__VA_ARGS__)"
+ }
+ putd "#endif /* CUSTOM_FFF_FUNCTION_TEMPLATE */"
+end
+
+
+
+
+# ------ Helper macros to use internally ------ #
+def output_internal_helper_macros
+ putd "/* -- INTERNAL HELPER MACROS -- */"
+
+ define_return_sequence_helper
+ define_custom_fake_sequence_helper
+ define_reset_fake_macro
+ define_declare_arg_helper
+ define_declare_all_func_common_helper
+ define_declare_return_value_history
+ define_save_arg_helper
+ define_room_for_more_history
+ define_save_ret_history_helper
+ define_save_arg_history_helper
+ define_history_dropped_helper
+ define_value_function_variables_helper
+ define_custom_fake_seq_variables_helper
+ define_increment_call_count_helper
+ define_return_fake_result_helper
+ define_extern_c_helper
+ define_reset_fake_helper
+
+ putd "/* -- END INTERNAL HELPER MACROS -- */"
+ puts
+end
+
+def define_return_sequence_helper
+ putd_backslash "#define SET_RETURN_SEQ(FUNCNAME, ARRAY_POINTER, ARRAY_LEN)"
+ indent {
+ putd_backslash "FUNCNAME##_fake.return_val_seq = ARRAY_POINTER;"
+ putd "FUNCNAME##_fake.return_val_seq_len = ARRAY_LEN;"
+ }
+end
+
+def define_custom_fake_sequence_helper
+ putd_backslash "#define SET_CUSTOM_FAKE_SEQ(FUNCNAME, ARRAY_POINTER, ARRAY_LEN)"
+ indent {
+ putd_backslash "FUNCNAME##_fake.custom_fake_seq = ARRAY_POINTER;"
+ putd "FUNCNAME##_fake.custom_fake_seq_len = ARRAY_LEN;"
+ }
+end
+
+def define_reset_fake_macro
+ puts
+ putd "/* Defining a function to reset a fake function */"
+ putd_backslash "#define RESET_FAKE(FUNCNAME) {"
+ indent {
+ putd_backslash "FUNCNAME##_reset();"
+ }
+ putd_backslash "}"
+ puts
+end
+
+def define_declare_arg_helper
+ puts
+ putd_backslash "#define DECLARE_ARG(type, n, FUNCNAME)"
+ indent {
+ putd_backslash "type arg##n##_val;"
+ putd "type arg##n##_history[FFF_ARG_HISTORY_LEN];"
+ }
+end
+
+def define_declare_all_func_common_helper
+ puts
+ putd_backslash "#define DECLARE_ALL_FUNC_COMMON"
+ indent {
+ putd_backslash "unsigned int call_count;"
+ putd_backslash "unsigned int arg_history_len;"
+ putd_backslash "unsigned int arg_histories_dropped;"
+ }
+end
+
+def define_declare_return_value_history
+ putd ""
+ putd_backslash "#define DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE)"
+ indent {
+ putd "RETURN_TYPE return_val_history[FFF_ARG_HISTORY_LEN];"
+ }
+end
+
+def define_save_arg_helper
+ puts
+ putd_backslash "#define SAVE_ARG(FUNCNAME, n)"
+ indent {
+ putd "memcpy((void*)&FUNCNAME##_fake.arg##n##_val, (void*)&arg##n, sizeof(arg##n));"
+ }
+end
+
+def define_save_ret_history_helper
+ putd ""
+ putd_backslash "#define SAVE_RET_HISTORY(FUNCNAME, RETVAL)"
+ indent {
+ putd_backslash "if ((FUNCNAME##_fake.call_count - 1) < FFF_ARG_HISTORY_LEN)"
+ indent {
+ putd_backslash "memcpy((void *)&FUNCNAME##_fake.return_val_history[FUNCNAME##_fake.call_count - 1], (const void *) &RETVAL, sizeof(RETVAL));"
+ }
+ }
+end
+
+def define_room_for_more_history
+ puts
+ putd_backslash "#define ROOM_FOR_MORE_HISTORY(FUNCNAME)"
+ indent {
+ putd "FUNCNAME##_fake.call_count < FFF_ARG_HISTORY_LEN"
+ }
+end
+
+def define_save_arg_history_helper
+ puts
+ putd_backslash "#define SAVE_ARG_HISTORY(FUNCNAME, ARGN)"
+ indent {
+ putd "memcpy((void*)&FUNCNAME##_fake.arg##ARGN##_history[FUNCNAME##_fake.call_count], (void*)&arg##ARGN, sizeof(arg##ARGN));"
+ }
+end
+
+def define_history_dropped_helper
+ puts
+ putd_backslash "#define HISTORY_DROPPED(FUNCNAME)"
+ indent {
+ putd "FUNCNAME##_fake.arg_histories_dropped++"
+ }
+end
+
+def define_value_function_variables_helper
+ puts
+ putd_backslash "#define DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE)"
+ indent {
+ putd_backslash "RETURN_TYPE return_val;"
+ putd_backslash "int return_val_seq_len;"
+ putd_backslash "int return_val_seq_idx;"
+ putd_backslash "RETURN_TYPE * return_val_seq;"
+ }
+end
+
+def define_custom_fake_seq_variables_helper
+ puts
+ putd_backslash "#define DECLARE_CUSTOM_FAKE_SEQ_VARIABLES"
+ indent {
+ putd_backslash "int custom_fake_seq_len;"
+ putd_backslash "int custom_fake_seq_idx;"
+ }
+end
+
+def define_increment_call_count_helper
+ puts
+ putd_backslash "#define INCREMENT_CALL_COUNT(FUNCNAME)"
+ indent {
+ putd "FUNCNAME##_fake.call_count++"
+ }
+end
+
+def define_return_fake_result_helper
+ puts
+ putd_backslash "#define RETURN_FAKE_RESULT(FUNCNAME)"
+ indent {
+ putd_backslash "if (FUNCNAME##_fake.return_val_seq_len){ /* then its a sequence */"
+ indent {
+ putd_backslash "if(FUNCNAME##_fake.return_val_seq_idx < FUNCNAME##_fake.return_val_seq_len) {"
+ indent {
+ putd_backslash "SAVE_RET_HISTORY(FUNCNAME, FUNCNAME##_fake.return_val_seq[FUNCNAME##_fake.return_val_seq_idx])"
+ putd_backslash "return FUNCNAME##_fake.return_val_seq[FUNCNAME##_fake.return_val_seq_idx++];"
+ }
+ putd_backslash "}"
+ putd_backslash "SAVE_RET_HISTORY(FUNCNAME, FUNCNAME##_fake.return_val_seq[FUNCNAME##_fake.return_val_seq_len-1])"
+ putd_backslash "return FUNCNAME##_fake.return_val_seq[FUNCNAME##_fake.return_val_seq_len-1]; /* return last element */"
+ }
+ putd_backslash "}"
+ putd_backslash "SAVE_RET_HISTORY(FUNCNAME, FUNCNAME##_fake.return_val)"
+ putd_backslash "return FUNCNAME##_fake.return_val;"
+ }
+end
+
+def define_extern_c_helper
+ puts
+ putd "#ifdef __cplusplus"
+ indent {
+ putd "#define FFF_EXTERN_C extern \"C\"{"
+ putd "#define FFF_END_EXTERN_C } "
+ }
+ putd "#else /* ansi c */"
+ indent {
+ putd "#define FFF_EXTERN_C "
+ putd "#define FFF_END_EXTERN_C "
+ }
+ putd "#endif /* cpp/ansi c */"
+end
+
+def define_reset_fake_helper
+ puts
+ putd_backslash "#define DEFINE_RESET_FUNCTION(FUNCNAME)"
+ indent {
+ putd_backslash "void FUNCNAME##_reset(void){"
+ indent {
+ putd_backslash "memset((void*)&FUNCNAME##_fake, 0, sizeof(FUNCNAME##_fake) - sizeof(FUNCNAME##_fake.custom_fake) - sizeof(FUNCNAME##_fake.custom_fake_seq));"
+ putd_backslash "FUNCNAME##_fake.custom_fake = NULL;"
+ putd_backslash "FUNCNAME##_fake.custom_fake_seq = NULL;"
+ putd_backslash "FUNCNAME##_fake.arg_history_len = FFF_ARG_HISTORY_LEN;"
+ }
+ putd "}"
+ }
+end
+# ------ End Helper macros ------ #
+
+#fakegen helpers to print at levels of indentation
+$current_depth = 0
+def putd(str)
+ $current_depth.times {|not_used| print " "}
+ puts str
+end
+
+#multiline putd which adds a \ at the end of the generated macro
+def putd_backslash str
+ putd(str + " \\")
+end
+
+def pushd
+ $current_depth = $current_depth + 4
+end
+
+def popd
+ $current_depth = $current_depth - 4
+end
+
+def indent
+ pushd
+ yield
+ popd
+end
+
+def output_macro(arg_count, has_varargs, has_calling_conventions, is_value_function)
+
+ vararg_name = has_varargs ? "_VARARG" : ""
+ fake_macro_name = is_value_function ? "FAKE_VALUE_FUNC#{arg_count}#{vararg_name}" : "FAKE_VOID_FUNC#{arg_count}#{vararg_name}"
+ declare_macro_name = "DECLARE_#{fake_macro_name}"
+ define_macro_name = "DEFINE_#{fake_macro_name}"
+ saved_arg_count = arg_count - (has_varargs ? 1 : 0)
+ return_type = is_value_function ? "RETURN_TYPE" : ""
+
+ puts
+ output_macro_header(declare_macro_name, saved_arg_count, has_varargs, has_calling_conventions, return_type)
+ indent {
+ output_variables(saved_arg_count, has_varargs, has_calling_conventions, is_value_function)
+ }
+
+ puts
+ output_macro_header(define_macro_name, saved_arg_count, has_varargs, has_calling_conventions, return_type)
+ indent {
+ putd_backslash "FUNCNAME##_Fake FUNCNAME##_fake;"
+ putd_backslash function_signature(saved_arg_count, has_varargs, has_calling_conventions, is_value_function) + "{"
+ indent {
+ output_function_body(saved_arg_count, has_varargs, is_value_function)
+ }
+ putd_backslash "}"
+ putd_backslash "DEFINE_RESET_FUNCTION(FUNCNAME)"
+ }
+
+ puts
+
+ output_macro_header(fake_macro_name, saved_arg_count, has_varargs, has_calling_conventions, return_type)
+ indent {
+ putd macro_signature_for(declare_macro_name, saved_arg_count, has_varargs, has_calling_conventions, return_type)
+ putd macro_signature_for(define_macro_name, saved_arg_count, has_varargs, has_calling_conventions, return_type)
+ puts
+ }
+end
+
+def output_macro_header(macro_name, arg_count, has_varargs, has_calling_conventions, return_type)
+ output_macro_name(macro_name, arg_count, has_varargs, has_calling_conventions, return_type)
+end
+
+# #define #macro_name(RETURN_TYPE, FUNCNAME, ARG0,...)
+def output_macro_name(macro_name, arg_count, has_varargs, has_calling_conventions, return_type)
+ putd "#define " + macro_signature_for(macro_name, arg_count, has_varargs, has_calling_conventions, return_type)
+end
+
+# #macro_name(RETURN_TYPE, FUNCNAME, ARG0,...) \
+def macro_signature_for(macro_name, arg_count, has_varargs, has_calling_conventions, return_type)
+ parameter_list = "#{macro_name}("
+ if return_type != ""
+ parameter_list += return_type
+ parameter_list += ", "
+ end
+ parameter_list += "CALLING_CONVENTION, " if (has_calling_conventions)
+ parameter_list += "FUNCNAME"
+
+ arg_count.times { |i| parameter_list += ", ARG#{i}_TYPE" }
+
+ parameter_list += ", ..." if has_varargs
+
+ parameter_list += ") \\"
+
+ parameter_list
+end
+
+def output_variables(arg_count, has_varargs, has_calling_conventions, is_value_function)
+ in_struct{
+ arg_count.times { |argN|
+ putd_backslash "DECLARE_ARG(ARG#{argN}_TYPE, #{argN}, FUNCNAME)"
+ }
+ putd_backslash "DECLARE_ALL_FUNC_COMMON"
+ putd_backslash "DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE)" unless not is_value_function
+ putd_backslash "DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE)" unless not is_value_function
+ putd_backslash "DECLARE_CUSTOM_FAKE_SEQ_VARIABLES"
+ output_custom_function_signature(arg_count, has_varargs, has_calling_conventions, is_value_function)
+ output_custom_function_array(arg_count, has_varargs, has_calling_conventions, is_value_function)
+ }
+ putd_backslash "extern FUNCNAME##_Fake FUNCNAME##_fake;"
+ putd_backslash "void FUNCNAME##_reset(void);"
+ putd_backslash function_signature(arg_count, has_varargs, has_calling_conventions, is_value_function) + ";"
+end
+
+#example: ARG0_TYPE arg0, ARG1_TYPE arg1
+def arg_val_list(args_count)
+ return "void" if (args_count == 0)
+ arguments = []
+ args_count.times { |i| arguments << "ARG#{i}_TYPE arg#{i}" }
+ arguments.join(", ")
+end
+
+#example: ARG0_TYPE, ARG1_TYPE
+def arg_type_list(args_count)
+ return "void" if (args_count == 0)
+ arguments = []
+ args_count.times { |i| arguments << "ARG#{i}_TYPE" }
+ arguments.join(", ")
+end
+
+#example: arg0, arg1
+def arg_list(args_count)
+ arguments = []
+ args_count.times { |i| arguments << "arg#{i}" }
+ arguments.join(", ")
+end
+
+# RETURN_TYPE (*custom_fake)(ARG0_TYPE arg0);\
+# OR
+# RETURN_TYPE (CALLING_CONVENTION *custom_fake)(ARG0_TYPE arg0);\
+#
+# void (*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2);\
+def output_custom_function_signature(arg_count, has_varargs, has_calling_conventions, is_value_function)
+ return_type = is_value_function ? "RETURN_TYPE" : "void"
+ ap_list = has_varargs ? ", va_list ap" : ""
+ calling_conv = has_calling_conventions ? ", CALLING_CONVENTION" : ""
+ putd_backslash "CUSTOM_FFF_FUNCTION_TEMPLATE(#{return_type}#{calling_conv}, custom_fake, #{arg_type_list(arg_count)}#{ap_list});"
+end
+
+def output_custom_function_array(arg_count, has_varargs, has_calling_conventions, is_value_function)
+ return_type = is_value_function ? "RETURN_TYPE" : "void"
+ ap_list = has_varargs ? ", va_list ap" : ""
+ calling_conv = has_calling_conventions ? ", CALLING_CONVENTION" : ""
+ putd_backslash "CUSTOM_FFF_FUNCTION_TEMPLATE(#{return_type}#{calling_conv}, *custom_fake_seq, #{arg_type_list(arg_count)}#{ap_list});"
+end
+
+# example: RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1)
+# OR
+# RETURN_TYPE CALLING_CONVENTION FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1)
+def function_signature(arg_count, has_varargs, has_calling_conventions, is_value_function)
+ return_type = is_value_function ? "RETURN_TYPE" : "void"
+ varargs = has_varargs ? ", ..." : ""
+ calling_conventions = has_calling_conventions ?
+ "#{return_type} FFF_GCC_FUNCTION_ATTRIBUTES CALLING_CONVENTION FUNCNAME(#{arg_val_list(arg_count)}#{varargs})" :
+ "#{return_type} FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(#{arg_val_list(arg_count)}#{varargs})"
+end
+
+def output_function_body(arg_count, has_varargs, is_value_function)
+ arg_count.times { |i| putd_backslash "SAVE_ARG(FUNCNAME, #{i});" }
+ putd_backslash "if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){"
+ indent {
+ arg_count.times { |i| putd_backslash "SAVE_ARG_HISTORY(FUNCNAME, #{i});" }
+ }
+ putd_backslash "}"
+ putd_backslash "else{"
+ indent {
+ putd_backslash "HISTORY_DROPPED(FUNCNAME);"
+ }
+ putd_backslash "}"
+ putd_backslash "INCREMENT_CALL_COUNT(FUNCNAME);"
+ putd_backslash "REGISTER_CALL(FUNCNAME);"
+
+ if has_varargs
+ return_type = is_value_function ? "return " : ""
+ putd_backslash "if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */"
+ indent {
+ putd_backslash "if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){"
+ indent {
+ putd_backslash "va_list ap;"
+ putd_backslash "va_start(ap, arg#{arg_count-1});"
+ putd_backslash "RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](#{arg_list(arg_count)}, ap);" unless not is_value_function
+ putd_backslash "SAVE_RET_HISTORY(FUNCNAME, ret);" unless not is_value_function
+ putd_backslash "va_end(ap);" unless not is_value_function
+ putd_backslash "return ret;" unless not is_value_function
+ putd_backslash "#{return_type}FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](#{arg_list(arg_count)}, ap);" unless is_value_function
+ putd_backslash "va_end(ap);" unless is_value_function
+ }
+ putd_backslash "}"
+ putd_backslash "else{"
+ indent {
+ putd_backslash "va_list ap;"
+ putd_backslash "va_start(ap, arg#{arg_count-1});"
+ putd_backslash "RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](#{arg_list(arg_count)}, ap);" unless not is_value_function
+ putd_backslash "SAVE_RET_HISTORY(FUNCNAME, ret);" unless not is_value_function
+ putd_backslash "va_end(ap);" unless not is_value_function
+ putd_backslash "return ret;" unless not is_value_function
+ putd_backslash "#{return_type}FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](#{arg_list(arg_count)}, ap);" unless is_value_function
+ putd_backslash "va_end(ap);" unless is_value_function
+ }
+ putd_backslash "}"
+ }
+ putd_backslash "}"
+ putd_backslash "if(FUNCNAME##_fake.custom_fake){"
+ indent {
+ putd_backslash "RETURN_TYPE ret;" if is_value_function
+ putd_backslash "va_list ap;"
+ putd_backslash "va_start(ap, arg#{arg_count-1});"
+ }
+ custom_fake_call = "FUNCNAME##_fake.custom_fake(#{arg_list(arg_count)}, ap);"
+ indent {
+ if is_value_function
+ putd_backslash "ret = #{custom_fake_call}"
+ else
+ putd_backslash "#{custom_fake_call}"
+ end
+ putd_backslash "va_end(ap);"
+ putd_backslash "SAVE_RET_HISTORY(FUNCNAME, ret);" unless not is_value_function
+ putd_backslash "return ret;" if is_value_function
+ }
+ putd_backslash "}"
+ else
+ return_type = is_value_function ? "return " : ""
+ putd_backslash "if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */"
+ indent {
+ putd_backslash "if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){"
+ indent {
+ putd_backslash "RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](#{arg_list(arg_count)});" unless not is_value_function
+ putd_backslash "SAVE_RET_HISTORY(FUNCNAME, ret);" unless not is_value_function
+ putd_backslash "return ret;" unless not is_value_function
+ putd_backslash "#{return_type}FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](#{arg_list(arg_count)});" unless is_value_function
+ }
+ putd_backslash "}"
+ putd_backslash "else{"
+ indent {
+ putd_backslash "RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](#{arg_list(arg_count)});" unless not is_value_function
+ putd_backslash "SAVE_RET_HISTORY(FUNCNAME, ret);" unless not is_value_function
+ putd_backslash "return ret;" unless not is_value_function
+ putd_backslash "#{return_type}FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](#{arg_list(arg_count)});" unless is_value_function
+ }
+ putd_backslash "}"
+ }
+ putd_backslash "}"
+ putd_backslash "if (FUNCNAME##_fake.custom_fake != NULL){ "
+ indent {
+ putd_backslash "RETURN_TYPE ret = FUNCNAME##_fake.custom_fake(#{arg_list(arg_count)});" unless not is_value_function
+ putd_backslash "SAVE_RET_HISTORY(FUNCNAME, ret);" unless not is_value_function
+ putd_backslash "return ret;" unless not is_value_function
+ putd_backslash "#{return_type}FUNCNAME##_fake.custom_fake(#{arg_list(arg_count)});" unless is_value_function
+ }
+ putd_backslash "}"
+ end
+
+ putd_backslash "RETURN_FAKE_RESULT(FUNCNAME)" if is_value_function
+end
+
+def define_fff_globals
+ putd "typedef void (*fff_function_t)(void);"
+ putd "typedef struct { "
+ indent {
+ putd "fff_function_t call_history[FFF_CALL_HISTORY_LEN];"
+ putd "unsigned int call_history_idx;"
+ }
+ putd "} fff_globals_t;"
+ puts
+ putd "FFF_EXTERN_C"
+ putd "extern fff_globals_t fff;"
+ putd "FFF_END_EXTERN_C"
+ puts
+ putd_backslash "#define DEFINE_FFF_GLOBALS"
+ indent {
+ putd_backslash "FFF_EXTERN_C"
+ indent {
+ putd_backslash "fff_globals_t fff;"
+ }
+ putd "FFF_END_EXTERN_C"
+ }
+ puts
+ putd_backslash "#define FFF_RESET_HISTORY()"
+ indent {
+ putd_backslash "fff.call_history_idx = 0;"
+ putd "memset(fff.call_history, 0, sizeof(fff.call_history));"
+ }
+ puts
+ putd_backslash "#define REGISTER_CALL(function)"
+ indent {
+ putd_backslash "if(fff.call_history_idx < FFF_CALL_HISTORY_LEN)"
+ indent {
+ putd "fff.call_history[fff.call_history_idx++] = (fff_function_t)function;"
+ }
+ }
+end
+
+def in_struct
+ putd_backslash "typedef struct FUNCNAME##_Fake {"
+ indent {
+ yield
+ }
+ putd_backslash "} FUNCNAME##_Fake;"
+end
+
+def include_guard
+ putd "#ifndef FAKE_FUNCTIONS"
+ putd "#define FAKE_FUNCTIONS"
+ puts
+
+ yield
+
+ puts
+ putd "#endif /* FAKE_FUNCTIONS */"
+end
+
+def msvc_expand_macro_fix
+ putd "/* MSVC expand macro fix */"
+ putd "#define EXPAND(x) x"
+end
+
+def generate_arg_sequence(args, prefix, do_reverse, joinstr)
+ fmap = (0..args).flat_map {|i| [prefix + i.to_s]}
+ if do_reverse then fmap.reverse.join(joinstr) else fmap.join(", ") end
+end
+
+def counting_macro_instance(type, has_calling_conventions, vararg = :non_vararg, prefix = "")
+ appendix = (vararg == :vararg) ? "_VARARG" : ""
+ if has_calling_conventions
+ minus_count = (type == :VOID) ? 2 : 3
+ else
+ minus_count = (type == :VOID) ? 1 : 2
+ end
+
+ <<-MACRO_COUNTING_INSTANCE
+#define #{prefix}FAKE_#{type.to_s}_FUNC#{appendix}(...) \
+ EXPAND(#{prefix}FUNC_#{type.to_s}#{appendix}_(PP_NARG_MINUS#{minus_count}(__VA_ARGS__), __VA_ARGS__))
+
+#define #{prefix}FUNC_#{type.to_s}#{appendix}_(N,...) \
+ EXPAND(#{prefix}FUNC_#{type.to_s}#{appendix}_N(N,__VA_ARGS__))
+
+#define #{prefix}FUNC_#{type.to_s}#{appendix}_N(N,...) \
+ EXPAND(#{prefix}FAKE_#{type.to_s}_FUNC ## N#{" ## _VARARG" if vararg == :vararg}(__VA_ARGS__))
+
+ MACRO_COUNTING_INSTANCE
+end
+
+def output_macro_counting_shortcuts(has_calling_conventions)
+ has_calling_conventions ?
+ (arg_depth = ["3", "2"]; calling_conv = "callingConv, ") :
+ (arg_depth = ["2", "1"]; calling_conv = "")
+
+ msvc_expand_macro_fix
+ putd <<-MACRO_COUNTING
+
+#define PP_NARG_MINUS#{arg_depth[0]}(...) \
+ EXPAND(PP_NARG_MINUS#{arg_depth[0]}_(__VA_ARGS__, PP_RSEQ_N_MINUS#{arg_depth[0]}()))
+
+#define PP_NARG_MINUS#{arg_depth[0]}_(...) \
+ EXPAND(PP_ARG_MINUS#{arg_depth[0]}_N(__VA_ARGS__))
+
+#define PP_ARG_MINUS#{arg_depth[0]}_N(returnVal, #{calling_conv} #{generate_arg_sequence($MAX_ARGS, '_', false, ", ")}, N, ...) N
+
+#define PP_RSEQ_N_MINUS#{arg_depth[0]}() \
+ #{generate_arg_sequence($MAX_ARGS, '', true, ',')}
+
+#define PP_NARG_MINUS#{arg_depth[1]}(...) \
+ EXPAND(PP_NARG_MINUS#{arg_depth[1]}_(__VA_ARGS__, PP_RSEQ_N_MINUS#{arg_depth[1]}()))
+
+#define PP_NARG_MINUS#{arg_depth[1]}_(...) \
+ EXPAND(PP_ARG_MINUS#{arg_depth[1]}_N(__VA_ARGS__))
+
+#define PP_ARG_MINUS#{arg_depth[1]}_N(#{calling_conv} #{generate_arg_sequence($MAX_ARGS, '_', false, ", ")}, N, ...) N
+
+#define PP_RSEQ_N_MINUS#{arg_depth[1]}() \
+ #{generate_arg_sequence($MAX_ARGS, '', true, ',')}
+
+
+
+/* DECLARE AND DEFINE FAKE FUNCTIONS - PLACE IN TEST FILES */
+
+#{counting_macro_instance(:VALUE, has_calling_conventions)}
+#{counting_macro_instance(:VOID, has_calling_conventions)}
+#{counting_macro_instance(:VALUE, has_calling_conventions, :vararg)}
+#{counting_macro_instance(:VOID, has_calling_conventions, :vararg)}
+
+/* DECLARE FAKE FUNCTIONS - PLACE IN HEADER FILES */
+
+#{counting_macro_instance(:VALUE, has_calling_conventions, :non_vararg, "DECLARE_")}
+#{counting_macro_instance(:VOID, has_calling_conventions, :non_vararg, "DECLARE_")}
+#{counting_macro_instance(:VALUE, has_calling_conventions, :vararg, "DECLARE_")}
+#{counting_macro_instance(:VOID, has_calling_conventions, :vararg, "DECLARE_")}
+
+/* DEFINE FAKE FUNCTIONS - PLACE IN SOURCE FILES */
+
+#{counting_macro_instance(:VALUE, has_calling_conventions, :non_vararg, "DEFINE_")}
+#{counting_macro_instance(:VOID, has_calling_conventions, :non_vararg, "DEFINE_")}
+#{counting_macro_instance(:VALUE, has_calling_conventions, :vararg, "DEFINE_")}
+#{counting_macro_instance(:VOID, has_calling_conventions, :vararg, "DEFINE_")}
+
+ MACRO_COUNTING
+end
+
+def output_c_and_cpp(has_calling_conventions)
+ license
+ include_guard {
+ include_dependencies
+ output_constants
+ output_default_function_pointer_macro(has_calling_conventions)
+ output_internal_helper_macros
+ yield
+ output_macro_counting_shortcuts(has_calling_conventions)
+ }
+end
+
+def help
+ # Check if we should generate _with_ support for specifying calling conventions
+ if (ARGV[0] == "--help" or ARGV[0] == "-h")
+ puts "Usage: fakegen.rb [options]
+ -h, --help Show this help message
+ -wcc, --with-calling-conventions Support specifying calling conventions"
+ exit
+ end
+ yield
+end
+
+help {
+ # Determine if we should generate with support for calling conventions
+ has_calling_conventions = true if (ARGV[0] == "--with-calling-conventions" or ARGV[0] == "-wcc")
+ # lets generate!!
+ output_c_and_cpp(has_calling_conventions) {
+ define_fff_globals
+ # Create fake generators for 0..MAX_ARGS
+ num_fake_generators = $MAX_ARGS + 1
+ num_fake_generators.times {|arg_count| output_macro(arg_count, false, has_calling_conventions, false)}
+ num_fake_generators.times {|arg_count| output_macro(arg_count, false, has_calling_conventions, true)}
+ # generate the varargs variants
+ (2..$MAX_ARGS).each {|arg_count| output_macro(arg_count, true, has_calling_conventions, false)}
+ (2..$MAX_ARGS).each {|arg_count| output_macro(arg_count, true, has_calling_conventions, true)}
+ }
+} \ No newline at end of file
diff --git a/deps/fff/fff.h b/deps/fff/fff.h
new file mode 100644
index 0000000..cdb1c46
--- /dev/null
+++ b/deps/fff/fff.h
@@ -0,0 +1,6588 @@
+/*
+LICENSE
+
+The MIT License (MIT)
+
+Copyright (c) 2010 Michael Long
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+*/
+#ifndef FAKE_FUNCTIONS
+#define FAKE_FUNCTIONS
+
+#include <stdarg.h>
+#include <string.h> /* For memset and memcpy */
+
+#define FFF_MAX_ARGS (20u)
+#ifndef FFF_ARG_HISTORY_LEN
+ #define FFF_ARG_HISTORY_LEN (50u)
+#endif
+#ifndef FFF_CALL_HISTORY_LEN
+ #define FFF_CALL_HISTORY_LEN (50u)
+#endif
+#ifndef FFF_GCC_FUNCTION_ATTRIBUTES
+ #define FFF_GCC_FUNCTION_ATTRIBUTES
+#endif
+#ifndef CUSTOM_FFF_FUNCTION_TEMPLATE
+#define CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN, FUNCNAME, ...) \
+ RETURN(*FUNCNAME)(__VA_ARGS__)
+#endif /* CUSTOM_FFF_FUNCTION_TEMPLATE */
+/* -- INTERNAL HELPER MACROS -- */
+#define SET_RETURN_SEQ(FUNCNAME, ARRAY_POINTER, ARRAY_LEN) \
+ FUNCNAME##_fake.return_val_seq = ARRAY_POINTER; \
+ FUNCNAME##_fake.return_val_seq_len = ARRAY_LEN;
+#define SET_CUSTOM_FAKE_SEQ(FUNCNAME, ARRAY_POINTER, ARRAY_LEN) \
+ FUNCNAME##_fake.custom_fake_seq = ARRAY_POINTER; \
+ FUNCNAME##_fake.custom_fake_seq_len = ARRAY_LEN;
+
+/* Defining a function to reset a fake function */
+#define RESET_FAKE(FUNCNAME) { \
+ FUNCNAME##_reset(); \
+} \
+
+
+#define DECLARE_ARG(type, n, FUNCNAME) \
+ type arg##n##_val; \
+ type arg##n##_history[FFF_ARG_HISTORY_LEN];
+
+#define DECLARE_ALL_FUNC_COMMON \
+ unsigned int call_count; \
+ unsigned int arg_history_len; \
+ unsigned int arg_histories_dropped; \
+
+#define DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ RETURN_TYPE return_val_history[FFF_ARG_HISTORY_LEN];
+
+#define SAVE_ARG(FUNCNAME, n) \
+ memcpy((void*)&FUNCNAME##_fake.arg##n##_val, (void*)&arg##n, sizeof(arg##n));
+
+#define ROOM_FOR_MORE_HISTORY(FUNCNAME) \
+ FUNCNAME##_fake.call_count < FFF_ARG_HISTORY_LEN
+
+#define SAVE_RET_HISTORY(FUNCNAME, RETVAL) \
+ if ((FUNCNAME##_fake.call_count - 1) < FFF_ARG_HISTORY_LEN) \
+ memcpy((void *)&FUNCNAME##_fake.return_val_history[FUNCNAME##_fake.call_count - 1], (const void *) &RETVAL, sizeof(RETVAL)); \
+
+#define SAVE_ARG_HISTORY(FUNCNAME, ARGN) \
+ memcpy((void*)&FUNCNAME##_fake.arg##ARGN##_history[FUNCNAME##_fake.call_count], (void*)&arg##ARGN, sizeof(arg##ARGN));
+
+#define HISTORY_DROPPED(FUNCNAME) \
+ FUNCNAME##_fake.arg_histories_dropped++
+
+#define DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ RETURN_TYPE return_val; \
+ int return_val_seq_len; \
+ int return_val_seq_idx; \
+ RETURN_TYPE * return_val_seq; \
+
+#define DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ int custom_fake_seq_len; \
+ int custom_fake_seq_idx; \
+
+#define INCREMENT_CALL_COUNT(FUNCNAME) \
+ FUNCNAME##_fake.call_count++
+
+#define RETURN_FAKE_RESULT(FUNCNAME) \
+ if (FUNCNAME##_fake.return_val_seq_len){ /* then its a sequence */ \
+ if(FUNCNAME##_fake.return_val_seq_idx < FUNCNAME##_fake.return_val_seq_len) { \
+ SAVE_RET_HISTORY(FUNCNAME, FUNCNAME##_fake.return_val_seq[FUNCNAME##_fake.return_val_seq_idx]) \
+ return FUNCNAME##_fake.return_val_seq[FUNCNAME##_fake.return_val_seq_idx++]; \
+ } \
+ SAVE_RET_HISTORY(FUNCNAME, FUNCNAME##_fake.return_val_seq[FUNCNAME##_fake.return_val_seq_len-1]) \
+ return FUNCNAME##_fake.return_val_seq[FUNCNAME##_fake.return_val_seq_len-1]; /* return last element */ \
+ } \
+ SAVE_RET_HISTORY(FUNCNAME, FUNCNAME##_fake.return_val) \
+ return FUNCNAME##_fake.return_val; \
+
+#ifdef __cplusplus
+ #define FFF_EXTERN_C extern "C"{
+ #define FFF_END_EXTERN_C }
+#else /* ansi c */
+ #define FFF_EXTERN_C
+ #define FFF_END_EXTERN_C
+#endif /* cpp/ansi c */
+
+#define DEFINE_RESET_FUNCTION(FUNCNAME) \
+ void FUNCNAME##_reset(void){ \
+ memset((void*)&FUNCNAME##_fake, 0, sizeof(FUNCNAME##_fake) - sizeof(FUNCNAME##_fake.custom_fake) - sizeof(FUNCNAME##_fake.custom_fake_seq)); \
+ FUNCNAME##_fake.custom_fake = NULL; \
+ FUNCNAME##_fake.custom_fake_seq = NULL; \
+ FUNCNAME##_fake.arg_history_len = FFF_ARG_HISTORY_LEN; \
+ }
+/* -- END INTERNAL HELPER MACROS -- */
+
+typedef void (*fff_function_t)(void);
+typedef struct {
+ fff_function_t call_history[FFF_CALL_HISTORY_LEN];
+ unsigned int call_history_idx;
+} fff_globals_t;
+
+FFF_EXTERN_C
+extern fff_globals_t fff;
+FFF_END_EXTERN_C
+
+#define DEFINE_FFF_GLOBALS \
+ FFF_EXTERN_C \
+ fff_globals_t fff; \
+ FFF_END_EXTERN_C
+
+#define FFF_RESET_HISTORY() \
+ fff.call_history_idx = 0; \
+ memset(fff.call_history, 0, sizeof(fff.call_history));
+
+#define REGISTER_CALL(function) \
+ if(fff.call_history_idx < FFF_CALL_HISTORY_LEN) \
+ fff.call_history[fff.call_history_idx++] = (fff_function_t)function;
+
+#define DECLARE_FAKE_VOID_FUNC0(FUNCNAME) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, void); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, void); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(void); \
+
+#define DEFINE_FAKE_VOID_FUNC0(FUNCNAME) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(void){ \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](); \
+ } \
+ else{ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](); \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake != NULL){ \
+ FUNCNAME##_fake.custom_fake(); \
+ } \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC0(FUNCNAME) \
+ DECLARE_FAKE_VOID_FUNC0(FUNCNAME) \
+ DEFINE_FAKE_VOID_FUNC0(FUNCNAME) \
+
+
+#define DECLARE_FAKE_VOID_FUNC1(FUNCNAME, ARG0_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0); \
+
+#define DEFINE_FAKE_VOID_FUNC1(FUNCNAME, ARG0_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0); \
+ } \
+ else{ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0); \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake != NULL){ \
+ FUNCNAME##_fake.custom_fake(arg0); \
+ } \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC1(FUNCNAME, ARG0_TYPE) \
+ DECLARE_FAKE_VOID_FUNC1(FUNCNAME, ARG0_TYPE) \
+ DEFINE_FAKE_VOID_FUNC1(FUNCNAME, ARG0_TYPE) \
+
+
+#define DECLARE_FAKE_VOID_FUNC2(FUNCNAME, ARG0_TYPE, ARG1_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1); \
+
+#define DEFINE_FAKE_VOID_FUNC2(FUNCNAME, ARG0_TYPE, ARG1_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1); \
+ } \
+ else{ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1); \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake != NULL){ \
+ FUNCNAME##_fake.custom_fake(arg0, arg1); \
+ } \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC2(FUNCNAME, ARG0_TYPE, ARG1_TYPE) \
+ DECLARE_FAKE_VOID_FUNC2(FUNCNAME, ARG0_TYPE, ARG1_TYPE) \
+ DEFINE_FAKE_VOID_FUNC2(FUNCNAME, ARG0_TYPE, ARG1_TYPE) \
+
+
+#define DECLARE_FAKE_VOID_FUNC3(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2); \
+
+#define DEFINE_FAKE_VOID_FUNC3(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2); \
+ } \
+ else{ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2); \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake != NULL){ \
+ FUNCNAME##_fake.custom_fake(arg0, arg1, arg2); \
+ } \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC3(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE) \
+ DECLARE_FAKE_VOID_FUNC3(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE) \
+ DEFINE_FAKE_VOID_FUNC3(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE) \
+
+
+#define DECLARE_FAKE_VOID_FUNC4(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3); \
+
+#define DEFINE_FAKE_VOID_FUNC4(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3); \
+ } \
+ else{ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3); \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake != NULL){ \
+ FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3); \
+ } \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC4(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE) \
+ DECLARE_FAKE_VOID_FUNC4(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE) \
+ DEFINE_FAKE_VOID_FUNC4(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE) \
+
+
+#define DECLARE_FAKE_VOID_FUNC5(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4); \
+
+#define DEFINE_FAKE_VOID_FUNC5(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4); \
+ } \
+ else{ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4); \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake != NULL){ \
+ FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4); \
+ } \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC5(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE) \
+ DECLARE_FAKE_VOID_FUNC5(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE) \
+ DEFINE_FAKE_VOID_FUNC5(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE) \
+
+
+#define DECLARE_FAKE_VOID_FUNC6(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5); \
+
+#define DEFINE_FAKE_VOID_FUNC6(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5); \
+ } \
+ else{ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5); \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake != NULL){ \
+ FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5); \
+ } \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC6(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE) \
+ DECLARE_FAKE_VOID_FUNC6(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE) \
+ DEFINE_FAKE_VOID_FUNC6(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE) \
+
+
+#define DECLARE_FAKE_VOID_FUNC7(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6); \
+
+#define DEFINE_FAKE_VOID_FUNC7(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6); \
+ } \
+ else{ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6); \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake != NULL){ \
+ FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6); \
+ } \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC7(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE) \
+ DECLARE_FAKE_VOID_FUNC7(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE) \
+ DEFINE_FAKE_VOID_FUNC7(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE) \
+
+
+#define DECLARE_FAKE_VOID_FUNC8(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7); \
+
+#define DEFINE_FAKE_VOID_FUNC8(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7); \
+ } \
+ else{ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7); \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake != NULL){ \
+ FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7); \
+ } \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC8(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE) \
+ DECLARE_FAKE_VOID_FUNC8(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE) \
+ DEFINE_FAKE_VOID_FUNC8(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE) \
+
+
+#define DECLARE_FAKE_VOID_FUNC9(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8); \
+
+#define DEFINE_FAKE_VOID_FUNC9(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); \
+ } \
+ else{ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake != NULL){ \
+ FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); \
+ } \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC9(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE) \
+ DECLARE_FAKE_VOID_FUNC9(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE) \
+ DEFINE_FAKE_VOID_FUNC9(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE) \
+
+
+#define DECLARE_FAKE_VOID_FUNC10(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9); \
+
+#define DEFINE_FAKE_VOID_FUNC10(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); \
+ } \
+ else{ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake != NULL){ \
+ FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); \
+ } \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC10(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE) \
+ DECLARE_FAKE_VOID_FUNC10(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE) \
+ DEFINE_FAKE_VOID_FUNC10(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE) \
+
+
+#define DECLARE_FAKE_VOID_FUNC11(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10); \
+
+#define DEFINE_FAKE_VOID_FUNC11(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10); \
+ } \
+ else{ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10); \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake != NULL){ \
+ FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10); \
+ } \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC11(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE) \
+ DECLARE_FAKE_VOID_FUNC11(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE) \
+ DEFINE_FAKE_VOID_FUNC11(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE) \
+
+
+#define DECLARE_FAKE_VOID_FUNC12(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11); \
+
+#define DEFINE_FAKE_VOID_FUNC12(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ SAVE_ARG(FUNCNAME, 11); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ SAVE_ARG_HISTORY(FUNCNAME, 11); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11); \
+ } \
+ else{ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11); \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake != NULL){ \
+ FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11); \
+ } \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC12(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE) \
+ DECLARE_FAKE_VOID_FUNC12(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE) \
+ DEFINE_FAKE_VOID_FUNC12(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE) \
+
+
+#define DECLARE_FAKE_VOID_FUNC13(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
+ DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12); \
+
+#define DEFINE_FAKE_VOID_FUNC13(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ SAVE_ARG(FUNCNAME, 11); \
+ SAVE_ARG(FUNCNAME, 12); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ SAVE_ARG_HISTORY(FUNCNAME, 11); \
+ SAVE_ARG_HISTORY(FUNCNAME, 12); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12); \
+ } \
+ else{ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12); \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake != NULL){ \
+ FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12); \
+ } \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC13(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE) \
+ DECLARE_FAKE_VOID_FUNC13(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE) \
+ DEFINE_FAKE_VOID_FUNC13(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE) \
+
+
+#define DECLARE_FAKE_VOID_FUNC14(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
+ DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
+ DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13); \
+
+#define DEFINE_FAKE_VOID_FUNC14(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ SAVE_ARG(FUNCNAME, 11); \
+ SAVE_ARG(FUNCNAME, 12); \
+ SAVE_ARG(FUNCNAME, 13); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ SAVE_ARG_HISTORY(FUNCNAME, 11); \
+ SAVE_ARG_HISTORY(FUNCNAME, 12); \
+ SAVE_ARG_HISTORY(FUNCNAME, 13); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13); \
+ } \
+ else{ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13); \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake != NULL){ \
+ FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13); \
+ } \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC14(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE) \
+ DECLARE_FAKE_VOID_FUNC14(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE) \
+ DEFINE_FAKE_VOID_FUNC14(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE) \
+
+
+#define DECLARE_FAKE_VOID_FUNC15(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
+ DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
+ DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
+ DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14); \
+
+#define DEFINE_FAKE_VOID_FUNC15(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ SAVE_ARG(FUNCNAME, 11); \
+ SAVE_ARG(FUNCNAME, 12); \
+ SAVE_ARG(FUNCNAME, 13); \
+ SAVE_ARG(FUNCNAME, 14); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ SAVE_ARG_HISTORY(FUNCNAME, 11); \
+ SAVE_ARG_HISTORY(FUNCNAME, 12); \
+ SAVE_ARG_HISTORY(FUNCNAME, 13); \
+ SAVE_ARG_HISTORY(FUNCNAME, 14); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14); \
+ } \
+ else{ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14); \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake != NULL){ \
+ FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14); \
+ } \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC15(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE) \
+ DECLARE_FAKE_VOID_FUNC15(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE) \
+ DEFINE_FAKE_VOID_FUNC15(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE) \
+
+
+#define DECLARE_FAKE_VOID_FUNC16(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
+ DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
+ DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
+ DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
+ DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15); \
+
+#define DEFINE_FAKE_VOID_FUNC16(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ SAVE_ARG(FUNCNAME, 11); \
+ SAVE_ARG(FUNCNAME, 12); \
+ SAVE_ARG(FUNCNAME, 13); \
+ SAVE_ARG(FUNCNAME, 14); \
+ SAVE_ARG(FUNCNAME, 15); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ SAVE_ARG_HISTORY(FUNCNAME, 11); \
+ SAVE_ARG_HISTORY(FUNCNAME, 12); \
+ SAVE_ARG_HISTORY(FUNCNAME, 13); \
+ SAVE_ARG_HISTORY(FUNCNAME, 14); \
+ SAVE_ARG_HISTORY(FUNCNAME, 15); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15); \
+ } \
+ else{ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15); \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake != NULL){ \
+ FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15); \
+ } \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC16(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE) \
+ DECLARE_FAKE_VOID_FUNC16(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE) \
+ DEFINE_FAKE_VOID_FUNC16(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE) \
+
+
+#define DECLARE_FAKE_VOID_FUNC17(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
+ DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
+ DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
+ DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
+ DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
+ DECLARE_ARG(ARG16_TYPE, 16, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16); \
+
+#define DEFINE_FAKE_VOID_FUNC17(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ SAVE_ARG(FUNCNAME, 11); \
+ SAVE_ARG(FUNCNAME, 12); \
+ SAVE_ARG(FUNCNAME, 13); \
+ SAVE_ARG(FUNCNAME, 14); \
+ SAVE_ARG(FUNCNAME, 15); \
+ SAVE_ARG(FUNCNAME, 16); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ SAVE_ARG_HISTORY(FUNCNAME, 11); \
+ SAVE_ARG_HISTORY(FUNCNAME, 12); \
+ SAVE_ARG_HISTORY(FUNCNAME, 13); \
+ SAVE_ARG_HISTORY(FUNCNAME, 14); \
+ SAVE_ARG_HISTORY(FUNCNAME, 15); \
+ SAVE_ARG_HISTORY(FUNCNAME, 16); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16); \
+ } \
+ else{ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16); \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake != NULL){ \
+ FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16); \
+ } \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC17(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE) \
+ DECLARE_FAKE_VOID_FUNC17(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE) \
+ DEFINE_FAKE_VOID_FUNC17(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE) \
+
+
+#define DECLARE_FAKE_VOID_FUNC18(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
+ DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
+ DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
+ DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
+ DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
+ DECLARE_ARG(ARG16_TYPE, 16, FUNCNAME) \
+ DECLARE_ARG(ARG17_TYPE, 17, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17); \
+
+#define DEFINE_FAKE_VOID_FUNC18(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ SAVE_ARG(FUNCNAME, 11); \
+ SAVE_ARG(FUNCNAME, 12); \
+ SAVE_ARG(FUNCNAME, 13); \
+ SAVE_ARG(FUNCNAME, 14); \
+ SAVE_ARG(FUNCNAME, 15); \
+ SAVE_ARG(FUNCNAME, 16); \
+ SAVE_ARG(FUNCNAME, 17); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ SAVE_ARG_HISTORY(FUNCNAME, 11); \
+ SAVE_ARG_HISTORY(FUNCNAME, 12); \
+ SAVE_ARG_HISTORY(FUNCNAME, 13); \
+ SAVE_ARG_HISTORY(FUNCNAME, 14); \
+ SAVE_ARG_HISTORY(FUNCNAME, 15); \
+ SAVE_ARG_HISTORY(FUNCNAME, 16); \
+ SAVE_ARG_HISTORY(FUNCNAME, 17); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17); \
+ } \
+ else{ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17); \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake != NULL){ \
+ FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17); \
+ } \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC18(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE) \
+ DECLARE_FAKE_VOID_FUNC18(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE) \
+ DEFINE_FAKE_VOID_FUNC18(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE) \
+
+
+#define DECLARE_FAKE_VOID_FUNC19(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
+ DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
+ DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
+ DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
+ DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
+ DECLARE_ARG(ARG16_TYPE, 16, FUNCNAME) \
+ DECLARE_ARG(ARG17_TYPE, 17, FUNCNAME) \
+ DECLARE_ARG(ARG18_TYPE, 18, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18); \
+
+#define DEFINE_FAKE_VOID_FUNC19(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ SAVE_ARG(FUNCNAME, 11); \
+ SAVE_ARG(FUNCNAME, 12); \
+ SAVE_ARG(FUNCNAME, 13); \
+ SAVE_ARG(FUNCNAME, 14); \
+ SAVE_ARG(FUNCNAME, 15); \
+ SAVE_ARG(FUNCNAME, 16); \
+ SAVE_ARG(FUNCNAME, 17); \
+ SAVE_ARG(FUNCNAME, 18); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ SAVE_ARG_HISTORY(FUNCNAME, 11); \
+ SAVE_ARG_HISTORY(FUNCNAME, 12); \
+ SAVE_ARG_HISTORY(FUNCNAME, 13); \
+ SAVE_ARG_HISTORY(FUNCNAME, 14); \
+ SAVE_ARG_HISTORY(FUNCNAME, 15); \
+ SAVE_ARG_HISTORY(FUNCNAME, 16); \
+ SAVE_ARG_HISTORY(FUNCNAME, 17); \
+ SAVE_ARG_HISTORY(FUNCNAME, 18); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18); \
+ } \
+ else{ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18); \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake != NULL){ \
+ FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18); \
+ } \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC19(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE) \
+ DECLARE_FAKE_VOID_FUNC19(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE) \
+ DEFINE_FAKE_VOID_FUNC19(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE) \
+
+
+#define DECLARE_FAKE_VOID_FUNC20(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ARG19_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
+ DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
+ DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
+ DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
+ DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
+ DECLARE_ARG(ARG16_TYPE, 16, FUNCNAME) \
+ DECLARE_ARG(ARG17_TYPE, 17, FUNCNAME) \
+ DECLARE_ARG(ARG18_TYPE, 18, FUNCNAME) \
+ DECLARE_ARG(ARG19_TYPE, 19, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ARG19_TYPE); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ARG19_TYPE); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18, ARG19_TYPE arg19); \
+
+#define DEFINE_FAKE_VOID_FUNC20(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ARG19_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18, ARG19_TYPE arg19){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ SAVE_ARG(FUNCNAME, 11); \
+ SAVE_ARG(FUNCNAME, 12); \
+ SAVE_ARG(FUNCNAME, 13); \
+ SAVE_ARG(FUNCNAME, 14); \
+ SAVE_ARG(FUNCNAME, 15); \
+ SAVE_ARG(FUNCNAME, 16); \
+ SAVE_ARG(FUNCNAME, 17); \
+ SAVE_ARG(FUNCNAME, 18); \
+ SAVE_ARG(FUNCNAME, 19); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ SAVE_ARG_HISTORY(FUNCNAME, 11); \
+ SAVE_ARG_HISTORY(FUNCNAME, 12); \
+ SAVE_ARG_HISTORY(FUNCNAME, 13); \
+ SAVE_ARG_HISTORY(FUNCNAME, 14); \
+ SAVE_ARG_HISTORY(FUNCNAME, 15); \
+ SAVE_ARG_HISTORY(FUNCNAME, 16); \
+ SAVE_ARG_HISTORY(FUNCNAME, 17); \
+ SAVE_ARG_HISTORY(FUNCNAME, 18); \
+ SAVE_ARG_HISTORY(FUNCNAME, 19); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19); \
+ } \
+ else{ \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19); \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake != NULL){ \
+ FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19); \
+ } \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC20(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ARG19_TYPE) \
+ DECLARE_FAKE_VOID_FUNC20(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ARG19_TYPE) \
+ DEFINE_FAKE_VOID_FUNC20(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ARG19_TYPE) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC0(RETURN_TYPE, FUNCNAME) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, void); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, void); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(void); \
+
+#define DEFINE_FAKE_VALUE_FUNC0(RETURN_TYPE, FUNCNAME) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(void){ \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ else{ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake != NULL){ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake(); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC0(RETURN_TYPE, FUNCNAME) \
+ DECLARE_FAKE_VALUE_FUNC0(RETURN_TYPE, FUNCNAME) \
+ DEFINE_FAKE_VALUE_FUNC0(RETURN_TYPE, FUNCNAME) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC1(RETURN_TYPE, FUNCNAME, ARG0_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0); \
+
+#define DEFINE_FAKE_VALUE_FUNC1(RETURN_TYPE, FUNCNAME, ARG0_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ else{ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake != NULL){ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake(arg0); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC1(RETURN_TYPE, FUNCNAME, ARG0_TYPE) \
+ DECLARE_FAKE_VALUE_FUNC1(RETURN_TYPE, FUNCNAME, ARG0_TYPE) \
+ DEFINE_FAKE_VALUE_FUNC1(RETURN_TYPE, FUNCNAME, ARG0_TYPE) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC2(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1); \
+
+#define DEFINE_FAKE_VALUE_FUNC2(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ else{ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake != NULL){ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake(arg0, arg1); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC2(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE) \
+ DECLARE_FAKE_VALUE_FUNC2(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE) \
+ DEFINE_FAKE_VALUE_FUNC2(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC3(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2); \
+
+#define DEFINE_FAKE_VALUE_FUNC3(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ else{ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake != NULL){ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC3(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE) \
+ DECLARE_FAKE_VALUE_FUNC3(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE) \
+ DEFINE_FAKE_VALUE_FUNC3(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC4(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3); \
+
+#define DEFINE_FAKE_VALUE_FUNC4(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ else{ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake != NULL){ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC4(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE) \
+ DECLARE_FAKE_VALUE_FUNC4(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE) \
+ DEFINE_FAKE_VALUE_FUNC4(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC5(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4); \
+
+#define DEFINE_FAKE_VALUE_FUNC5(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ else{ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake != NULL){ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC5(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE) \
+ DECLARE_FAKE_VALUE_FUNC5(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE) \
+ DEFINE_FAKE_VALUE_FUNC5(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC6(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5); \
+
+#define DEFINE_FAKE_VALUE_FUNC6(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ else{ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake != NULL){ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC6(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE) \
+ DECLARE_FAKE_VALUE_FUNC6(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE) \
+ DEFINE_FAKE_VALUE_FUNC6(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC7(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6); \
+
+#define DEFINE_FAKE_VALUE_FUNC7(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ else{ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake != NULL){ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC7(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE) \
+ DECLARE_FAKE_VALUE_FUNC7(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE) \
+ DEFINE_FAKE_VALUE_FUNC7(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC8(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7); \
+
+#define DEFINE_FAKE_VALUE_FUNC8(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ else{ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake != NULL){ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC8(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE) \
+ DECLARE_FAKE_VALUE_FUNC8(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE) \
+ DEFINE_FAKE_VALUE_FUNC8(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC9(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8); \
+
+#define DEFINE_FAKE_VALUE_FUNC9(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ else{ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake != NULL){ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC9(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE) \
+ DECLARE_FAKE_VALUE_FUNC9(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE) \
+ DEFINE_FAKE_VALUE_FUNC9(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC10(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9); \
+
+#define DEFINE_FAKE_VALUE_FUNC10(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ else{ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake != NULL){ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC10(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE) \
+ DECLARE_FAKE_VALUE_FUNC10(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE) \
+ DEFINE_FAKE_VALUE_FUNC10(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC11(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10); \
+
+#define DEFINE_FAKE_VALUE_FUNC11(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ else{ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake != NULL){ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC11(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE) \
+ DECLARE_FAKE_VALUE_FUNC11(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE) \
+ DEFINE_FAKE_VALUE_FUNC11(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC12(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11); \
+
+#define DEFINE_FAKE_VALUE_FUNC12(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ SAVE_ARG(FUNCNAME, 11); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ SAVE_ARG_HISTORY(FUNCNAME, 11); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ else{ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake != NULL){ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC12(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE) \
+ DECLARE_FAKE_VALUE_FUNC12(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE) \
+ DEFINE_FAKE_VALUE_FUNC12(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC13(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
+ DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12); \
+
+#define DEFINE_FAKE_VALUE_FUNC13(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ SAVE_ARG(FUNCNAME, 11); \
+ SAVE_ARG(FUNCNAME, 12); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ SAVE_ARG_HISTORY(FUNCNAME, 11); \
+ SAVE_ARG_HISTORY(FUNCNAME, 12); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ else{ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake != NULL){ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC13(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE) \
+ DECLARE_FAKE_VALUE_FUNC13(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE) \
+ DEFINE_FAKE_VALUE_FUNC13(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC14(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
+ DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
+ DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13); \
+
+#define DEFINE_FAKE_VALUE_FUNC14(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ SAVE_ARG(FUNCNAME, 11); \
+ SAVE_ARG(FUNCNAME, 12); \
+ SAVE_ARG(FUNCNAME, 13); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ SAVE_ARG_HISTORY(FUNCNAME, 11); \
+ SAVE_ARG_HISTORY(FUNCNAME, 12); \
+ SAVE_ARG_HISTORY(FUNCNAME, 13); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ else{ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake != NULL){ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC14(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE) \
+ DECLARE_FAKE_VALUE_FUNC14(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE) \
+ DEFINE_FAKE_VALUE_FUNC14(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC15(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
+ DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
+ DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
+ DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14); \
+
+#define DEFINE_FAKE_VALUE_FUNC15(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ SAVE_ARG(FUNCNAME, 11); \
+ SAVE_ARG(FUNCNAME, 12); \
+ SAVE_ARG(FUNCNAME, 13); \
+ SAVE_ARG(FUNCNAME, 14); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ SAVE_ARG_HISTORY(FUNCNAME, 11); \
+ SAVE_ARG_HISTORY(FUNCNAME, 12); \
+ SAVE_ARG_HISTORY(FUNCNAME, 13); \
+ SAVE_ARG_HISTORY(FUNCNAME, 14); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ else{ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake != NULL){ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC15(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE) \
+ DECLARE_FAKE_VALUE_FUNC15(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE) \
+ DEFINE_FAKE_VALUE_FUNC15(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC16(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
+ DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
+ DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
+ DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
+ DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15); \
+
+#define DEFINE_FAKE_VALUE_FUNC16(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ SAVE_ARG(FUNCNAME, 11); \
+ SAVE_ARG(FUNCNAME, 12); \
+ SAVE_ARG(FUNCNAME, 13); \
+ SAVE_ARG(FUNCNAME, 14); \
+ SAVE_ARG(FUNCNAME, 15); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ SAVE_ARG_HISTORY(FUNCNAME, 11); \
+ SAVE_ARG_HISTORY(FUNCNAME, 12); \
+ SAVE_ARG_HISTORY(FUNCNAME, 13); \
+ SAVE_ARG_HISTORY(FUNCNAME, 14); \
+ SAVE_ARG_HISTORY(FUNCNAME, 15); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ else{ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake != NULL){ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC16(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE) \
+ DECLARE_FAKE_VALUE_FUNC16(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE) \
+ DEFINE_FAKE_VALUE_FUNC16(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC17(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
+ DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
+ DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
+ DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
+ DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
+ DECLARE_ARG(ARG16_TYPE, 16, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16); \
+
+#define DEFINE_FAKE_VALUE_FUNC17(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ SAVE_ARG(FUNCNAME, 11); \
+ SAVE_ARG(FUNCNAME, 12); \
+ SAVE_ARG(FUNCNAME, 13); \
+ SAVE_ARG(FUNCNAME, 14); \
+ SAVE_ARG(FUNCNAME, 15); \
+ SAVE_ARG(FUNCNAME, 16); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ SAVE_ARG_HISTORY(FUNCNAME, 11); \
+ SAVE_ARG_HISTORY(FUNCNAME, 12); \
+ SAVE_ARG_HISTORY(FUNCNAME, 13); \
+ SAVE_ARG_HISTORY(FUNCNAME, 14); \
+ SAVE_ARG_HISTORY(FUNCNAME, 15); \
+ SAVE_ARG_HISTORY(FUNCNAME, 16); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ else{ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake != NULL){ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC17(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE) \
+ DECLARE_FAKE_VALUE_FUNC17(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE) \
+ DEFINE_FAKE_VALUE_FUNC17(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC18(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
+ DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
+ DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
+ DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
+ DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
+ DECLARE_ARG(ARG16_TYPE, 16, FUNCNAME) \
+ DECLARE_ARG(ARG17_TYPE, 17, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17); \
+
+#define DEFINE_FAKE_VALUE_FUNC18(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ SAVE_ARG(FUNCNAME, 11); \
+ SAVE_ARG(FUNCNAME, 12); \
+ SAVE_ARG(FUNCNAME, 13); \
+ SAVE_ARG(FUNCNAME, 14); \
+ SAVE_ARG(FUNCNAME, 15); \
+ SAVE_ARG(FUNCNAME, 16); \
+ SAVE_ARG(FUNCNAME, 17); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ SAVE_ARG_HISTORY(FUNCNAME, 11); \
+ SAVE_ARG_HISTORY(FUNCNAME, 12); \
+ SAVE_ARG_HISTORY(FUNCNAME, 13); \
+ SAVE_ARG_HISTORY(FUNCNAME, 14); \
+ SAVE_ARG_HISTORY(FUNCNAME, 15); \
+ SAVE_ARG_HISTORY(FUNCNAME, 16); \
+ SAVE_ARG_HISTORY(FUNCNAME, 17); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ else{ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake != NULL){ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC18(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE) \
+ DECLARE_FAKE_VALUE_FUNC18(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE) \
+ DEFINE_FAKE_VALUE_FUNC18(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC19(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
+ DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
+ DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
+ DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
+ DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
+ DECLARE_ARG(ARG16_TYPE, 16, FUNCNAME) \
+ DECLARE_ARG(ARG17_TYPE, 17, FUNCNAME) \
+ DECLARE_ARG(ARG18_TYPE, 18, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18); \
+
+#define DEFINE_FAKE_VALUE_FUNC19(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ SAVE_ARG(FUNCNAME, 11); \
+ SAVE_ARG(FUNCNAME, 12); \
+ SAVE_ARG(FUNCNAME, 13); \
+ SAVE_ARG(FUNCNAME, 14); \
+ SAVE_ARG(FUNCNAME, 15); \
+ SAVE_ARG(FUNCNAME, 16); \
+ SAVE_ARG(FUNCNAME, 17); \
+ SAVE_ARG(FUNCNAME, 18); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ SAVE_ARG_HISTORY(FUNCNAME, 11); \
+ SAVE_ARG_HISTORY(FUNCNAME, 12); \
+ SAVE_ARG_HISTORY(FUNCNAME, 13); \
+ SAVE_ARG_HISTORY(FUNCNAME, 14); \
+ SAVE_ARG_HISTORY(FUNCNAME, 15); \
+ SAVE_ARG_HISTORY(FUNCNAME, 16); \
+ SAVE_ARG_HISTORY(FUNCNAME, 17); \
+ SAVE_ARG_HISTORY(FUNCNAME, 18); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ else{ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake != NULL){ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC19(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE) \
+ DECLARE_FAKE_VALUE_FUNC19(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE) \
+ DEFINE_FAKE_VALUE_FUNC19(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC20(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ARG19_TYPE) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
+ DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
+ DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
+ DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
+ DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
+ DECLARE_ARG(ARG16_TYPE, 16, FUNCNAME) \
+ DECLARE_ARG(ARG17_TYPE, 17, FUNCNAME) \
+ DECLARE_ARG(ARG18_TYPE, 18, FUNCNAME) \
+ DECLARE_ARG(ARG19_TYPE, 19, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ARG19_TYPE); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ARG19_TYPE); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18, ARG19_TYPE arg19); \
+
+#define DEFINE_FAKE_VALUE_FUNC20(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ARG19_TYPE) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18, ARG19_TYPE arg19){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ SAVE_ARG(FUNCNAME, 11); \
+ SAVE_ARG(FUNCNAME, 12); \
+ SAVE_ARG(FUNCNAME, 13); \
+ SAVE_ARG(FUNCNAME, 14); \
+ SAVE_ARG(FUNCNAME, 15); \
+ SAVE_ARG(FUNCNAME, 16); \
+ SAVE_ARG(FUNCNAME, 17); \
+ SAVE_ARG(FUNCNAME, 18); \
+ SAVE_ARG(FUNCNAME, 19); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ SAVE_ARG_HISTORY(FUNCNAME, 11); \
+ SAVE_ARG_HISTORY(FUNCNAME, 12); \
+ SAVE_ARG_HISTORY(FUNCNAME, 13); \
+ SAVE_ARG_HISTORY(FUNCNAME, 14); \
+ SAVE_ARG_HISTORY(FUNCNAME, 15); \
+ SAVE_ARG_HISTORY(FUNCNAME, 16); \
+ SAVE_ARG_HISTORY(FUNCNAME, 17); \
+ SAVE_ARG_HISTORY(FUNCNAME, 18); \
+ SAVE_ARG_HISTORY(FUNCNAME, 19); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ else{ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ } \
+ if (FUNCNAME##_fake.custom_fake != NULL){ \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC20(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ARG19_TYPE) \
+ DECLARE_FAKE_VALUE_FUNC20(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ARG19_TYPE) \
+ DEFINE_FAKE_VALUE_FUNC20(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ARG19_TYPE) \
+
+
+#define DECLARE_FAKE_VOID_FUNC2_VARARG(FUNCNAME, ARG0_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, va_list ap); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ...); \
+
+#define DEFINE_FAKE_VOID_FUNC2_VARARG(FUNCNAME, ARG0_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg0); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, ap); \
+ va_end(ap); \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg0); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, ap); \
+ va_end(ap); \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ va_list ap; \
+ va_start(ap, arg0); \
+ FUNCNAME##_fake.custom_fake(arg0, ap); \
+ va_end(ap); \
+ } \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC2_VARARG(FUNCNAME, ARG0_TYPE, ...) \
+ DECLARE_FAKE_VOID_FUNC2_VARARG(FUNCNAME, ARG0_TYPE, ...) \
+ DEFINE_FAKE_VOID_FUNC2_VARARG(FUNCNAME, ARG0_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VOID_FUNC3_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE, va_list ap); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ...); \
+
+#define DEFINE_FAKE_VOID_FUNC3_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg1); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, ap); \
+ va_end(ap); \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg1); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, ap); \
+ va_end(ap); \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ va_list ap; \
+ va_start(ap, arg1); \
+ FUNCNAME##_fake.custom_fake(arg0, arg1, ap); \
+ va_end(ap); \
+ } \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC3_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ...) \
+ DECLARE_FAKE_VOID_FUNC3_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ...) \
+ DEFINE_FAKE_VOID_FUNC3_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VOID_FUNC4_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, va_list ap); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ...); \
+
+#define DEFINE_FAKE_VOID_FUNC4_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg2); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, ap); \
+ va_end(ap); \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg2); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, ap); \
+ va_end(ap); \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ va_list ap; \
+ va_start(ap, arg2); \
+ FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, ap); \
+ va_end(ap); \
+ } \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC4_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ...) \
+ DECLARE_FAKE_VOID_FUNC4_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ...) \
+ DEFINE_FAKE_VOID_FUNC4_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VOID_FUNC5_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, va_list ap); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ...); \
+
+#define DEFINE_FAKE_VOID_FUNC5_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg3); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, ap); \
+ va_end(ap); \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg3); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, ap); \
+ va_end(ap); \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ va_list ap; \
+ va_start(ap, arg3); \
+ FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, ap); \
+ va_end(ap); \
+ } \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC5_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ...) \
+ DECLARE_FAKE_VOID_FUNC5_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ...) \
+ DEFINE_FAKE_VOID_FUNC5_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VOID_FUNC6_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, va_list ap); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ...); \
+
+#define DEFINE_FAKE_VOID_FUNC6_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg4); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, ap); \
+ va_end(ap); \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg4); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, ap); \
+ va_end(ap); \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ va_list ap; \
+ va_start(ap, arg4); \
+ FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, ap); \
+ va_end(ap); \
+ } \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC6_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ...) \
+ DECLARE_FAKE_VOID_FUNC6_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ...) \
+ DEFINE_FAKE_VOID_FUNC6_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VOID_FUNC7_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, va_list ap); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ...); \
+
+#define DEFINE_FAKE_VOID_FUNC7_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg5); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, ap); \
+ va_end(ap); \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg5); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, ap); \
+ va_end(ap); \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ va_list ap; \
+ va_start(ap, arg5); \
+ FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, ap); \
+ va_end(ap); \
+ } \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC7_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ...) \
+ DECLARE_FAKE_VOID_FUNC7_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ...) \
+ DEFINE_FAKE_VOID_FUNC7_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VOID_FUNC8_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, va_list ap); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ...); \
+
+#define DEFINE_FAKE_VOID_FUNC8_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg6); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, ap); \
+ va_end(ap); \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg6); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, ap); \
+ va_end(ap); \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ va_list ap; \
+ va_start(ap, arg6); \
+ FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, ap); \
+ va_end(ap); \
+ } \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC8_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ...) \
+ DECLARE_FAKE_VOID_FUNC8_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ...) \
+ DEFINE_FAKE_VOID_FUNC8_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VOID_FUNC9_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, va_list ap); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ...); \
+
+#define DEFINE_FAKE_VOID_FUNC9_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg7); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, ap); \
+ va_end(ap); \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg7); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, ap); \
+ va_end(ap); \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ va_list ap; \
+ va_start(ap, arg7); \
+ FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, ap); \
+ va_end(ap); \
+ } \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC9_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ...) \
+ DECLARE_FAKE_VOID_FUNC9_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ...) \
+ DEFINE_FAKE_VOID_FUNC9_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VOID_FUNC10_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, va_list ap); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ...); \
+
+#define DEFINE_FAKE_VOID_FUNC10_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg8); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, ap); \
+ va_end(ap); \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg8); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, ap); \
+ va_end(ap); \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ va_list ap; \
+ va_start(ap, arg8); \
+ FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, ap); \
+ va_end(ap); \
+ } \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC10_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ...) \
+ DECLARE_FAKE_VOID_FUNC10_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ...) \
+ DEFINE_FAKE_VOID_FUNC10_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VOID_FUNC11_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, va_list ap); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ...); \
+
+#define DEFINE_FAKE_VOID_FUNC11_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg9); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, ap); \
+ va_end(ap); \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg9); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, ap); \
+ va_end(ap); \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ va_list ap; \
+ va_start(ap, arg9); \
+ FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, ap); \
+ va_end(ap); \
+ } \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC11_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ...) \
+ DECLARE_FAKE_VOID_FUNC11_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ...) \
+ DEFINE_FAKE_VOID_FUNC11_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VOID_FUNC12_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, va_list ap); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ...); \
+
+#define DEFINE_FAKE_VOID_FUNC12_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg10); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, ap); \
+ va_end(ap); \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg10); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, ap); \
+ va_end(ap); \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ va_list ap; \
+ va_start(ap, arg10); \
+ FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, ap); \
+ va_end(ap); \
+ } \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC12_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ...) \
+ DECLARE_FAKE_VOID_FUNC12_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ...) \
+ DEFINE_FAKE_VOID_FUNC12_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VOID_FUNC13_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, va_list ap); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ...); \
+
+#define DEFINE_FAKE_VOID_FUNC13_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ SAVE_ARG(FUNCNAME, 11); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ SAVE_ARG_HISTORY(FUNCNAME, 11); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg11); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, ap); \
+ va_end(ap); \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg11); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, ap); \
+ va_end(ap); \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ va_list ap; \
+ va_start(ap, arg11); \
+ FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, ap); \
+ va_end(ap); \
+ } \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC13_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ...) \
+ DECLARE_FAKE_VOID_FUNC13_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ...) \
+ DEFINE_FAKE_VOID_FUNC13_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VOID_FUNC14_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
+ DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, va_list ap); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ...); \
+
+#define DEFINE_FAKE_VOID_FUNC14_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ SAVE_ARG(FUNCNAME, 11); \
+ SAVE_ARG(FUNCNAME, 12); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ SAVE_ARG_HISTORY(FUNCNAME, 11); \
+ SAVE_ARG_HISTORY(FUNCNAME, 12); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg12); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, ap); \
+ va_end(ap); \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg12); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, ap); \
+ va_end(ap); \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ va_list ap; \
+ va_start(ap, arg12); \
+ FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, ap); \
+ va_end(ap); \
+ } \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC14_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ...) \
+ DECLARE_FAKE_VOID_FUNC14_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ...) \
+ DEFINE_FAKE_VOID_FUNC14_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VOID_FUNC15_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
+ DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
+ DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, va_list ap); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ...); \
+
+#define DEFINE_FAKE_VOID_FUNC15_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ SAVE_ARG(FUNCNAME, 11); \
+ SAVE_ARG(FUNCNAME, 12); \
+ SAVE_ARG(FUNCNAME, 13); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ SAVE_ARG_HISTORY(FUNCNAME, 11); \
+ SAVE_ARG_HISTORY(FUNCNAME, 12); \
+ SAVE_ARG_HISTORY(FUNCNAME, 13); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg13); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, ap); \
+ va_end(ap); \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg13); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, ap); \
+ va_end(ap); \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ va_list ap; \
+ va_start(ap, arg13); \
+ FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, ap); \
+ va_end(ap); \
+ } \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC15_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ...) \
+ DECLARE_FAKE_VOID_FUNC15_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ...) \
+ DEFINE_FAKE_VOID_FUNC15_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VOID_FUNC16_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
+ DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
+ DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
+ DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, va_list ap); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ...); \
+
+#define DEFINE_FAKE_VOID_FUNC16_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ SAVE_ARG(FUNCNAME, 11); \
+ SAVE_ARG(FUNCNAME, 12); \
+ SAVE_ARG(FUNCNAME, 13); \
+ SAVE_ARG(FUNCNAME, 14); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ SAVE_ARG_HISTORY(FUNCNAME, 11); \
+ SAVE_ARG_HISTORY(FUNCNAME, 12); \
+ SAVE_ARG_HISTORY(FUNCNAME, 13); \
+ SAVE_ARG_HISTORY(FUNCNAME, 14); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg14); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, ap); \
+ va_end(ap); \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg14); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, ap); \
+ va_end(ap); \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ va_list ap; \
+ va_start(ap, arg14); \
+ FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, ap); \
+ va_end(ap); \
+ } \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC16_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ...) \
+ DECLARE_FAKE_VOID_FUNC16_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ...) \
+ DEFINE_FAKE_VOID_FUNC16_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VOID_FUNC17_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
+ DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
+ DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
+ DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
+ DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, va_list ap); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ...); \
+
+#define DEFINE_FAKE_VOID_FUNC17_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ SAVE_ARG(FUNCNAME, 11); \
+ SAVE_ARG(FUNCNAME, 12); \
+ SAVE_ARG(FUNCNAME, 13); \
+ SAVE_ARG(FUNCNAME, 14); \
+ SAVE_ARG(FUNCNAME, 15); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ SAVE_ARG_HISTORY(FUNCNAME, 11); \
+ SAVE_ARG_HISTORY(FUNCNAME, 12); \
+ SAVE_ARG_HISTORY(FUNCNAME, 13); \
+ SAVE_ARG_HISTORY(FUNCNAME, 14); \
+ SAVE_ARG_HISTORY(FUNCNAME, 15); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg15); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, ap); \
+ va_end(ap); \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg15); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, ap); \
+ va_end(ap); \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ va_list ap; \
+ va_start(ap, arg15); \
+ FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, ap); \
+ va_end(ap); \
+ } \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC17_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ...) \
+ DECLARE_FAKE_VOID_FUNC17_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ...) \
+ DEFINE_FAKE_VOID_FUNC17_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VOID_FUNC18_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
+ DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
+ DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
+ DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
+ DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
+ DECLARE_ARG(ARG16_TYPE, 16, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, va_list ap); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ...); \
+
+#define DEFINE_FAKE_VOID_FUNC18_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ SAVE_ARG(FUNCNAME, 11); \
+ SAVE_ARG(FUNCNAME, 12); \
+ SAVE_ARG(FUNCNAME, 13); \
+ SAVE_ARG(FUNCNAME, 14); \
+ SAVE_ARG(FUNCNAME, 15); \
+ SAVE_ARG(FUNCNAME, 16); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ SAVE_ARG_HISTORY(FUNCNAME, 11); \
+ SAVE_ARG_HISTORY(FUNCNAME, 12); \
+ SAVE_ARG_HISTORY(FUNCNAME, 13); \
+ SAVE_ARG_HISTORY(FUNCNAME, 14); \
+ SAVE_ARG_HISTORY(FUNCNAME, 15); \
+ SAVE_ARG_HISTORY(FUNCNAME, 16); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg16); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, ap); \
+ va_end(ap); \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg16); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, ap); \
+ va_end(ap); \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ va_list ap; \
+ va_start(ap, arg16); \
+ FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, ap); \
+ va_end(ap); \
+ } \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC18_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ...) \
+ DECLARE_FAKE_VOID_FUNC18_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ...) \
+ DEFINE_FAKE_VOID_FUNC18_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VOID_FUNC19_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
+ DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
+ DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
+ DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
+ DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
+ DECLARE_ARG(ARG16_TYPE, 16, FUNCNAME) \
+ DECLARE_ARG(ARG17_TYPE, 17, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, va_list ap); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ...); \
+
+#define DEFINE_FAKE_VOID_FUNC19_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ SAVE_ARG(FUNCNAME, 11); \
+ SAVE_ARG(FUNCNAME, 12); \
+ SAVE_ARG(FUNCNAME, 13); \
+ SAVE_ARG(FUNCNAME, 14); \
+ SAVE_ARG(FUNCNAME, 15); \
+ SAVE_ARG(FUNCNAME, 16); \
+ SAVE_ARG(FUNCNAME, 17); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ SAVE_ARG_HISTORY(FUNCNAME, 11); \
+ SAVE_ARG_HISTORY(FUNCNAME, 12); \
+ SAVE_ARG_HISTORY(FUNCNAME, 13); \
+ SAVE_ARG_HISTORY(FUNCNAME, 14); \
+ SAVE_ARG_HISTORY(FUNCNAME, 15); \
+ SAVE_ARG_HISTORY(FUNCNAME, 16); \
+ SAVE_ARG_HISTORY(FUNCNAME, 17); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg17); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, ap); \
+ va_end(ap); \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg17); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, ap); \
+ va_end(ap); \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ va_list ap; \
+ va_start(ap, arg17); \
+ FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, ap); \
+ va_end(ap); \
+ } \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC19_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ...) \
+ DECLARE_FAKE_VOID_FUNC19_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ...) \
+ DEFINE_FAKE_VOID_FUNC19_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VOID_FUNC20_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
+ DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
+ DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
+ DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
+ DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
+ DECLARE_ARG(ARG16_TYPE, 16, FUNCNAME) \
+ DECLARE_ARG(ARG17_TYPE, 17, FUNCNAME) \
+ DECLARE_ARG(ARG18_TYPE, 18, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, va_list ap); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18, ...); \
+
+#define DEFINE_FAKE_VOID_FUNC20_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ SAVE_ARG(FUNCNAME, 11); \
+ SAVE_ARG(FUNCNAME, 12); \
+ SAVE_ARG(FUNCNAME, 13); \
+ SAVE_ARG(FUNCNAME, 14); \
+ SAVE_ARG(FUNCNAME, 15); \
+ SAVE_ARG(FUNCNAME, 16); \
+ SAVE_ARG(FUNCNAME, 17); \
+ SAVE_ARG(FUNCNAME, 18); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ SAVE_ARG_HISTORY(FUNCNAME, 11); \
+ SAVE_ARG_HISTORY(FUNCNAME, 12); \
+ SAVE_ARG_HISTORY(FUNCNAME, 13); \
+ SAVE_ARG_HISTORY(FUNCNAME, 14); \
+ SAVE_ARG_HISTORY(FUNCNAME, 15); \
+ SAVE_ARG_HISTORY(FUNCNAME, 16); \
+ SAVE_ARG_HISTORY(FUNCNAME, 17); \
+ SAVE_ARG_HISTORY(FUNCNAME, 18); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg18); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, ap); \
+ va_end(ap); \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg18); \
+ FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, ap); \
+ va_end(ap); \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ va_list ap; \
+ va_start(ap, arg18); \
+ FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, ap); \
+ va_end(ap); \
+ } \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VOID_FUNC20_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ...) \
+ DECLARE_FAKE_VOID_FUNC20_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ...) \
+ DEFINE_FAKE_VOID_FUNC20_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC2_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, va_list ap); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ...); \
+
+#define DEFINE_FAKE_VALUE_FUNC2_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg0); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg0); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ RETURN_TYPE ret; \
+ va_list ap; \
+ va_start(ap, arg0); \
+ ret = FUNCNAME##_fake.custom_fake(arg0, ap); \
+ va_end(ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC2_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ...) \
+ DECLARE_FAKE_VALUE_FUNC2_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ...) \
+ DEFINE_FAKE_VALUE_FUNC2_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC3_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE, va_list ap); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ...); \
+
+#define DEFINE_FAKE_VALUE_FUNC3_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg1); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg1); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ RETURN_TYPE ret; \
+ va_list ap; \
+ va_start(ap, arg1); \
+ ret = FUNCNAME##_fake.custom_fake(arg0, arg1, ap); \
+ va_end(ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC3_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ...) \
+ DECLARE_FAKE_VALUE_FUNC3_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ...) \
+ DEFINE_FAKE_VALUE_FUNC3_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC4_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, va_list ap); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ...); \
+
+#define DEFINE_FAKE_VALUE_FUNC4_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg2); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg2); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ RETURN_TYPE ret; \
+ va_list ap; \
+ va_start(ap, arg2); \
+ ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, ap); \
+ va_end(ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC4_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ...) \
+ DECLARE_FAKE_VALUE_FUNC4_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ...) \
+ DEFINE_FAKE_VALUE_FUNC4_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC5_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, va_list ap); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ...); \
+
+#define DEFINE_FAKE_VALUE_FUNC5_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg3); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg3); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ RETURN_TYPE ret; \
+ va_list ap; \
+ va_start(ap, arg3); \
+ ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, ap); \
+ va_end(ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC5_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ...) \
+ DECLARE_FAKE_VALUE_FUNC5_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ...) \
+ DEFINE_FAKE_VALUE_FUNC5_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC6_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, va_list ap); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ...); \
+
+#define DEFINE_FAKE_VALUE_FUNC6_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg4); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg4); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ RETURN_TYPE ret; \
+ va_list ap; \
+ va_start(ap, arg4); \
+ ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, ap); \
+ va_end(ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC6_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ...) \
+ DECLARE_FAKE_VALUE_FUNC6_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ...) \
+ DEFINE_FAKE_VALUE_FUNC6_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC7_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, va_list ap); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ...); \
+
+#define DEFINE_FAKE_VALUE_FUNC7_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg5); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg5); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ RETURN_TYPE ret; \
+ va_list ap; \
+ va_start(ap, arg5); \
+ ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, ap); \
+ va_end(ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC7_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ...) \
+ DECLARE_FAKE_VALUE_FUNC7_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ...) \
+ DEFINE_FAKE_VALUE_FUNC7_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC8_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, va_list ap); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ...); \
+
+#define DEFINE_FAKE_VALUE_FUNC8_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg6); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg6); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ RETURN_TYPE ret; \
+ va_list ap; \
+ va_start(ap, arg6); \
+ ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, ap); \
+ va_end(ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC8_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ...) \
+ DECLARE_FAKE_VALUE_FUNC8_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ...) \
+ DEFINE_FAKE_VALUE_FUNC8_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC9_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, va_list ap); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ...); \
+
+#define DEFINE_FAKE_VALUE_FUNC9_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg7); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg7); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ RETURN_TYPE ret; \
+ va_list ap; \
+ va_start(ap, arg7); \
+ ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, ap); \
+ va_end(ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC9_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ...) \
+ DECLARE_FAKE_VALUE_FUNC9_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ...) \
+ DEFINE_FAKE_VALUE_FUNC9_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC10_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, va_list ap); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ...); \
+
+#define DEFINE_FAKE_VALUE_FUNC10_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg8); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg8); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ RETURN_TYPE ret; \
+ va_list ap; \
+ va_start(ap, arg8); \
+ ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, ap); \
+ va_end(ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC10_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ...) \
+ DECLARE_FAKE_VALUE_FUNC10_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ...) \
+ DEFINE_FAKE_VALUE_FUNC10_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC11_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, va_list ap); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ...); \
+
+#define DEFINE_FAKE_VALUE_FUNC11_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg9); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg9); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ RETURN_TYPE ret; \
+ va_list ap; \
+ va_start(ap, arg9); \
+ ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, ap); \
+ va_end(ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC11_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ...) \
+ DECLARE_FAKE_VALUE_FUNC11_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ...) \
+ DEFINE_FAKE_VALUE_FUNC11_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC12_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, va_list ap); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ...); \
+
+#define DEFINE_FAKE_VALUE_FUNC12_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg10); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg10); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ RETURN_TYPE ret; \
+ va_list ap; \
+ va_start(ap, arg10); \
+ ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, ap); \
+ va_end(ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC12_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ...) \
+ DECLARE_FAKE_VALUE_FUNC12_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ...) \
+ DEFINE_FAKE_VALUE_FUNC12_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC13_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, va_list ap); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ...); \
+
+#define DEFINE_FAKE_VALUE_FUNC13_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ SAVE_ARG(FUNCNAME, 11); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ SAVE_ARG_HISTORY(FUNCNAME, 11); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg11); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg11); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ RETURN_TYPE ret; \
+ va_list ap; \
+ va_start(ap, arg11); \
+ ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, ap); \
+ va_end(ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC13_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ...) \
+ DECLARE_FAKE_VALUE_FUNC13_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ...) \
+ DEFINE_FAKE_VALUE_FUNC13_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC14_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
+ DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, va_list ap); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ...); \
+
+#define DEFINE_FAKE_VALUE_FUNC14_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ SAVE_ARG(FUNCNAME, 11); \
+ SAVE_ARG(FUNCNAME, 12); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ SAVE_ARG_HISTORY(FUNCNAME, 11); \
+ SAVE_ARG_HISTORY(FUNCNAME, 12); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg12); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg12); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ RETURN_TYPE ret; \
+ va_list ap; \
+ va_start(ap, arg12); \
+ ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, ap); \
+ va_end(ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC14_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ...) \
+ DECLARE_FAKE_VALUE_FUNC14_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ...) \
+ DEFINE_FAKE_VALUE_FUNC14_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC15_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
+ DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
+ DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, va_list ap); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ...); \
+
+#define DEFINE_FAKE_VALUE_FUNC15_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ SAVE_ARG(FUNCNAME, 11); \
+ SAVE_ARG(FUNCNAME, 12); \
+ SAVE_ARG(FUNCNAME, 13); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ SAVE_ARG_HISTORY(FUNCNAME, 11); \
+ SAVE_ARG_HISTORY(FUNCNAME, 12); \
+ SAVE_ARG_HISTORY(FUNCNAME, 13); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg13); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg13); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ RETURN_TYPE ret; \
+ va_list ap; \
+ va_start(ap, arg13); \
+ ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, ap); \
+ va_end(ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC15_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ...) \
+ DECLARE_FAKE_VALUE_FUNC15_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ...) \
+ DEFINE_FAKE_VALUE_FUNC15_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC16_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
+ DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
+ DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
+ DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, va_list ap); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ...); \
+
+#define DEFINE_FAKE_VALUE_FUNC16_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ SAVE_ARG(FUNCNAME, 11); \
+ SAVE_ARG(FUNCNAME, 12); \
+ SAVE_ARG(FUNCNAME, 13); \
+ SAVE_ARG(FUNCNAME, 14); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ SAVE_ARG_HISTORY(FUNCNAME, 11); \
+ SAVE_ARG_HISTORY(FUNCNAME, 12); \
+ SAVE_ARG_HISTORY(FUNCNAME, 13); \
+ SAVE_ARG_HISTORY(FUNCNAME, 14); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg14); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg14); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ RETURN_TYPE ret; \
+ va_list ap; \
+ va_start(ap, arg14); \
+ ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, ap); \
+ va_end(ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC16_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ...) \
+ DECLARE_FAKE_VALUE_FUNC16_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ...) \
+ DEFINE_FAKE_VALUE_FUNC16_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC17_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
+ DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
+ DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
+ DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
+ DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, va_list ap); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ...); \
+
+#define DEFINE_FAKE_VALUE_FUNC17_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ SAVE_ARG(FUNCNAME, 11); \
+ SAVE_ARG(FUNCNAME, 12); \
+ SAVE_ARG(FUNCNAME, 13); \
+ SAVE_ARG(FUNCNAME, 14); \
+ SAVE_ARG(FUNCNAME, 15); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ SAVE_ARG_HISTORY(FUNCNAME, 11); \
+ SAVE_ARG_HISTORY(FUNCNAME, 12); \
+ SAVE_ARG_HISTORY(FUNCNAME, 13); \
+ SAVE_ARG_HISTORY(FUNCNAME, 14); \
+ SAVE_ARG_HISTORY(FUNCNAME, 15); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg15); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg15); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ RETURN_TYPE ret; \
+ va_list ap; \
+ va_start(ap, arg15); \
+ ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, ap); \
+ va_end(ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC17_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ...) \
+ DECLARE_FAKE_VALUE_FUNC17_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ...) \
+ DEFINE_FAKE_VALUE_FUNC17_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC18_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
+ DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
+ DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
+ DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
+ DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
+ DECLARE_ARG(ARG16_TYPE, 16, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, va_list ap); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ...); \
+
+#define DEFINE_FAKE_VALUE_FUNC18_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ SAVE_ARG(FUNCNAME, 11); \
+ SAVE_ARG(FUNCNAME, 12); \
+ SAVE_ARG(FUNCNAME, 13); \
+ SAVE_ARG(FUNCNAME, 14); \
+ SAVE_ARG(FUNCNAME, 15); \
+ SAVE_ARG(FUNCNAME, 16); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ SAVE_ARG_HISTORY(FUNCNAME, 11); \
+ SAVE_ARG_HISTORY(FUNCNAME, 12); \
+ SAVE_ARG_HISTORY(FUNCNAME, 13); \
+ SAVE_ARG_HISTORY(FUNCNAME, 14); \
+ SAVE_ARG_HISTORY(FUNCNAME, 15); \
+ SAVE_ARG_HISTORY(FUNCNAME, 16); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg16); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg16); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ RETURN_TYPE ret; \
+ va_list ap; \
+ va_start(ap, arg16); \
+ ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, ap); \
+ va_end(ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC18_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ...) \
+ DECLARE_FAKE_VALUE_FUNC18_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ...) \
+ DEFINE_FAKE_VALUE_FUNC18_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC19_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
+ DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
+ DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
+ DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
+ DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
+ DECLARE_ARG(ARG16_TYPE, 16, FUNCNAME) \
+ DECLARE_ARG(ARG17_TYPE, 17, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, va_list ap); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ...); \
+
+#define DEFINE_FAKE_VALUE_FUNC19_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ SAVE_ARG(FUNCNAME, 11); \
+ SAVE_ARG(FUNCNAME, 12); \
+ SAVE_ARG(FUNCNAME, 13); \
+ SAVE_ARG(FUNCNAME, 14); \
+ SAVE_ARG(FUNCNAME, 15); \
+ SAVE_ARG(FUNCNAME, 16); \
+ SAVE_ARG(FUNCNAME, 17); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ SAVE_ARG_HISTORY(FUNCNAME, 11); \
+ SAVE_ARG_HISTORY(FUNCNAME, 12); \
+ SAVE_ARG_HISTORY(FUNCNAME, 13); \
+ SAVE_ARG_HISTORY(FUNCNAME, 14); \
+ SAVE_ARG_HISTORY(FUNCNAME, 15); \
+ SAVE_ARG_HISTORY(FUNCNAME, 16); \
+ SAVE_ARG_HISTORY(FUNCNAME, 17); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg17); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg17); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ RETURN_TYPE ret; \
+ va_list ap; \
+ va_start(ap, arg17); \
+ ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, ap); \
+ va_end(ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC19_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ...) \
+ DECLARE_FAKE_VALUE_FUNC19_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ...) \
+ DEFINE_FAKE_VALUE_FUNC19_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ...) \
+
+
+#define DECLARE_FAKE_VALUE_FUNC20_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ...) \
+ typedef struct FUNCNAME##_Fake { \
+ DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+ DECLARE_ARG(ARG1_TYPE, 1, FUNCNAME) \
+ DECLARE_ARG(ARG2_TYPE, 2, FUNCNAME) \
+ DECLARE_ARG(ARG3_TYPE, 3, FUNCNAME) \
+ DECLARE_ARG(ARG4_TYPE, 4, FUNCNAME) \
+ DECLARE_ARG(ARG5_TYPE, 5, FUNCNAME) \
+ DECLARE_ARG(ARG6_TYPE, 6, FUNCNAME) \
+ DECLARE_ARG(ARG7_TYPE, 7, FUNCNAME) \
+ DECLARE_ARG(ARG8_TYPE, 8, FUNCNAME) \
+ DECLARE_ARG(ARG9_TYPE, 9, FUNCNAME) \
+ DECLARE_ARG(ARG10_TYPE, 10, FUNCNAME) \
+ DECLARE_ARG(ARG11_TYPE, 11, FUNCNAME) \
+ DECLARE_ARG(ARG12_TYPE, 12, FUNCNAME) \
+ DECLARE_ARG(ARG13_TYPE, 13, FUNCNAME) \
+ DECLARE_ARG(ARG14_TYPE, 14, FUNCNAME) \
+ DECLARE_ARG(ARG15_TYPE, 15, FUNCNAME) \
+ DECLARE_ARG(ARG16_TYPE, 16, FUNCNAME) \
+ DECLARE_ARG(ARG17_TYPE, 17, FUNCNAME) \
+ DECLARE_ARG(ARG18_TYPE, 18, FUNCNAME) \
+ DECLARE_ALL_FUNC_COMMON \
+ DECLARE_VALUE_FUNCTION_VARIABLES(RETURN_TYPE) \
+ DECLARE_RETURN_VALUE_HISTORY(RETURN_TYPE) \
+ DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, custom_fake, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, va_list ap); \
+ CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN_TYPE, *custom_fake_seq, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, va_list ap); \
+ } FUNCNAME##_Fake; \
+ extern FUNCNAME##_Fake FUNCNAME##_fake; \
+ void FUNCNAME##_reset(void); \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18, ...); \
+
+#define DEFINE_FAKE_VALUE_FUNC20_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ...) \
+ FUNCNAME##_Fake FUNCNAME##_fake; \
+ RETURN_TYPE FFF_GCC_FUNCTION_ATTRIBUTES FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, ARG8_TYPE arg8, ARG9_TYPE arg9, ARG10_TYPE arg10, ARG11_TYPE arg11, ARG12_TYPE arg12, ARG13_TYPE arg13, ARG14_TYPE arg14, ARG15_TYPE arg15, ARG16_TYPE arg16, ARG17_TYPE arg17, ARG18_TYPE arg18, ...){ \
+ SAVE_ARG(FUNCNAME, 0); \
+ SAVE_ARG(FUNCNAME, 1); \
+ SAVE_ARG(FUNCNAME, 2); \
+ SAVE_ARG(FUNCNAME, 3); \
+ SAVE_ARG(FUNCNAME, 4); \
+ SAVE_ARG(FUNCNAME, 5); \
+ SAVE_ARG(FUNCNAME, 6); \
+ SAVE_ARG(FUNCNAME, 7); \
+ SAVE_ARG(FUNCNAME, 8); \
+ SAVE_ARG(FUNCNAME, 9); \
+ SAVE_ARG(FUNCNAME, 10); \
+ SAVE_ARG(FUNCNAME, 11); \
+ SAVE_ARG(FUNCNAME, 12); \
+ SAVE_ARG(FUNCNAME, 13); \
+ SAVE_ARG(FUNCNAME, 14); \
+ SAVE_ARG(FUNCNAME, 15); \
+ SAVE_ARG(FUNCNAME, 16); \
+ SAVE_ARG(FUNCNAME, 17); \
+ SAVE_ARG(FUNCNAME, 18); \
+ if(ROOM_FOR_MORE_HISTORY(FUNCNAME)){ \
+ SAVE_ARG_HISTORY(FUNCNAME, 0); \
+ SAVE_ARG_HISTORY(FUNCNAME, 1); \
+ SAVE_ARG_HISTORY(FUNCNAME, 2); \
+ SAVE_ARG_HISTORY(FUNCNAME, 3); \
+ SAVE_ARG_HISTORY(FUNCNAME, 4); \
+ SAVE_ARG_HISTORY(FUNCNAME, 5); \
+ SAVE_ARG_HISTORY(FUNCNAME, 6); \
+ SAVE_ARG_HISTORY(FUNCNAME, 7); \
+ SAVE_ARG_HISTORY(FUNCNAME, 8); \
+ SAVE_ARG_HISTORY(FUNCNAME, 9); \
+ SAVE_ARG_HISTORY(FUNCNAME, 10); \
+ SAVE_ARG_HISTORY(FUNCNAME, 11); \
+ SAVE_ARG_HISTORY(FUNCNAME, 12); \
+ SAVE_ARG_HISTORY(FUNCNAME, 13); \
+ SAVE_ARG_HISTORY(FUNCNAME, 14); \
+ SAVE_ARG_HISTORY(FUNCNAME, 15); \
+ SAVE_ARG_HISTORY(FUNCNAME, 16); \
+ SAVE_ARG_HISTORY(FUNCNAME, 17); \
+ SAVE_ARG_HISTORY(FUNCNAME, 18); \
+ } \
+ else{ \
+ HISTORY_DROPPED(FUNCNAME); \
+ } \
+ INCREMENT_CALL_COUNT(FUNCNAME); \
+ REGISTER_CALL(FUNCNAME); \
+ if (FUNCNAME##_fake.custom_fake_seq_len){ /* a sequence of custom fakes */ \
+ if (FUNCNAME##_fake.custom_fake_seq_idx < FUNCNAME##_fake.custom_fake_seq_len){ \
+ va_list ap; \
+ va_start(ap, arg18); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_idx++](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ } \
+ else{ \
+ va_list ap; \
+ va_start(ap, arg18); \
+ RETURN_TYPE ret = FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ va_end(ap); \
+ return ret; \
+ } \
+ } \
+ if(FUNCNAME##_fake.custom_fake){ \
+ RETURN_TYPE ret; \
+ va_list ap; \
+ va_start(ap, arg18); \
+ ret = FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, ap); \
+ va_end(ap); \
+ SAVE_RET_HISTORY(FUNCNAME, ret); \
+ return ret; \
+ } \
+ RETURN_FAKE_RESULT(FUNCNAME) \
+ } \
+ DEFINE_RESET_FUNCTION(FUNCNAME) \
+
+#define FAKE_VALUE_FUNC20_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ...) \
+ DECLARE_FAKE_VALUE_FUNC20_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ...) \
+ DEFINE_FAKE_VALUE_FUNC20_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE, ARG9_TYPE, ARG10_TYPE, ARG11_TYPE, ARG12_TYPE, ARG13_TYPE, ARG14_TYPE, ARG15_TYPE, ARG16_TYPE, ARG17_TYPE, ARG18_TYPE, ...) \
+
+/* MSVC expand macro fix */
+#define EXPAND(x) x
+
+#define PP_NARG_MINUS2(...) EXPAND(PP_NARG_MINUS2_(__VA_ARGS__, PP_RSEQ_N_MINUS2()))
+
+#define PP_NARG_MINUS2_(...) EXPAND(PP_ARG_MINUS2_N(__VA_ARGS__))
+
+#define PP_ARG_MINUS2_N(returnVal, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, N, ...) N
+
+#define PP_RSEQ_N_MINUS2() 20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0
+
+#define PP_NARG_MINUS1(...) EXPAND(PP_NARG_MINUS1_(__VA_ARGS__, PP_RSEQ_N_MINUS1()))
+
+#define PP_NARG_MINUS1_(...) EXPAND(PP_ARG_MINUS1_N(__VA_ARGS__))
+
+#define PP_ARG_MINUS1_N( _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, N, ...) N
+
+#define PP_RSEQ_N_MINUS1() 20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0
+
+
+
+/* DECLARE AND DEFINE FAKE FUNCTIONS - PLACE IN TEST FILES */
+
+#define FAKE_VALUE_FUNC(...) EXPAND(FUNC_VALUE_(PP_NARG_MINUS2(__VA_ARGS__), __VA_ARGS__))
+
+#define FUNC_VALUE_(N,...) EXPAND(FUNC_VALUE_N(N,__VA_ARGS__))
+
+#define FUNC_VALUE_N(N,...) EXPAND(FAKE_VALUE_FUNC ## N(__VA_ARGS__))
+
+
+#define FAKE_VOID_FUNC(...) EXPAND(FUNC_VOID_(PP_NARG_MINUS1(__VA_ARGS__), __VA_ARGS__))
+
+#define FUNC_VOID_(N,...) EXPAND(FUNC_VOID_N(N,__VA_ARGS__))
+
+#define FUNC_VOID_N(N,...) EXPAND(FAKE_VOID_FUNC ## N(__VA_ARGS__))
+
+
+#define FAKE_VALUE_FUNC_VARARG(...) EXPAND(FUNC_VALUE_VARARG_(PP_NARG_MINUS2(__VA_ARGS__), __VA_ARGS__))
+
+#define FUNC_VALUE_VARARG_(N,...) EXPAND(FUNC_VALUE_VARARG_N(N,__VA_ARGS__))
+
+#define FUNC_VALUE_VARARG_N(N,...) EXPAND(FAKE_VALUE_FUNC ## N ## _VARARG(__VA_ARGS__))
+
+
+#define FAKE_VOID_FUNC_VARARG(...) EXPAND(FUNC_VOID_VARARG_(PP_NARG_MINUS1(__VA_ARGS__), __VA_ARGS__))
+
+#define FUNC_VOID_VARARG_(N,...) EXPAND(FUNC_VOID_VARARG_N(N,__VA_ARGS__))
+
+#define FUNC_VOID_VARARG_N(N,...) EXPAND(FAKE_VOID_FUNC ## N ## _VARARG(__VA_ARGS__))
+
+
+
+/* DECLARE FAKE FUNCTIONS - PLACE IN HEADER FILES */
+
+#define DECLARE_FAKE_VALUE_FUNC(...) EXPAND(DECLARE_FUNC_VALUE_(PP_NARG_MINUS2(__VA_ARGS__), __VA_ARGS__))
+
+#define DECLARE_FUNC_VALUE_(N,...) EXPAND(DECLARE_FUNC_VALUE_N(N,__VA_ARGS__))
+
+#define DECLARE_FUNC_VALUE_N(N,...) EXPAND(DECLARE_FAKE_VALUE_FUNC ## N(__VA_ARGS__))
+
+
+#define DECLARE_FAKE_VOID_FUNC(...) EXPAND(DECLARE_FUNC_VOID_(PP_NARG_MINUS1(__VA_ARGS__), __VA_ARGS__))
+
+#define DECLARE_FUNC_VOID_(N,...) EXPAND(DECLARE_FUNC_VOID_N(N,__VA_ARGS__))
+
+#define DECLARE_FUNC_VOID_N(N,...) EXPAND(DECLARE_FAKE_VOID_FUNC ## N(__VA_ARGS__))
+
+
+#define DECLARE_FAKE_VALUE_FUNC_VARARG(...) EXPAND(DECLARE_FUNC_VALUE_VARARG_(PP_NARG_MINUS2(__VA_ARGS__), __VA_ARGS__))
+
+#define DECLARE_FUNC_VALUE_VARARG_(N,...) EXPAND(DECLARE_FUNC_VALUE_VARARG_N(N,__VA_ARGS__))
+
+#define DECLARE_FUNC_VALUE_VARARG_N(N,...) EXPAND(DECLARE_FAKE_VALUE_FUNC ## N ## _VARARG(__VA_ARGS__))
+
+
+#define DECLARE_FAKE_VOID_FUNC_VARARG(...) EXPAND(DECLARE_FUNC_VOID_VARARG_(PP_NARG_MINUS1(__VA_ARGS__), __VA_ARGS__))
+
+#define DECLARE_FUNC_VOID_VARARG_(N,...) EXPAND(DECLARE_FUNC_VOID_VARARG_N(N,__VA_ARGS__))
+
+#define DECLARE_FUNC_VOID_VARARG_N(N,...) EXPAND(DECLARE_FAKE_VOID_FUNC ## N ## _VARARG(__VA_ARGS__))
+
+
+
+/* DEFINE FAKE FUNCTIONS - PLACE IN SOURCE FILES */
+
+#define DEFINE_FAKE_VALUE_FUNC(...) EXPAND(DEFINE_FUNC_VALUE_(PP_NARG_MINUS2(__VA_ARGS__), __VA_ARGS__))
+
+#define DEFINE_FUNC_VALUE_(N,...) EXPAND(DEFINE_FUNC_VALUE_N(N,__VA_ARGS__))
+
+#define DEFINE_FUNC_VALUE_N(N,...) EXPAND(DEFINE_FAKE_VALUE_FUNC ## N(__VA_ARGS__))
+
+
+#define DEFINE_FAKE_VOID_FUNC(...) EXPAND(DEFINE_FUNC_VOID_(PP_NARG_MINUS1(__VA_ARGS__), __VA_ARGS__))
+
+#define DEFINE_FUNC_VOID_(N,...) EXPAND(DEFINE_FUNC_VOID_N(N,__VA_ARGS__))
+
+#define DEFINE_FUNC_VOID_N(N,...) EXPAND(DEFINE_FAKE_VOID_FUNC ## N(__VA_ARGS__))
+
+
+#define DEFINE_FAKE_VALUE_FUNC_VARARG(...) EXPAND(DEFINE_FUNC_VALUE_VARARG_(PP_NARG_MINUS2(__VA_ARGS__), __VA_ARGS__))
+
+#define DEFINE_FUNC_VALUE_VARARG_(N,...) EXPAND(DEFINE_FUNC_VALUE_VARARG_N(N,__VA_ARGS__))
+
+#define DEFINE_FUNC_VALUE_VARARG_N(N,...) EXPAND(DEFINE_FAKE_VALUE_FUNC ## N ## _VARARG(__VA_ARGS__))
+
+
+#define DEFINE_FAKE_VOID_FUNC_VARARG(...) EXPAND(DEFINE_FUNC_VOID_VARARG_(PP_NARG_MINUS1(__VA_ARGS__), __VA_ARGS__))
+
+#define DEFINE_FUNC_VOID_VARARG_(N,...) EXPAND(DEFINE_FUNC_VOID_VARARG_N(N,__VA_ARGS__))
+
+#define DEFINE_FUNC_VOID_VARARG_N(N,...) EXPAND(DEFINE_FAKE_VOID_FUNC ## N ## _VARARG(__VA_ARGS__))
+
+
+
+
+#endif /* FAKE_FUNCTIONS */
diff --git a/deps/fff/test/CMakeLists.txt b/deps/fff/test/CMakeLists.txt
new file mode 100644
index 0000000..d4ccbf8
--- /dev/null
+++ b/deps/fff/test/CMakeLists.txt
@@ -0,0 +1,87 @@
+# Copyright 2022 Google LLC
+# SPDX-License-Identifier: Apache-2.0
+
+# Create a list of common files needed for tests
+set(
+ COMMON_FILE_LIST
+ include/c_test_framework.h
+ src/test_cases.include
+)
+
+include(FetchContent)
+
+FetchContent_Declare(
+ googletest
+ GIT_REPOSITORY https://github.com/google/googletest.git
+ GIT_TAG v1.12.0
+)
+
+set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
+FetchContent_MakeAvailable(googletest)
+
+# Create the C test executable
+add_executable(c_test src/fff_test_c.c ${COMMON_FILE_LIST})
+target_include_directories(c_test PRIVATE include)
+target_link_libraries(c_test PRIVATE fff)
+
+# Create the C++ test executable
+add_executable(cpp_test src/fff_test_cpp.cpp ${COMMON_FILE_LIST})
+target_include_directories(cpp_test PRIVATE include)
+target_link_libraries(cpp_test PRIVATE GTest::gtest_main fff)
+
+# Create the C global test executable
+add_executable(c_global_test
+ src/fff_test_global_c.c
+ src/global_fakes.c
+ include/global_fakes.h
+ ${COMMON_FILE_LIST}
+)
+target_include_directories(c_global_test PRIVATE include)
+target_link_libraries(c_global_test PRIVATE fff)
+
+# Create the C++ global test executable
+add_executable(cpp_global_test
+ src/fff_test_global_cpp.cpp
+ src/global_fakes.c
+ include/global_fakes.h
+ ${COMMON_FILE_LIST}
+)
+target_include_directories(cpp_global_test PRIVATE include)
+target_link_libraries(cpp_global_test PRIVATE GTest::gtest_main fff)
+
+# Create the C++ custom function signature executable
+add_executable(cpp_custom_fn_signature_test
+ src/fff_test_custom_function_template.cpp
+ ${COMMON_FILE_LIST}
+)
+target_include_directories(cpp_custom_fn_signature_test PRIVATE include)
+target_link_libraries(cpp_custom_fn_signature_test PRIVATE GTest::gtest_main fff)
+# Due to a bug in WinLibs for Windows it's not currently possible to use:
+# target_precompile_headers(cpp_custom_fn_signature_test PUBLIC include/custom_function.hpp)
+# See more info at target_precompile_headers(cpp_custom_fn_signature_test PUBLIC include/custom_function.hpp)
+
+add_test(
+ NAME cpp_custom_fn_signature_test
+ COMMAND $<TARGET_FILE:cpp_custom_fn_signature_test>
+ )
+
+# Add the tests for ctest
+add_test(
+ NAME c_test
+ COMMAND $<TARGET_FILE:c_test>
+)
+
+add_test(
+ NAME cpp_test
+ COMMAND $<TARGET_FILE:cpp_test>
+)
+
+add_test(
+ NAME c_global_test
+ COMMAND $<TARGET_FILE:c_global_test>
+)
+
+add_test(
+ NAME cpp_global_test
+ COMMAND $<TARGET_FILE:cpp_global_test>
+) \ No newline at end of file
diff --git a/deps/fff/test/include/c_test_framework.h b/deps/fff/test/include/c_test_framework.h
new file mode 100644
index 0000000..297a33a
--- /dev/null
+++ b/deps/fff/test/include/c_test_framework.h
@@ -0,0 +1,15 @@
+#ifndef C_TEST_FRAMEWORK_H_
+#define C_TEST_FRAMEWORK_H_
+
+#include <assert.h>
+#include <stdio.h>
+#include <string.h>
+
+/* Test Framework :-) */
+void setup();
+#define TEST_F(SUITE, NAME) void NAME()
+#define RUN_TEST(SUITE, TESTNAME) do { printf(" Running %s.%s: \n", #SUITE, #TESTNAME); setup(); TESTNAME(); printf(" SUCCESS\n"); } while (0)
+#define ASSERT_EQ(A, B) assert((A) == (B))
+#define ASSERT_TRUE(A) assert((A))
+
+#endif /* C_TEST_FRAMEWORK_H_ */
diff --git a/deps/fff/test/include/custom_function.hpp b/deps/fff/test/include/custom_function.hpp
new file mode 100644
index 0000000..d9f3934
--- /dev/null
+++ b/deps/fff/test/include/custom_function.hpp
@@ -0,0 +1,10 @@
+/* Copyright 2022 Google LLC
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#pragma once
+
+#include <functional>
+
+#define CUSTOM_FFF_FUNCTION_TEMPLATE(RETURN, FUNCNAME, ...) \
+ std::function<RETURN (__VA_ARGS__)> FUNCNAME
diff --git a/deps/fff/test/include/fff_wrapper.hpp b/deps/fff/test/include/fff_wrapper.hpp
new file mode 100644
index 0000000..e3c0cac
--- /dev/null
+++ b/deps/fff/test/include/fff_wrapper.hpp
@@ -0,0 +1,11 @@
+/* Copyright 2022 Google LLC
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#pragma once
+
+#include <functional>
+
+#include "custom_function.hpp"
+
+#include <fff.h> \ No newline at end of file
diff --git a/deps/fff/test/include/global_fakes.h b/deps/fff/test/include/global_fakes.h
new file mode 100644
index 0000000..b76a9aa
--- /dev/null
+++ b/deps/fff/test/include/global_fakes.h
@@ -0,0 +1,49 @@
+#ifndef GLOBAL_FAKES_H_
+#define GLOBAL_FAKES_H_
+
+#include <fff.h>
+#include <string.h>
+
+
+//// Imaginary production code header file ///
+enum MYBOOL { FALSE = 899, TRUE };
+struct MyStruct {
+ int x;
+ int y;
+};
+enum MYBOOL enumfunc();
+struct MyStruct structfunc();
+//// End Imaginary production code header file ///
+
+#ifndef TEST_WITH_CALLING_CONVENTIONS
+DECLARE_FAKE_VOID_FUNC(voidfunc1, int);
+DECLARE_FAKE_VOID_FUNC(voidfunc2, char, char);
+DECLARE_FAKE_VOID_FUNC(voidfunc1outparam, char *);
+DECLARE_FAKE_VALUE_FUNC(long, longfunc0);
+DECLARE_FAKE_VALUE_FUNC(enum MYBOOL, enumfunc0);
+DECLARE_FAKE_VALUE_FUNC(struct MyStruct, structfunc0);
+DECLARE_FAKE_VOID_FUNC_VARARG(voidfunc3var, const char *, int, ...);
+DECLARE_FAKE_VALUE_FUNC_VARARG(int, valuefunc3var, const char *, int, ...);
+DECLARE_FAKE_VOID_FUNC(voidfunc20, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int);
+DECLARE_FAKE_VALUE_FUNC(int, valuefunc20, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int);
+#else
+DECLARE_FAKE_VOID_FUNC(__cdecl, voidfunc1, int);
+DECLARE_FAKE_VOID_FUNC(__cdecl, voidfunc2, char, char);
+DECLARE_FAKE_VOID_FUNC(__cdecl, voidfunc1outparam, char *);
+DECLARE_FAKE_VALUE_FUNC(long, __cdecl, longfunc0);
+DECLARE_FAKE_VALUE_FUNC(enum MYBOOL, __cdecl, enumfunc0);
+DECLARE_FAKE_VALUE_FUNC(struct MyStruct, __cdecl, structfunc0);
+DECLARE_FAKE_VOID_FUNC_VARARG(__cdecl, voidfunc3var, const char *, int, ...);
+DECLARE_FAKE_VALUE_FUNC_VARARG(int, __cdecl, valuefunc3var, const char *, int, ...);
+DECLARE_FAKE_VOID_FUNC(__cdecl, voidfunc20, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int);
+DECLARE_FAKE_VALUE_FUNC(int, __cdecl, valuefunc20, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int);
+#endif
+
+#ifndef __cplusplus
+#ifndef TEST_WITH_CALLING_CONVENTIONS
+DECLARE_FAKE_VALUE_FUNC(int, strlcpy3, char* const, const char* const, const size_t);
+#else
+DECLARE_FAKE_VALUE_FUNC(int, __cdecl, strlcpy3, char* const, const char* const, const size_t);
+#endif
+#endif /* __cplusplus */
+#endif /* GLOBAL_FAKES_H_ */
diff --git a/deps/fff/test/src/fff_test_c.c b/deps/fff/test/src/fff_test_c.c
new file mode 100644
index 0000000..398a4b5
--- /dev/null
+++ b/deps/fff/test/src/fff_test_c.c
@@ -0,0 +1,132 @@
+
+// Want to keep the argument history for 13 calls
+#define OVERRIDE_ARG_HIST_LEN 13u
+#define FFF_ARG_HISTORY_LEN OVERRIDE_ARG_HIST_LEN
+// Want to keep the call sequence history for 17 function calls
+#define OVERRIDE_CALL_HIST_LEN 17u
+#define FFF_CALL_HISTORY_LEN OVERRIDE_CALL_HIST_LEN
+
+#include "fff.h"
+#include "c_test_framework.h"
+
+#include <assert.h>
+#include <stdio.h>
+#include <string.h>
+
+
+
+enum MYBOOL { FALSE = 899, TRUE };
+struct MyStruct {
+ int x;
+ int y;
+};
+
+#ifndef TEST_WITH_CALLING_CONVENTIONS
+FAKE_VOID_FUNC(voidfunc1, int);
+FAKE_VOID_FUNC(voidfunc2, char, char);
+FAKE_VOID_FUNC(voidfunc1outparam, char *);
+FAKE_VALUE_FUNC(long, longfunc0);
+FAKE_VALUE_FUNC(enum MYBOOL, enumfunc0);
+FAKE_VALUE_FUNC(struct MyStruct, structfunc0);
+FAKE_VOID_FUNC_VARARG(voidfunc3var, const char *, int, ...);
+FAKE_VALUE_FUNC_VARARG(int, valuefunc3var, const char *, int, ...);
+FAKE_VALUE_FUNC(int, strlcpy3, char* const, const char* const, const size_t);
+FAKE_VOID_FUNC(voidfunc20, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int);
+FAKE_VALUE_FUNC(int, valuefunc20, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int);
+#else
+FAKE_VOID_FUNC(__cdecl, voidfunc1, int);
+FAKE_VOID_FUNC(__cdecl, voidfunc2, char, char);
+FAKE_VOID_FUNC(__cdecl, voidfunc1outparam, char *);
+FAKE_VALUE_FUNC(long, __cdecl, longfunc0);
+FAKE_VALUE_FUNC(enum MYBOOL, __cdecl, enumfunc0);
+FAKE_VALUE_FUNC(struct MyStruct, __cdecl, structfunc0);
+FAKE_VOID_FUNC_VARARG(__cdecl, voidfunc3var, char *, int, ...);
+FAKE_VALUE_FUNC_VARARG(int, __cdecl, valuefunc3var, char *, int, ...);
+FAKE_VALUE_FUNC(int, __cdecl, strlcpy3, char* const, const char* const, const size_t);
+FAKE_VOID_FUNC(__cdecl, voidfunc20, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int);
+FAKE_VALUE_FUNC(int, __cdecl, valuefunc20, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int);
+#endif
+
+void setup()
+{
+ RESET_FAKE(voidfunc1);
+ RESET_FAKE(voidfunc2);
+ RESET_FAKE(voidfunc1outparam);
+ RESET_FAKE(longfunc0);
+ RESET_FAKE(enumfunc0);
+ RESET_FAKE(structfunc0);
+ RESET_FAKE(voidfunc3var);
+ RESET_FAKE(valuefunc3var);
+ RESET_FAKE(strlcpy3);
+ FFF_RESET_HISTORY();
+}
+
+
+#include "test_cases.include"
+
+TEST_F(FFFTestSuite, default_constants_can_be_overridden)
+{
+ unsigned sizeCallHistory = (sizeof fff.call_history) / (sizeof fff.call_history[0]);
+ ASSERT_EQ(OVERRIDE_CALL_HIST_LEN, sizeCallHistory);
+ ASSERT_EQ(OVERRIDE_ARG_HIST_LEN, voidfunc2_fake.arg_history_len);
+}
+
+DEFINE_FFF_GLOBALS;
+int main()
+{
+ setbuf(stdout, NULL);
+ fprintf(stdout, "-------------\n");
+ fprintf(stdout, "Running Tests\n");
+ fprintf(stdout, "-------------\n\n");
+ fflush(0);
+
+ /* Run tests */
+ RUN_TEST(FFFTestSuite, when_void_func_never_called_then_callcount_is_zero);
+ RUN_TEST(FFFTestSuite, when_void_func_called_once_then_callcount_is_one);
+ RUN_TEST(FFFTestSuite, when_void_func_called_once_and_reset_then_callcount_is_zero);
+ RUN_TEST(FFFTestSuite, when_void_func_with_1_integer_arg_called_then_last_arg_captured);
+ RUN_TEST(FFFTestSuite, when_void_func_with_1_integer_arg_called_twice_then_last_arg_captured);
+ RUN_TEST(FFFTestSuite, when_void_func_with_1_integer_arg_called_and_reset_then_captured_arg_is_zero);
+ RUN_TEST(FFFTestSuite, when_void_func_with_2_char_args_called_then_last_args_captured);
+ RUN_TEST(FFFTestSuite, when_void_func_with_2_char_args_called_twice_then_last_args_captured);
+ RUN_TEST(FFFTestSuite, when_void_func_with_2_char_args_called_and_reset_then_captured_arg_is_zero);
+ RUN_TEST(FFFTestSuite, when_fake_func_called_then_const_arguments_captured);
+
+ RUN_TEST(FFFTestSuite, when_fake_func_created_default_history_is_fifty_calls);
+ RUN_TEST(FFFTestSuite, when_fake_func_called_then_arguments_captured_in_history);
+ RUN_TEST(FFFTestSuite, argument_history_is_reset_when_RESET_FAKE_called);
+ RUN_TEST(FFFTestSuite, when_fake_func_called_max_times_then_no_argument_histories_dropped);
+ RUN_TEST(FFFTestSuite, when_fake_func_called_max_times_plus_one_then_one_argument_history_dropped);
+
+ RUN_TEST(FFFTestSuite, value_func_will_return_zero_by_default);
+ RUN_TEST(FFFTestSuite, value_func_will_return_value_given);
+ RUN_TEST(FFFTestSuite, value_func_will_return_zero_after_reset);
+ RUN_TEST(FFFTestSuite, register_call_macro_registers_one_call);
+ RUN_TEST(FFFTestSuite, register_call_macro_registers_two_calls);
+ RUN_TEST(FFFTestSuite, reset_call_history_resets_call_history);
+ RUN_TEST(FFFTestSuite, call_history_will_not_write_past_array_bounds);
+ RUN_TEST(FFFTestSuite, calling_fake_registers_one_call);
+
+ RUN_TEST(FFFTestSuite, return_value_sequences_not_exhausted);
+ RUN_TEST(FFFTestSuite, return_value_sequences_exhausted);
+ RUN_TEST(FFFTestSuite, default_constants_can_be_overridden);
+
+ RUN_TEST(FFFTestSuite, can_register_custom_fake);
+ RUN_TEST(FFFTestSuite, when_value_custom_fake_called_THEN_it_returns_custom_return_value);
+
+ RUN_TEST(FFFTestSuite, use_void_vararg_fake_with_different_number_of_arguments);
+ RUN_TEST(FFFTestSuite, use_value_vararg_fake_with_different_number_of_arguments);
+ RUN_TEST(FFFTestSuite, vararg_custom_fake_sequence_not_exhausted);
+ RUN_TEST(FFFTestSuite, vararg_custom_fake_seq_return_values_saved_in_history);
+ RUN_TEST(FFFTestSuite, vararg_custom_fake_sequence_exhausted);
+ RUN_TEST(FFFTestSuite, vararg_custom_fake_sequence_reset);
+
+ RUN_TEST(FFFTestSuite, can_capture_upto_20_arguments_correctly);
+ RUN_TEST(FFFTestSuite, value_func_can_capture_upto_20_arguments_correctly);
+
+ printf("\n-------------\n");
+ printf("Complete\n");
+ printf("-------------\n\n");
+
+ return 0;
+}
diff --git a/deps/fff/test/src/fff_test_cpp.cpp b/deps/fff/test/src/fff_test_cpp.cpp
new file mode 100644
index 0000000..153daef
--- /dev/null
+++ b/deps/fff/test/src/fff_test_cpp.cpp
@@ -0,0 +1,101 @@
+/*
+ * fff_test.cpp
+ *
+ * Created on: Dec 20, 2010
+ * Author: mlong
+ */
+
+// Want to keep the argument history for 13 calls
+#define OVERRIDE_ARG_HIST_LEN 13u
+#define FFF_ARG_HISTORY_LEN OVERRIDE_ARG_HIST_LEN
+// Want to keep the call sequence history for 17 function calls
+#define OVERRIDE_CALL_HIST_LEN 17u
+#define FFF_CALL_HISTORY_LEN OVERRIDE_CALL_HIST_LEN
+
+#include "fff.h"
+#include "gtest/gtest.h"
+
+DEFINE_FFF_GLOBALS
+
+#ifndef TEST_WITH_CALLING_CONVENTIONS
+FAKE_VOID_FUNC(voidfunc1, int);
+FAKE_VOID_FUNC(voidfunc2, char, char);
+FAKE_VOID_FUNC(voidfunc1outparam, char *);
+FAKE_VALUE_FUNC(long, longfunc0);
+FAKE_VOID_FUNC_VARARG(voidfunc3var, const char *, int, ...);
+FAKE_VALUE_FUNC_VARARG(int, valuefunc3var, const char *, int, ...);
+FAKE_VOID_FUNC(voidfunc20, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int);
+FAKE_VALUE_FUNC(int, valuefunc20, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int);
+#else
+FAKE_VOID_FUNC(__cdecl, voidfunc1, int);
+FAKE_VOID_FUNC(__cdecl, voidfunc2, char, char);
+FAKE_VOID_FUNC(__cdecl, voidfunc1outparam, char *);
+FAKE_VALUE_FUNC(long, __cdecl, longfunc0);
+FAKE_VOID_FUNC_VARARG(__cdecl, voidfunc3var, const char *, int, ...);
+FAKE_VALUE_FUNC_VARARG(int, __cdecl, valuefunc3var, const char *, int, ...);
+FAKE_VOID_FUNC(__cdecl, voidfunc20, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int);
+FAKE_VALUE_FUNC(int, __cdecl, valuefunc20, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int);
+#endif
+
+class FFFTestSuite: public testing::Test
+{
+public:
+ void SetUp()
+ {
+ RESET_FAKE(voidfunc1);
+ RESET_FAKE(voidfunc2);
+ RESET_FAKE(longfunc0);
+ RESET_FAKE(voidfunc1outparam);
+ RESET_FAKE(voidfunc3var);
+ RESET_FAKE(valuefunc3var);
+ FFF_RESET_HISTORY();
+ }
+};
+
+TEST_F(FFFTestSuite, default_constants_can_be_overridden)
+{
+ unsigned sizeCallHistory = (sizeof fff.call_history) / (sizeof fff.call_history[0]);
+ ASSERT_EQ(OVERRIDE_CALL_HIST_LEN, sizeCallHistory);
+ ASSERT_EQ(OVERRIDE_ARG_HIST_LEN, voidfunc2_fake.arg_history_len);
+}
+
+// Fake declared in C++ context (not extern "C", using namespace)
+// before the fake is declared
+namespace cxx
+{
+ typedef int int_t;
+ void voidfunc1(cxx::int_t);
+}
+
+// Now declare the fake. Must be in the same namespace as the
+// original declaration.
+namespace cxx
+{
+#ifndef TEST_WITH_CALLING_CONVENTIONS
+ FAKE_VOID_FUNC(voidfunc1, cxx::int_t);
+#else
+ FAKE_VOID_FUNC(_cdecl, voidfunc1, cxx::int_t);
+#endif
+}
+
+TEST_F(FFFTestSuite, cxx_fake_is_called)
+{
+ cxx::voidfunc1(66);
+ ASSERT_EQ(cxx::voidfunc1_fake.call_count, 1u);
+ ASSERT_EQ(cxx::voidfunc1_fake.arg0_val, 66);
+}
+
+static int cxx_my_custom_fake_called = 0;
+void cxx_my_custom_fake(cxx::int_t i)
+{
+ cxx_my_custom_fake_called++;
+}
+
+TEST_F(FFFTestSuite, cxx_can_register_custom_fake)
+{
+ cxx::voidfunc1_fake.custom_fake = cxx_my_custom_fake;
+ cxx::voidfunc1(66);
+ ASSERT_EQ(1, cxx_my_custom_fake_called);
+}
+
+#include "test_cases.include"
diff --git a/deps/fff/test/src/fff_test_custom_function_template.cpp b/deps/fff/test/src/fff_test_custom_function_template.cpp
new file mode 100644
index 0000000..53689c3
--- /dev/null
+++ b/deps/fff/test/src/fff_test_custom_function_template.cpp
@@ -0,0 +1,29 @@
+/* Copyright 2022 Google LLC
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#include <gtest/gtest.h>
+
+#include "fff_wrapper.hpp"
+
+DEFINE_FFF_GLOBALS
+
+FAKE_VOID_FUNC(do_stuff, int);
+
+class FFFCustomFakeSuite : public ::testing::Test {
+ public:
+ void SetUp() override {
+ RESET_FAKE(do_stuff);
+ FFF_RESET_HISTORY();
+ }
+};
+
+TEST_F(FFFCustomFakeSuite, custom_cpp_fake_function)
+{
+ int x = 0;
+ do_stuff_fake.custom_fake = [&x](int i) {
+ x = i;
+ };
+ do_stuff(5);
+ ASSERT_EQ(5, x);
+}
diff --git a/deps/fff/test/src/fff_test_global_c.c b/deps/fff/test/src/fff_test_global_c.c
new file mode 100644
index 0000000..c74ea6a
--- /dev/null
+++ b/deps/fff/test/src/fff_test_global_c.c
@@ -0,0 +1,84 @@
+
+#include "global_fakes.h"
+#include "c_test_framework.h"
+
+
+
+DEFINE_FFF_GLOBALS;
+
+void setup()
+{
+ RESET_FAKE(voidfunc1);
+ RESET_FAKE(voidfunc2);
+ RESET_FAKE(voidfunc1outparam);
+ RESET_FAKE(longfunc0);
+ RESET_FAKE(enumfunc0);
+ RESET_FAKE(structfunc0);
+ RESET_FAKE(voidfunc3var);
+ RESET_FAKE(valuefunc3var);
+ RESET_FAKE(strlcpy3);
+
+ FFF_RESET_HISTORY();
+}
+
+
+#include "test_cases.include"
+
+
+int main()
+{
+ setbuf(stdout, NULL);
+ fprintf(stdout, "-------------\n");
+ fprintf(stdout, "Running Tests\n");
+ fprintf(stdout, "-------------\n\n");
+ fflush(0);
+
+ /* Run tests */
+ RUN_TEST(FFFTestSuite, when_void_func_never_called_then_callcount_is_zero);
+ RUN_TEST(FFFTestSuite, when_void_func_called_once_then_callcount_is_one);
+ RUN_TEST(FFFTestSuite, when_void_func_called_once_and_reset_then_callcount_is_zero);
+ RUN_TEST(FFFTestSuite, when_void_func_with_1_integer_arg_called_then_last_arg_captured);
+ RUN_TEST(FFFTestSuite, when_void_func_with_1_integer_arg_called_twice_then_last_arg_captured);
+ RUN_TEST(FFFTestSuite, when_void_func_with_1_integer_arg_called_and_reset_then_captured_arg_is_zero);
+ RUN_TEST(FFFTestSuite, when_void_func_with_2_char_args_called_then_last_args_captured);
+ RUN_TEST(FFFTestSuite, when_void_func_with_2_char_args_called_twice_then_last_args_captured);
+ RUN_TEST(FFFTestSuite, when_void_func_with_2_char_args_called_and_reset_then_captured_arg_is_zero);
+ RUN_TEST(FFFTestSuite, when_fake_func_called_then_const_arguments_captured);
+
+ RUN_TEST(FFFTestSuite, when_fake_func_created_default_history_is_fifty_calls);
+ RUN_TEST(FFFTestSuite, when_fake_func_called_then_arguments_captured_in_history);
+ RUN_TEST(FFFTestSuite, argument_history_is_reset_when_RESET_FAKE_called);
+ RUN_TEST(FFFTestSuite, when_fake_func_called_max_times_then_no_argument_histories_dropped);
+ RUN_TEST(FFFTestSuite, when_fake_func_called_max_times_plus_one_then_one_argument_history_dropped);
+
+ RUN_TEST(FFFTestSuite, value_func_will_return_zero_by_default);
+ RUN_TEST(FFFTestSuite, value_func_will_return_value_given);
+ RUN_TEST(FFFTestSuite, value_func_will_return_zero_after_reset);
+ RUN_TEST(FFFTestSuite, register_call_macro_registers_one_call);
+ RUN_TEST(FFFTestSuite, register_call_macro_registers_two_calls);
+ RUN_TEST(FFFTestSuite, reset_call_history_resets_call_history);
+ RUN_TEST(FFFTestSuite, call_history_will_not_write_past_array_bounds);
+ RUN_TEST(FFFTestSuite, calling_fake_registers_one_call);
+
+ RUN_TEST(FFFTestSuite, return_value_sequences_not_exhausted);
+ RUN_TEST(FFFTestSuite, return_value_sequences_exhausted);
+
+ RUN_TEST(FFFTestSuite, can_register_custom_fake);
+ RUN_TEST(FFFTestSuite, when_value_custom_fake_called_THEN_it_returns_custom_return_value);
+
+ RUN_TEST(FFFTestSuite, use_void_vararg_fake_with_different_number_of_arguments);
+ RUN_TEST(FFFTestSuite, use_value_vararg_fake_with_different_number_of_arguments);
+ RUN_TEST(FFFTestSuite, vararg_custom_fake_sequence_not_exhausted);
+ RUN_TEST(FFFTestSuite, vararg_custom_fake_seq_return_values_saved_in_history);
+ RUN_TEST(FFFTestSuite, vararg_custom_fake_sequence_exhausted);
+ RUN_TEST(FFFTestSuite, vararg_custom_fake_sequence_reset);
+
+ RUN_TEST(FFFTestSuite, can_capture_upto_20_arguments_correctly);
+ RUN_TEST(FFFTestSuite, value_func_can_capture_upto_20_arguments_correctly);
+
+ printf("\n-------------\n");
+ printf("Complete\n");
+ printf("-------------\n\n");
+
+ return 0;
+}
diff --git a/deps/fff/test/src/fff_test_global_cpp.cpp b/deps/fff/test/src/fff_test_global_cpp.cpp
new file mode 100644
index 0000000..bb4993d
--- /dev/null
+++ b/deps/fff/test/src/fff_test_global_cpp.cpp
@@ -0,0 +1,26 @@
+
+extern "C"{
+ #include "global_fakes.h"
+}
+#include "gtest/gtest.h"
+
+DEFINE_FFF_GLOBALS;
+
+class FFFTestSuite: public testing::Test
+{
+public:
+ void SetUp()
+ {
+ RESET_FAKE(voidfunc1);
+ RESET_FAKE(voidfunc2);
+ RESET_FAKE(longfunc0);
+ RESET_FAKE(voidfunc1outparam);
+ RESET_FAKE(voidfunc3var);
+ RESET_FAKE(valuefunc3var);
+ FFF_RESET_HISTORY();
+ }
+};
+
+#include "test_cases.include"
+
+
diff --git a/deps/fff/test/src/global_fakes.c b/deps/fff/test/src/global_fakes.c
new file mode 100644
index 0000000..cbd57ab
--- /dev/null
+++ b/deps/fff/test/src/global_fakes.c
@@ -0,0 +1,34 @@
+#include "global_fakes.h"
+#include <string.h> // for memcpy
+
+#ifndef TEST_WITH_CALLING_CONVENTIONS
+DEFINE_FAKE_VOID_FUNC(voidfunc1, int);
+DEFINE_FAKE_VOID_FUNC(voidfunc2, char, char);
+DEFINE_FAKE_VOID_FUNC(voidfunc1outparam, char *);
+
+DEFINE_FAKE_VALUE_FUNC(long, longfunc0);
+DEFINE_FAKE_VALUE_FUNC(enum MYBOOL, enumfunc0);
+DEFINE_FAKE_VALUE_FUNC(struct MyStruct, structfunc0);
+DEFINE_FAKE_VOID_FUNC_VARARG(voidfunc3var, const char *, int, ...);
+DEFINE_FAKE_VALUE_FUNC_VARARG(int, valuefunc3var, const char *, int, ...);
+#ifndef __cplusplus
+DEFINE_FAKE_VALUE_FUNC(int, strlcpy3, char* const, const char* const, const size_t);
+#endif /* __cplusplus */
+DEFINE_FAKE_VOID_FUNC(voidfunc20, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int);
+DEFINE_FAKE_VALUE_FUNC(int, valuefunc20, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int);
+#else
+DEFINE_FAKE_VOID_FUNC(__cdecl, voidfunc1, int);
+DEFINE_FAKE_VOID_FUNC(__cdecl, voidfunc2, char, char);
+DEFINE_FAKE_VOID_FUNC(__cdecl, voidfunc1outparam, char *);
+
+DEFINE_FAKE_VALUE_FUNC(long, __cdecl, longfunc0);
+DEFINE_FAKE_VALUE_FUNC(enum MYBOOL, __cdecl, enumfunc0);
+DEFINE_FAKE_VALUE_FUNC(struct MyStruct, __cdecl, structfunc0);
+DEFINE_FAKE_VOID_FUNC_VARARG(__cdecl, voidfunc3var, const char *, int, ...);
+DEFINE_FAKE_VALUE_FUNC_VARARG(int, __cdecl, valuefunc3var, const char *, int, ...);
+#ifndef __cplusplus
+DEFINE_FAKE_VALUE_FUNC(int, __cdecl, strlcpy3, char* const, const char* const, const size_t);
+#endif /* __cplusplus */
+DEFINE_FAKE_VOID_FUNC(__cdecl, voidfunc20, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int);
+DEFINE_FAKE_VALUE_FUNC(int, __cdecl,valuefunc20, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int);
+#endif
diff --git a/deps/fff/test/src/test_cases.include b/deps/fff/test/src/test_cases.include
new file mode 100644
index 0000000..261f7f2
--- /dev/null
+++ b/deps/fff/test/src/test_cases.include
@@ -0,0 +1,544 @@
+
+
+TEST_F(FFFTestSuite, when_void_func_never_called_then_callcount_is_zero)
+{
+ ASSERT_EQ(voidfunc1_fake.call_count, 0u);
+}
+
+TEST_F(FFFTestSuite, when_void_func_called_once_then_callcount_is_one)
+{
+ voidfunc1(66);
+ ASSERT_EQ(voidfunc1_fake.call_count, 1u);
+}
+
+TEST_F(FFFTestSuite, when_void_func_called_once_and_reset_then_callcount_is_zero)
+{
+ voidfunc1(66);
+ RESET_FAKE(voidfunc1);
+ ASSERT_EQ(voidfunc1_fake.call_count, 0u);
+}
+
+// Single Argument
+TEST_F(FFFTestSuite, when_void_func_with_1_integer_arg_called_then_last_arg_captured)
+{
+ voidfunc1(77);
+ ASSERT_EQ(voidfunc1_fake.arg0_val, 77);
+}
+
+TEST_F(FFFTestSuite, when_void_func_with_1_integer_arg_called_twice_then_last_arg_captured)
+{
+ voidfunc1(77);
+ voidfunc1(12);
+ ASSERT_EQ(voidfunc1_fake.arg0_val, 12);
+}
+
+TEST_F(FFFTestSuite, when_void_func_with_1_integer_arg_called_and_reset_then_captured_arg_is_zero)
+{
+ voidfunc1(11);
+ RESET_FAKE(voidfunc1);
+ ASSERT_EQ(voidfunc1_fake.arg0_val, 0);
+}
+
+// Two Arguments
+TEST_F(FFFTestSuite, when_void_func_with_2_char_args_called_then_last_args_captured)
+{
+ voidfunc2('a', 'b');
+ ASSERT_EQ(voidfunc2_fake.arg0_val, 'a');
+ ASSERT_EQ(voidfunc2_fake.arg1_val, 'b');
+}
+
+TEST_F(FFFTestSuite, when_void_func_with_2_char_args_called_twice_then_last_args_captured)
+{
+ voidfunc2('a', 'b');
+ voidfunc2('c', 'd');
+ ASSERT_EQ(voidfunc2_fake.arg0_val, 'c');
+ ASSERT_EQ(voidfunc2_fake.arg1_val, 'd');
+}
+
+TEST_F(FFFTestSuite, when_void_func_with_2_char_args_called_and_reset_then_captured_arg_is_zero)
+{
+ voidfunc2('e', 'f');
+ RESET_FAKE(voidfunc2);
+ ASSERT_EQ(voidfunc2_fake.arg0_val, 0);
+ ASSERT_EQ(voidfunc2_fake.arg1_val, 0);
+}
+
+#ifndef __cplusplus
+TEST_F(FFFTestSuite, when_fake_func_called_then_const_arguments_captured)
+{
+ char dst[80];
+ strlcpy3(dst, __FUNCTION__, sizeof(__FUNCTION__));
+}
+#endif /* __cplusplus */
+
+// Argument history
+TEST_F(FFFTestSuite, when_fake_func_created_default_history_is_fifty_calls)
+{
+ ASSERT_EQ(FFF_ARG_HISTORY_LEN, (sizeof voidfunc2_fake.arg0_history) / (sizeof voidfunc2_fake.arg0_history[0]));
+ ASSERT_EQ(FFF_ARG_HISTORY_LEN, (sizeof voidfunc2_fake.arg1_history) / (sizeof voidfunc2_fake.arg1_history[0]));
+}
+
+TEST_F(FFFTestSuite, when_fake_func_called_then_arguments_captured_in_history)
+{
+ voidfunc2('g', 'h');
+ ASSERT_EQ('g', voidfunc2_fake.arg0_history[0]);
+ ASSERT_EQ('h', voidfunc2_fake.arg1_history[0]);
+}
+
+TEST_F(FFFTestSuite, argument_history_is_reset_when_RESET_FAKE_called)
+{
+ //given
+ voidfunc2('g', 'h');
+ ASSERT_EQ('g', voidfunc2_fake.arg0_history[0]);
+ ASSERT_EQ('h', voidfunc2_fake.arg1_history[0]);
+ //when
+ RESET_FAKE(voidfunc2);
+ //then
+ ASSERT_EQ('\0', voidfunc2_fake.arg0_history[0]);
+ ASSERT_EQ('\0', voidfunc2_fake.arg1_history[0]);
+}
+
+TEST_F(FFFTestSuite, when_fake_func_called_max_times_then_no_argument_histories_dropped)
+{
+ unsigned int i;
+ for (i = 0; i < FFF_ARG_HISTORY_LEN; i++)
+ {
+ voidfunc2('1' + i, '2' + i);
+ }
+ ASSERT_EQ(0u, voidfunc2_fake.arg_histories_dropped);
+}
+
+TEST_F(FFFTestSuite, when_fake_func_called_max_times_plus_one_then_one_argument_history_dropped)
+{
+ unsigned int i;
+ for (i = 0; i < FFF_ARG_HISTORY_LEN; i++)
+ {
+ voidfunc2('1' + i, '2' + i);
+ }
+ voidfunc2('1', '2');
+ ASSERT_EQ(1u, voidfunc2_fake.arg_histories_dropped);
+ // or in other words..
+ ASSERT_TRUE(voidfunc2_fake.call_count > voidfunc2_fake.arg_history_len);
+}
+
+// Return values
+TEST_F(FFFTestSuite, value_func_will_return_zero_by_default)
+{
+ ASSERT_EQ(0l, longfunc0());
+}
+
+TEST_F(FFFTestSuite, value_func_will_return_value_given)
+{
+ longfunc0_fake.return_val = 99l;
+ ASSERT_EQ(99l, longfunc0());
+}
+
+TEST_F(FFFTestSuite, value_func_will_return_zero_after_reset)
+{
+ longfunc0_fake.return_val = 99l;
+ RESET_FAKE(longfunc0);
+ ASSERT_EQ(0l, longfunc0());
+}
+
+TEST_F(FFFTestSuite, register_call_macro_registers_one_call)
+{
+ REGISTER_CALL(longfunc0);
+ ASSERT_EQ(fff.call_history[0], (void *)longfunc0);
+}
+
+TEST_F(FFFTestSuite, register_call_macro_registers_two_calls)
+{
+ REGISTER_CALL(longfunc0);
+ REGISTER_CALL(voidfunc2);
+
+ ASSERT_EQ(fff.call_history[0], (void *)longfunc0);
+ ASSERT_EQ(fff.call_history[1], (void *)voidfunc2);
+}
+
+TEST_F(FFFTestSuite, reset_call_history_resets_call_history)
+{
+ REGISTER_CALL(longfunc0);
+ REGISTER_CALL(voidfunc1);
+ FFF_RESET_HISTORY();
+ REGISTER_CALL(voidfunc2);
+
+ ASSERT_EQ(1u, fff.call_history_idx);
+ ASSERT_EQ(fff.call_history[0], (void *)voidfunc2);
+ ASSERT_EQ(fff.call_history[1], (void *)0);
+}
+
+TEST_F(FFFTestSuite, call_history_will_not_write_past_array_bounds)
+{
+ for (unsigned int i = 0; i < FFF_CALL_HISTORY_LEN + 1; i++)
+ {
+ REGISTER_CALL(longfunc0);
+ }
+ ASSERT_EQ(FFF_CALL_HISTORY_LEN, fff.call_history_idx);
+}
+
+TEST_F(FFFTestSuite, calling_fake_registers_one_call)
+{
+ longfunc0();
+ ASSERT_EQ(fff.call_history_idx, 1u);
+ ASSERT_EQ(fff.call_history[0], (void *)longfunc0);
+}
+
+TEST_F(FFFTestSuite, return_value_sequences_not_exhausted)
+{
+ long myReturnVals[3] = { 3, 7, 9 };
+ SET_RETURN_SEQ(longfunc0, myReturnVals, 3);
+ ASSERT_EQ(myReturnVals[0], longfunc0());
+ ASSERT_EQ(myReturnVals[1], longfunc0());
+ ASSERT_EQ(myReturnVals[2], longfunc0());
+}
+
+
+TEST_F(FFFTestSuite, return_value_sequences_exhausted)
+{
+ long myReturnVals[3] = { 3, 7, 9 };
+ SET_RETURN_SEQ(longfunc0, myReturnVals, 3);
+ ASSERT_EQ(myReturnVals[0], longfunc0());
+ ASSERT_EQ(myReturnVals[1], longfunc0());
+ ASSERT_EQ(myReturnVals[2], longfunc0());
+ ASSERT_EQ(myReturnVals[2], longfunc0());
+ ASSERT_EQ(myReturnVals[2], longfunc0());
+}
+
+TEST_F(FFFTestSuite, return_value_sequences_reset)
+{
+ long myReturnVals[3] = { 3, 7, 9 };
+ SET_RETURN_SEQ(longfunc0, myReturnVals, 3);
+ ASSERT_EQ(myReturnVals[0], longfunc0());
+ ASSERT_EQ(myReturnVals[1], longfunc0());
+ RESET_FAKE(longfunc0);
+ ASSERT_EQ(0, longfunc0());
+}
+
+static int my_custom_fake_called = 0;
+void my_custom_fake(char a, char b)
+{
+ my_custom_fake_called++;
+}
+
+TEST_F(FFFTestSuite, can_register_custom_fake)
+{
+ voidfunc2_fake.custom_fake = my_custom_fake;
+ voidfunc2('a', 'b');
+ ASSERT_EQ(1, my_custom_fake_called);
+}
+
+void voidfunc1outparam_custom_fake1(char *a)
+{
+ *a = 'x';
+}
+
+void voidfunc1outparam_custom_fake2(char *a)
+{
+ *a = 'y';
+}
+
+void voidfunc1outparam_custom_fake3(char *a)
+{
+ *a = 'z';
+}
+
+TEST_F(FFFTestSuite, custom_fake_sequence_not_exausthed)
+{
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fakes[], char *) = {
+ voidfunc1outparam_custom_fake1,
+ voidfunc1outparam_custom_fake2,
+ voidfunc1outparam_custom_fake3
+ };
+ char a = 'a';
+
+ SET_CUSTOM_FAKE_SEQ(voidfunc1outparam, custom_fakes, 3);
+
+ voidfunc1outparam(&a);
+ ASSERT_EQ('x', a);
+ voidfunc1outparam(&a);
+ ASSERT_EQ('y', a);
+ voidfunc1outparam(&a);
+ ASSERT_EQ('z', a);
+}
+
+TEST_F(FFFTestSuite, return_value_sequence_saved_in_history)
+{
+ long myReturnVals[3] = { 3, 7, 9 };
+ SET_RETURN_SEQ(longfunc0, myReturnVals, 3);
+ longfunc0();
+ longfunc0();
+ longfunc0();
+ ASSERT_EQ(myReturnVals[0], longfunc0_fake.return_val_history[0]);
+ ASSERT_EQ(myReturnVals[1], longfunc0_fake.return_val_history[1]);
+ ASSERT_EQ(myReturnVals[2], longfunc0_fake.return_val_history[2]);
+}
+
+TEST_F(FFFTestSuite, return_value_saved_in_history)
+{
+ long i;
+
+ for (i = 0; i < FFF_ARG_HISTORY_LEN; i++)
+ {
+ longfunc0_fake.return_val = i + 1;
+ longfunc0();
+ }
+
+ for (i = 0; i < FFF_ARG_HISTORY_LEN; i++)
+ {
+ ASSERT_EQ(longfunc0_fake.return_val_history[i], i + 1);
+ }
+}
+
+long custom_longfunc1(void)
+{
+ return 42;
+}
+
+long custom_longfunc2(void)
+{
+ return 15;
+}
+
+long custom_longfunc3(void)
+{
+ return 7;
+}
+
+TEST_F(FFFTestSuite, custom_fake_seq_return_values_saved_in_history)
+{
+ CUSTOM_FFF_FUNCTION_TEMPLATE(long, custom_fakes[], void) = {
+ custom_longfunc1,
+ custom_longfunc2,
+ custom_longfunc3};
+
+ SET_CUSTOM_FAKE_SEQ(longfunc0, custom_fakes, 3);
+
+ longfunc0();
+ longfunc0();
+ longfunc0();
+
+ ASSERT_EQ(42, longfunc0_fake.return_val_history[0]);
+ ASSERT_EQ(15, longfunc0_fake.return_val_history[1]);
+ ASSERT_EQ(7, longfunc0_fake.return_val_history[2]);
+}
+
+TEST_F(FFFTestSuite, custom_fake_sequence_exhausted)
+{
+ CUSTOM_FFF_FUNCTION_TEMPLATE(void, custom_fakes[], char *) = {
+ voidfunc1outparam_custom_fake1,
+ voidfunc1outparam_custom_fake2,
+ voidfunc1outparam_custom_fake3};
+ char a = 'a';
+
+ SET_CUSTOM_FAKE_SEQ(voidfunc1outparam, custom_fakes, 3);
+
+ voidfunc1outparam(&a);
+ ASSERT_EQ('x', a);
+ voidfunc1outparam(&a);
+ ASSERT_EQ('y', a);
+ voidfunc1outparam(&a);
+ ASSERT_EQ('z', a);
+ a = 'a';
+ voidfunc1outparam(&a);
+ ASSERT_EQ('z', a);
+ a = 'b';
+ voidfunc1outparam(&a);
+ ASSERT_EQ('z', a);
+}
+//DECLARE_FAKE_VALUE_FUNC0(long, longfunc0);
+#define MEANING_OF_LIFE 42
+long my_custom_value_fake(void)
+{
+ return MEANING_OF_LIFE;
+}
+
+long my_custom_value_fake2(void)
+{
+ static long val = 0;
+ return val++;
+}
+
+TEST_F(FFFTestSuite, when_value_custom_fake_called_THEN_it_returns_custom_return_value)
+{
+ longfunc0_fake.custom_fake = my_custom_value_fake;
+ long retval = longfunc0();
+ ASSERT_EQ(MEANING_OF_LIFE, retval);
+}
+
+TEST_F(FFFTestSuite, return_values_from_custom_fake_saved_in_history)
+{
+ longfunc0_fake.custom_fake = my_custom_value_fake2;
+ longfunc0();
+ longfunc0();
+ longfunc0();
+
+ ASSERT_EQ(0, longfunc0_fake.return_val_history[0]);
+ ASSERT_EQ(1, longfunc0_fake.return_val_history[1]);
+ ASSERT_EQ(2, longfunc0_fake.return_val_history[2]);
+}
+
+int valuefunc3var_custom_fake1(const char *str, int a, va_list vl)
+{
+ int arg;
+ while ((arg = va_arg(vl, int)) != 0)
+ a += arg;
+ return a;
+}
+
+int valuefunc3var_custom_fake2(const char *str, int a, va_list vl)
+{
+ int arg;
+ while ((arg = va_arg(vl, int)) != 0)
+ a -= arg;
+ return a;
+}
+
+int valuefunc3var_custom_fake3(const char *str, int a, va_list vl)
+{
+ int arg;
+ while ((arg = va_arg(vl, int)) != 0)
+ a *= arg;
+ return a;
+}
+
+TEST_F(FFFTestSuite, vararg_custom_fake_sequence_not_exhausted)
+{
+ CUSTOM_FFF_FUNCTION_TEMPLATE(int, custom_fakes[], const char *, int,
+ va_list) = {valuefunc3var_custom_fake1,
+ valuefunc3var_custom_fake2,
+ valuefunc3var_custom_fake3};
+ SET_CUSTOM_FAKE_SEQ(valuefunc3var, custom_fakes, 3);
+ int a = 1;
+ ASSERT_EQ(valuefunc3var("a", a, 2, 3, 4, 0), 10);
+ ASSERT_EQ(valuefunc3var("aa", a, 2, 3, 4, 2, 0), -10);
+ ASSERT_EQ(valuefunc3var("aaa", a, 2, 3, 0), 6);
+}
+
+TEST_F(FFFTestSuite, vararg_custom_fake_seq_return_values_saved_in_history)
+{
+ CUSTOM_FFF_FUNCTION_TEMPLATE(int, custom_fakes[], const char *, int,
+ va_list) = {valuefunc3var_custom_fake1,
+ valuefunc3var_custom_fake2,
+ valuefunc3var_custom_fake3};
+ SET_CUSTOM_FAKE_SEQ(valuefunc3var, custom_fakes, 3);
+ int a = 1;
+ valuefunc3var("a", a, 2, 3, 4, 0);
+ valuefunc3var("aa", a, 2, 3, 4, 2, 0);
+ valuefunc3var("aaa", a, 2, 3, 0);
+ ASSERT_EQ(10, valuefunc3var_fake.return_val_history[0]);
+ ASSERT_EQ(-10, valuefunc3var_fake.return_val_history[1]);
+ ASSERT_EQ(6, valuefunc3var_fake.return_val_history[2]);
+}
+
+TEST_F(FFFTestSuite, vararg_custom_fake_sequence_exhausted)
+{
+ CUSTOM_FFF_FUNCTION_TEMPLATE(int, custom_fakes[], const char *, int,
+ va_list) = {valuefunc3var_custom_fake1,
+ valuefunc3var_custom_fake2,
+ valuefunc3var_custom_fake3};
+ SET_CUSTOM_FAKE_SEQ(valuefunc3var, custom_fakes, 3);
+ int a = 1;
+ ASSERT_EQ(valuefunc3var("a", a, 2, 3, 4, 0), 10);
+ ASSERT_EQ(valuefunc3var("aa", a, 2, 3, 4, 2, 0), -10);
+ ASSERT_EQ(valuefunc3var("aaa", a, 2, 3, 0), 6);
+ ASSERT_EQ(valuefunc3var("aaa", a, 4, 5, 1, 0), 20);
+ ASSERT_EQ(valuefunc3var("aaa", a, 4, 0), 4);
+}
+
+TEST_F(FFFTestSuite, vararg_custom_fake_sequence_reset)
+{
+ CUSTOM_FFF_FUNCTION_TEMPLATE(int, custom_fakes[], const char *, int,
+ va_list) = {valuefunc3var_custom_fake1,
+ valuefunc3var_custom_fake2,
+ valuefunc3var_custom_fake3};
+ SET_CUSTOM_FAKE_SEQ(valuefunc3var, custom_fakes, 3);
+ int a = 1;
+ ASSERT_EQ(valuefunc3var("a", a, 2, 3, 4, 0), 10);
+ ASSERT_EQ(valuefunc3var("aa", a, 2, 3, 4, 2, 0), -10);
+ RESET_FAKE(valuefunc3var);
+ ASSERT_EQ(0, valuefunc3var("b", 7, 4, 5));
+ valuefunc3var_fake.return_val = 1;
+ ASSERT_EQ(1, valuefunc3var("c", 5, 4, 4));
+ valuefunc3var_fake.return_val = 2;
+ ASSERT_EQ(2, valuefunc3var("d", 6, 3, 5));
+}
+
+TEST_F(FFFTestSuite, use_void_vararg_fake_with_different_number_of_arguments)
+{
+ voidfunc3var("0 parameters", 0);
+ voidfunc3var("1 parameter", 1, 10);
+ voidfunc3var("2 parameters", 2, 10, 20);
+ voidfunc3var("3 parameters", 3, 10, 20, 30);
+
+ ASSERT_EQ(voidfunc3var_fake.call_count, 4u);
+ char msg[] = "3 parameters";
+ ASSERT_EQ(strcmp(voidfunc3var_fake.arg0_val, msg), 0);
+ ASSERT_EQ(3, voidfunc3var_fake.arg1_val);
+}
+
+TEST_F(FFFTestSuite, use_value_vararg_fake_with_different_number_of_arguments)
+{
+ valuefunc3var("0 parameters", 0);
+ valuefunc3var("1 parameter", 1, 10);
+ valuefunc3var("2 parameters", 2, 10, 20);
+ valuefunc3var("3 parameters", 3, 10, 20, 30);
+
+ ASSERT_EQ(valuefunc3var_fake.call_count, 4u);
+ char msg[] = "3 parameters";
+ ASSERT_EQ(strcmp(valuefunc3var_fake.arg0_val, msg), 0);
+ ASSERT_EQ(3, valuefunc3var_fake.arg1_val);
+}
+
+TEST_F(FFFTestSuite, can_capture_upto_20_arguments_correctly)
+{
+ voidfunc20(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19);
+ ASSERT_EQ(0, voidfunc20_fake.arg0_val);
+ ASSERT_EQ(1, voidfunc20_fake.arg1_val);
+ ASSERT_EQ(2, voidfunc20_fake.arg2_val);
+ ASSERT_EQ(3, voidfunc20_fake.arg3_val);
+ ASSERT_EQ(4, voidfunc20_fake.arg4_val);
+ ASSERT_EQ(5, voidfunc20_fake.arg5_val);
+ ASSERT_EQ(6, voidfunc20_fake.arg6_val);
+ ASSERT_EQ(7, voidfunc20_fake.arg7_val);
+ ASSERT_EQ(8, voidfunc20_fake.arg8_val);
+ ASSERT_EQ(9, voidfunc20_fake.arg9_val);
+ ASSERT_EQ(10, voidfunc20_fake.arg10_val);
+ ASSERT_EQ(11, voidfunc20_fake.arg11_val);
+ ASSERT_EQ(12, voidfunc20_fake.arg12_val);
+ ASSERT_EQ(13, voidfunc20_fake.arg13_val);
+ ASSERT_EQ(14, voidfunc20_fake.arg14_val);
+ ASSERT_EQ(15, voidfunc20_fake.arg15_val);
+ ASSERT_EQ(16, voidfunc20_fake.arg16_val);
+ ASSERT_EQ(17, voidfunc20_fake.arg17_val);
+ ASSERT_EQ(18, voidfunc20_fake.arg18_val);
+ ASSERT_EQ(19, voidfunc20_fake.arg19_val);
+}
+
+TEST_F(FFFTestSuite, value_func_can_capture_upto_20_arguments_correctly)
+{
+ valuefunc20_fake.return_val = 42;
+
+ int return_val = valuefunc20(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19);
+
+ ASSERT_EQ(42, return_val);
+ ASSERT_EQ(0, valuefunc20_fake.arg0_val);
+ ASSERT_EQ(1, valuefunc20_fake.arg1_val);
+ ASSERT_EQ(2, valuefunc20_fake.arg2_val);
+ ASSERT_EQ(3, valuefunc20_fake.arg3_val);
+ ASSERT_EQ(4, valuefunc20_fake.arg4_val);
+ ASSERT_EQ(5, valuefunc20_fake.arg5_val);
+ ASSERT_EQ(6, valuefunc20_fake.arg6_val);
+ ASSERT_EQ(7, valuefunc20_fake.arg7_val);
+ ASSERT_EQ(8, valuefunc20_fake.arg8_val);
+ ASSERT_EQ(9, valuefunc20_fake.arg9_val);
+ ASSERT_EQ(10, valuefunc20_fake.arg10_val);
+ ASSERT_EQ(11, valuefunc20_fake.arg11_val);
+ ASSERT_EQ(12, valuefunc20_fake.arg12_val);
+ ASSERT_EQ(13, valuefunc20_fake.arg13_val);
+ ASSERT_EQ(14, valuefunc20_fake.arg14_val);
+ ASSERT_EQ(15, valuefunc20_fake.arg15_val);
+ ASSERT_EQ(16, valuefunc20_fake.arg16_val);
+ ASSERT_EQ(17, valuefunc20_fake.arg17_val);
+ ASSERT_EQ(18, valuefunc20_fake.arg18_val);
+ ASSERT_EQ(19, valuefunc20_fake.arg19_val);
+}