Merge remote-tracking branch 'origin/upstream-master'

Change-Id: Ie5edd0f8aff0a645707387b8bd42b0d695280ef3
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..ed09e27
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,4 @@
+build/
+*~
+*.sublime-project
+*.sublime-workspace
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..cb7ea9b
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,8 @@
+language: cpp
+compiler:
+  - clang
+  - gcc
+script: ./buildandtest
+os:
+  - linux
+  - osx
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..7b3129b
--- /dev/null
+++ b/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/Makefile b/Makefile
new file mode 100644
index 0000000..a774e0b
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,10 @@
+all:
+	mkdir -p build
+	cd gtest; $(MAKE) all
+	cd test; $(MAKE) all
+	cd examples; $(MAKE) all
+
+clean: 
+	cd gtest; $(MAKE) clean
+	cd test; $(MAKE) clean
+	cd examples; $(MAKE) clean
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..45a83ed
--- /dev/null
+++ b/README.md
@@ -0,0 +1,586 @@
+# Fake Function Framework  (fff)
+-----------------------------
+
+[![Build Status](https://travis-ci.org/meekrosoft/fff.svg?branch=master)](https://travis-ci.org/meekrosoft/fff)
+
+## 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.
+
+
+## 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. <tt>fff</tt> 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 <tt>return_val_history</tt> field.
+
+## Variadic Functions
+
+You can fake variadic functions using the macros <tt>FAKE_VALUE_FUNC_VARARG</tt>
+and <tt>FAKE_VOID_FUNC_VARARG</tt>. 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
+<tt>va_list</tt> parameter. For instance, a custom fake for <tt>fprintf()</tt>
+could call the real <tt>fprintf()</tt> 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);
+    }
+
+## 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) you can even combine all this in a single unit test function so you can easily oversee all details of the test.
+
+```c
+/* 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;
+    void getTime_custom_fake(Time *now) {
+        *now = getTime_custom_now;
+    }
+    getTime_fake.custom_fake = getTime_custom_fake;
+
+    /* given a specific time */
+    getTime_custom_now.hour = 13;
+    getTime_custom_now.min  = 05;
+
+    /* 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, ...);
+
+```
+
+## 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 src/test
+ * There is an example for testing an embedded UI and a hardware driver under src/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); |
+| RESET_FAKE(fn); | Reset the state of fake function called fn | RESET_FAKE(DISPLAY_init); |
diff --git a/buildandtest b/buildandtest
new file mode 100755
index 0000000..7490cda
--- /dev/null
+++ b/buildandtest
@@ -0,0 +1,16 @@
+#!/bin/bash
+set -e
+
+cat LICENSE > fff.h
+echo >> fff.h
+ruby fakegen.rb >> fff.h
+make clean
+make all
+build/fff_test_c 
+build/fff_test_cpp --gtest_output=xml:build/test_results.xml
+build/ui_test_ansic
+build/ui_test_cpp --gtest_output=xml:build/example_results.xml
+build/fff_test_glob_c
+build/fff_test_glob_cpp --gtest_output=xml:build/test_global_results.xml
+build/driver_testing --gtest_output=xml:build/driver_testing.xml
+build/driver_testing_fff  --gtest_output=xml:build/driver_testing_fff.xml
diff --git a/examples/Makefile b/examples/Makefile
new file mode 100644
index 0000000..f352de3
--- /dev/null
+++ b/examples/Makefile
@@ -0,0 +1,7 @@
+all: 
+	cd embedded_ui; $(MAKE) all
+	cd driver_testing; $(MAKE) all
+
+clean: 
+	cd embedded_ui; $(MAKE) clean
+	cd driver_testing; $(MAKE) clean
diff --git a/examples/driver_testing/Makefile b/examples/driver_testing/Makefile
new file mode 100644
index 0000000..e32faaf
--- /dev/null
+++ b/examples/driver_testing/Makefile
@@ -0,0 +1,64 @@
+$(VERBOSE).SILENT:
+
+BUILD_DIR = ../../build
+TEMPLATE_PROGNAME = $(BUILD_DIR)/template
+CPP_PROGNAME_NOFFF = $(BUILD_DIR)/driver_testing
+CPP_PROGNAME_FFF = $(BUILD_DIR)/driver_testing_fff
+CC = gcc
+CC += -c
+CPP = g++
+CPP += -c
+LD = g++
+
+GTEST_OBJS = $(BUILD_DIR)/gtest-all.o $(BUILD_DIR)/gtest-main.o
+C_OBJFILES = $(BUILD_DIR)/driver.o
+TEMPLATE_OBJFILES = $(BUILD_DIR)/test_suite_template.o
+FFF_OBJFILES = $(BUILD_DIR)/driver.test.fff.o $(GTEST_OBJS)
+NOFFF_OBJFILES = $(BUILD_DIR)/driver.test.o $(GTEST_OBJS)
+CPP_LIBS = -lpthread 
+
+
+all: $(CPP_PROGNAME_NOFFF) $(CPP_PROGNAME_FFF) $(TEMPLATE_PROGNAME)
+
+.PHONY: clean
+
+clean:
+	@echo "Cleaning object files"
+	@echo "    rm -f     $(BUILD_DIR)/*.o"
+	rm -f $(BUILD_DIR)/*.o
+	@echo "Cleaning backups"
+	@echo "    rm -f     *~"
+	rm -f *~
+	@echo "Removing programs"
+	@echo "    rm -f     $(CPP_PROGNAME_NOFFF) $(CPP_PROGNAME_FFF) $(TEMPLATE_PROGNAME)"
+	rm -f $(CPP_PROGNAME_NOFFF) $(CPP_PROGNAME_FFF) $(TEMPLATE_PROGNAME)
+
+
+$(BUILD_DIR)/%.o: %.c
+	@echo "Compiling "$@
+	@echo "    CC        "$<
+	$(CC)  -o $@ $< -DTESTING
+
+$(BUILD_DIR)/%.o: %.cpp
+	@echo "Compiling "$@
+	@echo "    CPP       "$<
+	$(CPP) -DGTEST_USE_OWN_TR1_TUPLE=1 -I../.. -o $@ $< -DTESTING
+
+$(TEMPLATE_PROGNAME): $(TEMPLATE_OBJFILES)
+	@echo "Linking "$@
+	@echo "    LD        -o "ctemplate"        "$(TEMPLATE_OBJFILES)
+	$(LD) -o $(TEMPLATE_PROGNAME) $(TEMPLATE_OBJFILES)
+
+$(CPP_PROGNAME_FFF): $(FFF_OBJFILES) $(C_OBJFILES)
+	@echo "Linking "$@
+	@echo "    LD        -o "$(CPP_PROGNAME_FFF)"        "$(FFF_OBJFILES)
+	$(LD) -o $(CPP_PROGNAME_FFF) $(FFF_OBJFILES) $(C_OBJFILES) $(CPP_LIBS)
+
+$(CPP_PROGNAME_NOFFF): $(NOFFF_OBJFILES) $(C_OBJFILES)
+	@echo "Linking "$@
+	@echo "    LD        -o "$(CPP_PROGNAME_NOFFF)"        "$(NOFFF_OBJFILES)
+	$(LD) -o $(CPP_PROGNAME_NOFFF) $(NOFFF_OBJFILES) $(C_OBJFILES) $(CPP_LIBS)
+
+nothing:
+	@echo "Nothing to do; quitting  :("
+	@echo "HINT: Try make all"
diff --git a/examples/driver_testing/driver.c b/examples/driver_testing/driver.c
new file mode 100644
index 0000000..9454ba6
--- /dev/null
+++ b/examples/driver_testing/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/examples/driver_testing/driver.h b/examples/driver_testing/driver.h
new file mode 100644
index 0000000..b7406d4
--- /dev/null
+++ b/examples/driver_testing/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/examples/driver_testing/driver.test.cpp b/examples/driver_testing/driver.test.cpp
new file mode 100644
index 0000000..2df0702
--- /dev/null
+++ b/examples/driver_testing/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/examples/driver_testing/driver.test.fff.cpp b/examples/driver_testing/driver.test.fff.cpp
new file mode 100644
index 0000000..d8aeb06
--- /dev/null
+++ b/examples/driver_testing/driver.test.fff.cpp
@@ -0,0 +1,62 @@
+extern "C"{
+    #include "driver.h"
+    #include "registers.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/examples/driver_testing/hardware_abstraction.h b/examples/driver_testing/hardware_abstraction.h
new file mode 100644
index 0000000..affa92e
--- /dev/null
+++ b/examples/driver_testing/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/examples/driver_testing/registers.h b/examples/driver_testing/registers.h
new file mode 100644
index 0000000..5c9e5a9
--- /dev/null
+++ b/examples/driver_testing/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/examples/embedded_ui/DISPLAY.h b/examples/embedded_ui/DISPLAY.h
new file mode 100644
index 0000000..45ca62e
--- /dev/null
+++ b/examples/embedded_ui/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/examples/embedded_ui/Kata.txt b/examples/embedded_ui/Kata.txt
new file mode 100644
index 0000000..b466c36
--- /dev/null
+++ b/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/examples/embedded_ui/Makefile b/examples/embedded_ui/Makefile
new file mode 100644
index 0000000..654beec
--- /dev/null
+++ b/examples/embedded_ui/Makefile
@@ -0,0 +1,67 @@
+$(VERBOSE).SILENT:
+
+BUILD_DIR = ../../build
+TEMPLATE_PROGNAME = $(BUILD_DIR)/template
+C_PROGNAME = $(BUILD_DIR)/ui_test_ansic
+CPP_PROGNAME = $(BUILD_DIR)/ui_test_cpp
+CC = gcc
+CC += -c
+CPP = g++
+CPP += -c
+LD = g++
+
+GTEST_OBJS = $(BUILD_DIR)/gtest-all.o $(BUILD_DIR)/gtest-main.o
+C_OBJFILES = $(BUILD_DIR)/UI_test_ansic.o $(BUILD_DIR)/UI.o
+TEMPLATE_OBJFILES = $(BUILD_DIR)/test_suite_template.o
+CPP_OBJFILES = $(BUILD_DIR)/UI_test_cpp.o $(BUILD_DIR)/UI.o $(GTEST_OBJS)
+CPP_LIBS = -lpthread 
+
+
+all: $(C_PROGNAME) $(CPP_PROGNAME) $(TEMPLATE_PROGNAME)
+
+.PHONY: clean
+
+clean:
+	@echo "Cleaning object files"
+	@echo "    rm -f     $(BUILD_DIR)/*.o"
+	rm -f $(BUILD_DIR)/*.o
+	@echo "Cleaning backups"
+	@echo "    rm -f     *~"
+	rm -f *~
+	@echo "Removing programs"
+	@echo "    rm -f     "$(C_PROGNAME)
+	rm -f $(C_PROGNAME)
+	@echo "    rm -f     "$(CPP_PROGNAME) $(TEMPLATE_PROGNAME)
+	rm -f $(CPP_PROGNAME) $(TEMPLATE_PROGNAME)
+
+
+$(BUILD_DIR)/%.o: %.c
+	@echo "Compiling "$@
+	@echo "    CC        "$<
+	$(CC)  -o $@ $<
+
+$(BUILD_DIR)/%.o: %.cpp
+	@echo "Compiling "$@
+	@echo "    CPP       "$<
+	$(CPP) -DGTEST_USE_OWN_TR1_TUPLE=1 -I../.. -o $@ $< 
+
+$(TEMPLATE_PROGNAME): $(TEMPLATE_OBJFILES)
+	@echo "Linking "$@
+	@echo "    LD        -o "ctemplate"        "$(TEMPLATE_OBJFILES)
+	$(LD) -o $(TEMPLATE_PROGNAME) $(TEMPLATE_OBJFILES)
+
+$(C_PROGNAME): $(C_OBJFILES)
+	@echo "Linking "$@
+	@echo "    LD        -o "$(C_PROGNAME)"        "$(C_OBJFILES)
+	$(LD) -o $(C_PROGNAME) $(C_OBJFILES)
+
+$(CPP_PROGNAME): $(CPP_OBJFILES) $(C_OBJFILES)
+	@echo "Linking "$@
+	@echo "    LD        -o "$(CPP_PROGNAME)"        "$(CPP_OBJFILES)
+	$(LD) -o $(CPP_PROGNAME) $(CPP_OBJFILES) $(CPP_LIBS)
+
+
+
+nothing:
+	@echo "Nothing to do; quitting  :("
+	@echo "HINT: Try make all"
diff --git a/examples/embedded_ui/SYSTEM.h b/examples/embedded_ui/SYSTEM.h
new file mode 100644
index 0000000..080144f
--- /dev/null
+++ b/examples/embedded_ui/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/examples/embedded_ui/UI.c b/examples/embedded_ui/UI.c
new file mode 100644
index 0000000..8ce996e
--- /dev/null
+++ b/examples/embedded_ui/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/examples/embedded_ui/UI.h b/examples/embedded_ui/UI.h
new file mode 100644
index 0000000..8a3fb5c
--- /dev/null
+++ b/examples/embedded_ui/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/examples/embedded_ui/UI_test_ansic.c b/examples/embedded_ui/UI_test_ansic.c
new file mode 100644
index 0000000..f98e409
--- /dev/null
+++ b/examples/embedded_ui/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/examples/embedded_ui/UI_test_cpp.cpp b/examples/embedded_ui/UI_test_cpp.cpp
new file mode 100644
index 0000000..ecd9def
--- /dev/null
+++ b/examples/embedded_ui/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/examples/embedded_ui/test_suite_template.c b/examples/embedded_ui/test_suite_template.c
new file mode 100644
index 0000000..00df5bb
--- /dev/null
+++ b/examples/embedded_ui/test_suite_template.c
@@ -0,0 +1,34 @@
+#include "../../test/c_test_framework.h"
+
+/* Initialializers called for every test */
+void setup()
+{
+
+}
+
+/* Tests go here */
+TEST_F(GreeterTests, hello_world)
+{
+	assert(1 == 0);
+}
+
+
+
+int main()
+{
+	setbuf(stderr, NULL);
+	fprintf(stdout, "-------------\n");
+	fprintf(stdout, "Running Tests\n");
+	fprintf(stdout, "-------------\n\n");
+    fflush(0);
+
+	/* Run tests */
+    RUN_TEST(GreeterTests, hello_world);
+
+
+    printf("\n-------------\n");
+    printf("Complete\n");
+	printf("-------------\n\n");
+
+	return 0;
+}
diff --git a/fakegen.rb b/fakegen.rb
new file mode 100644
index 0000000..b070183
--- /dev/null
+++ b/fakegen.rb
@@ -0,0 +1,612 @@
+
+# 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 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"
+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(&FUNCNAME##_fake, 0, sizeof(FUNCNAME##_fake));"
+      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, 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, return_type)
+  indent {
+    extern_c {  # define argument capture variables
+      output_variables(saved_arg_count, has_varargs, is_value_function)
+    }
+  }
+  
+  puts
+  output_macro_header(define_macro_name, saved_arg_count, has_varargs, return_type)
+  indent {
+    extern_c {
+      putd_backslash "FUNCNAME##_Fake FUNCNAME##_fake;"
+      putd_backslash function_signature(saved_arg_count, has_varargs, 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, return_type)
+  indent {
+    putd macro_signature_for(declare_macro_name, saved_arg_count, has_varargs, return_type)
+    putd macro_signature_for(define_macro_name, saved_arg_count, has_varargs, return_type)
+    puts
+  }
+end
+
+def output_macro_header(macro_name, arg_count, has_varargs, return_type)
+  output_macro_name(macro_name, arg_count, has_varargs, return_type)
+end
+
+# #define #macro_name(RETURN_TYPE, FUNCNAME, ARG0,...)
+def output_macro_name(macro_name, arg_count, has_varargs, return_type)
+  putd "#define " + macro_signature_for(macro_name, arg_count, has_varargs, return_type)
+end
+
+# #macro_name(RETURN_TYPE, FUNCNAME, ARG0,...) \
+def macro_signature_for(macro_name, arg_count, has_varargs, return_type)
+  parameter_list = "#{macro_name}("
+  if return_type != ""
+    parameter_list += return_type
+    parameter_list += ", "
+  end
+  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, 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, is_value_function)
+    output_custom_function_array(arg_count, has_varargs, is_value_function)
+  }
+  putd_backslash "extern FUNCNAME##_Fake FUNCNAME##_fake;"
+  putd_backslash "void FUNCNAME##_reset(void);"
+  putd_backslash function_signature(arg_count, has_varargs, 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, arg1
+def arg_list(args_count)
+  arguments = []
+  args_count.times { |i| arguments << "arg#{i}" }
+  arguments.join(", ")
+end
+
+# RETURN_TYPE (*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, is_value_function)
+  return_type = is_value_function ? "RETURN_TYPE" : "void"
+  ap_list = has_varargs ? ", va_list ap" : ""
+  signature = "(*custom_fake)(#{arg_val_list(arg_count)}#{ap_list});"
+  putd_backslash return_type + signature
+end
+
+def output_custom_function_array(arg_count, has_varargs, is_value_function)
+  return_type = is_value_function ? "RETURN_TYPE" : "void"
+  ap_list = has_varargs ? ", va_list ap" : ""
+  custom_array = "(**custom_fake_seq)(#{arg_val_list(arg_count)}#{ap_list});"
+  putd_backslash return_type + custom_array
+end
+
+# example: RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1)
+def function_signature(arg_count, has_varargs, is_value_function)
+  return_type = is_value_function ? "RETURN_TYPE" : "void"
+  varargs = has_varargs ? ", ..." : ""
+  "#{return_type} 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
+    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)});"
+      }
+      putd_backslash "}"
+    }
+    putd_backslash "}"
+    putd_backslash "if (FUNCNAME##_fake.custom_fake) #{return_type}FUNCNAME##_fake.custom_fake(#{arg_list(arg_count)});"
+  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_backslash "FFF_EXTERN_C"
+  putd "extern fff_globals_t fff;"
+  putd_backslash "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 extern_c
+  putd_backslash "FFF_EXTERN_C"
+  indent { 
+    yield
+  }
+  putd_backslash "FFF_END_EXTERN_C"
+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, vararg = :non_vararg, prefix = "")
+  appendix = (vararg == :vararg) ? "_VARARG" : ""
+  minus_count = (type == :VOID) ? 1 : 2
+
+  <<-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
+  msvc_expand_macro_fix
+  putd <<-MACRO_COUNTING
+
+#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, #{generate_arg_sequence($MAX_ARGS, '_', false, ", ")}, N, ...)   N
+
+#define PP_RSEQ_N_MINUS2() \
+    #{generate_arg_sequence($MAX_ARGS, '', true, ',')}
+
+
+#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(#{generate_arg_sequence($MAX_ARGS, '_', false, ", ")}, N, ...)   N
+
+#define PP_RSEQ_N_MINUS1() \
+    #{generate_arg_sequence($MAX_ARGS, '', true, ',')}
+
+
+
+/* DECLARE AND DEFINE FAKE FUNCTIONS - PLACE IN TEST FILES */
+
+#{counting_macro_instance(:VALUE)}
+#{counting_macro_instance(:VOID)}
+#{counting_macro_instance(:VALUE, :vararg)}
+#{counting_macro_instance(:VOID, :vararg)}
+
+/* DECLARE FAKE FUNCTIONS - PLACE IN HEADER FILES */
+
+#{counting_macro_instance(:VALUE, :non_vararg, "DECLARE_")}
+#{counting_macro_instance(:VOID, :non_vararg, "DECLARE_")}
+#{counting_macro_instance(:VALUE, :vararg, "DECLARE_")}
+#{counting_macro_instance(:VOID, :vararg, "DECLARE_")}
+
+/* DEFINE FAKE FUNCTIONS - PLACE IN SOURCE FILES */
+
+#{counting_macro_instance(:VALUE, :non_vararg, "DEFINE_")}
+#{counting_macro_instance(:VOID, :non_vararg, "DEFINE_")}
+#{counting_macro_instance(:VALUE, :vararg, "DEFINE_")}
+#{counting_macro_instance(:VOID, :vararg, "DEFINE_")}
+
+  MACRO_COUNTING
+end
+
+def output_c_and_cpp
+
+  include_guard {
+    include_dependencies
+    output_constants
+    output_internal_helper_macros
+    yield
+    output_macro_counting_shortcuts
+  }
+end
+
+# lets generate!!
+output_c_and_cpp{
+  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, false)}
+  num_fake_generators.times {|arg_count| output_macro(arg_count, false, true)}
+  # generate the varargs variants
+  (2..$MAX_ARGS).each {|arg_count| output_macro(arg_count, true, false)}
+  (2..$MAX_ARGS).each {|arg_count| output_macro(arg_count, true, true)}
+}
diff --git a/fff.h b/fff.h
new file mode 100644
index 0000000..e12f798
--- /dev/null
+++ b/fff.h
@@ -0,0 +1,6187 @@
+/*
+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
+/* -- 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(&FUNCNAME##_fake, 0, sizeof(FUNCNAME##_fake)); \
+        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) \
+    FFF_EXTERN_C \
+        typedef struct FUNCNAME##_Fake { \
+            DECLARE_ALL_FUNC_COMMON \
+            DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+            void(*custom_fake)(void); \
+            void(**custom_fake_seq)(void); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        void FUNCNAME(void); \
+    FFF_END_EXTERN_C \
+
+#define DEFINE_FAKE_VOID_FUNC0(FUNCNAME) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        void 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) FUNCNAME##_fake.custom_fake(); \
+        } \
+        DEFINE_RESET_FUNCTION(FUNCNAME) \
+    FFF_END_EXTERN_C \
+
+#define FAKE_VOID_FUNC0(FUNCNAME) \
+    DECLARE_FAKE_VOID_FUNC0(FUNCNAME) \
+    DEFINE_FAKE_VOID_FUNC0(FUNCNAME) \
+    
+
+#define DECLARE_FAKE_VOID_FUNC1(FUNCNAME, ARG0_TYPE) \
+    FFF_EXTERN_C \
+        typedef struct FUNCNAME##_Fake { \
+            DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+            DECLARE_ALL_FUNC_COMMON \
+            DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+            void(*custom_fake)(ARG0_TYPE arg0); \
+            void(**custom_fake_seq)(ARG0_TYPE arg0); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        void FUNCNAME(ARG0_TYPE arg0); \
+    FFF_END_EXTERN_C \
+
+#define DEFINE_FAKE_VOID_FUNC1(FUNCNAME, ARG0_TYPE) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        void 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) FUNCNAME##_fake.custom_fake(arg0); \
+        } \
+        DEFINE_RESET_FUNCTION(FUNCNAME) \
+    FFF_END_EXTERN_C \
+
+#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) \
+    FFF_EXTERN_C \
+        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 \
+            void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1); \
+            void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1); \
+    FFF_END_EXTERN_C \
+
+#define DEFINE_FAKE_VOID_FUNC2(FUNCNAME, ARG0_TYPE, ARG1_TYPE) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        void 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) FUNCNAME##_fake.custom_fake(arg0, arg1); \
+        } \
+        DEFINE_RESET_FUNCTION(FUNCNAME) \
+    FFF_END_EXTERN_C \
+
+#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) \
+    FFF_EXTERN_C \
+        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 \
+            void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2); \
+            void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2); \
+    FFF_END_EXTERN_C \
+
+#define DEFINE_FAKE_VOID_FUNC3(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        void 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) FUNCNAME##_fake.custom_fake(arg0, arg1, arg2); \
+        } \
+        DEFINE_RESET_FUNCTION(FUNCNAME) \
+    FFF_END_EXTERN_C \
+
+#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) \
+    FFF_EXTERN_C \
+        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 \
+            void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3); \
+            void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3); \
+    FFF_END_EXTERN_C \
+
+#define DEFINE_FAKE_VOID_FUNC4(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        void 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) FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3); \
+        } \
+        DEFINE_RESET_FUNCTION(FUNCNAME) \
+    FFF_END_EXTERN_C \
+
+#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) \
+    FFF_EXTERN_C \
+        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 \
+            void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4); \
+            void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4); \
+    FFF_END_EXTERN_C \
+
+#define DEFINE_FAKE_VOID_FUNC5(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        void 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) FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4); \
+        } \
+        DEFINE_RESET_FUNCTION(FUNCNAME) \
+    FFF_END_EXTERN_C \
+
+#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) \
+    FFF_EXTERN_C \
+        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 \
+            void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5); \
+            void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5); \
+    FFF_END_EXTERN_C \
+
+#define DEFINE_FAKE_VOID_FUNC6(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        void 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) FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5); \
+        } \
+        DEFINE_RESET_FUNCTION(FUNCNAME) \
+    FFF_END_EXTERN_C \
+
+#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) \
+    FFF_EXTERN_C \
+        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 \
+            void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6); \
+            void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6); \
+    FFF_END_EXTERN_C \
+
+#define DEFINE_FAKE_VOID_FUNC7(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        void 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) FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6); \
+        } \
+        DEFINE_RESET_FUNCTION(FUNCNAME) \
+    FFF_END_EXTERN_C \
+
+#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) \
+    FFF_EXTERN_C \
+        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 \
+            void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7); \
+            void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        void 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); \
+    FFF_END_EXTERN_C \
+
+#define DEFINE_FAKE_VOID_FUNC8(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        void 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) FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7); \
+        } \
+        DEFINE_RESET_FUNCTION(FUNCNAME) \
+    FFF_END_EXTERN_C \
+
+#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) \
+    FFF_EXTERN_C \
+        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 \
+            void(*custom_fake)(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); \
+            void(**custom_fake_seq)(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); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        void 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); \
+    FFF_END_EXTERN_C \
+
+#define DEFINE_FAKE_VOID_FUNC9(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ARG8_TYPE) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        void 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) FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); \
+        } \
+        DEFINE_RESET_FUNCTION(FUNCNAME) \
+    FFF_END_EXTERN_C \
+
+#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) \
+    FFF_EXTERN_C \
+        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 \
+            void(*custom_fake)(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); \
+            void(**custom_fake_seq)(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); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        void 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); \
+    FFF_END_EXTERN_C \
+
+#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) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        void 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) FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); \
+        } \
+        DEFINE_RESET_FUNCTION(FUNCNAME) \
+    FFF_END_EXTERN_C \
+
+#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) \
+    FFF_EXTERN_C \
+        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 \
+            void(*custom_fake)(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); \
+            void(**custom_fake_seq)(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); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        void 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); \
+    FFF_END_EXTERN_C \
+
+#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) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        void 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) FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10); \
+        } \
+        DEFINE_RESET_FUNCTION(FUNCNAME) \
+    FFF_END_EXTERN_C \
+
+#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) \
+    FFF_EXTERN_C \
+        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 \
+            void(*custom_fake)(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); \
+            void(**custom_fake_seq)(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); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        void 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); \
+    FFF_END_EXTERN_C \
+
+#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) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        void 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) FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11); \
+        } \
+        DEFINE_RESET_FUNCTION(FUNCNAME) \
+    FFF_END_EXTERN_C \
+
+#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) \
+    FFF_EXTERN_C \
+        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 \
+            void(*custom_fake)(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); \
+            void(**custom_fake_seq)(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); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        void 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); \
+    FFF_END_EXTERN_C \
+
+#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) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        void 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) FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12); \
+        } \
+        DEFINE_RESET_FUNCTION(FUNCNAME) \
+    FFF_END_EXTERN_C \
+
+#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) \
+    FFF_EXTERN_C \
+        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 \
+            void(*custom_fake)(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); \
+            void(**custom_fake_seq)(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); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        void 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); \
+    FFF_END_EXTERN_C \
+
+#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) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        void 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) FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13); \
+        } \
+        DEFINE_RESET_FUNCTION(FUNCNAME) \
+    FFF_END_EXTERN_C \
+
+#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) \
+    FFF_EXTERN_C \
+        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 \
+            void(*custom_fake)(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); \
+            void(**custom_fake_seq)(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); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        void 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); \
+    FFF_END_EXTERN_C \
+
+#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) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        void 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) FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14); \
+        } \
+        DEFINE_RESET_FUNCTION(FUNCNAME) \
+    FFF_END_EXTERN_C \
+
+#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) \
+    FFF_EXTERN_C \
+        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 \
+            void(*custom_fake)(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); \
+            void(**custom_fake_seq)(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); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        void 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); \
+    FFF_END_EXTERN_C \
+
+#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) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        void 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) FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15); \
+        } \
+        DEFINE_RESET_FUNCTION(FUNCNAME) \
+    FFF_END_EXTERN_C \
+
+#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) \
+    FFF_EXTERN_C \
+        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 \
+            void(*custom_fake)(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); \
+            void(**custom_fake_seq)(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); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        void 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); \
+    FFF_END_EXTERN_C \
+
+#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) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        void 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) 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) \
+    FFF_END_EXTERN_C \
+
+#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) \
+    FFF_EXTERN_C \
+        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 \
+            void(*custom_fake)(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); \
+            void(**custom_fake_seq)(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); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        void 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); \
+    FFF_END_EXTERN_C \
+
+#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) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        void 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) 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) \
+    FFF_END_EXTERN_C \
+
+#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) \
+    FFF_EXTERN_C \
+        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 \
+            void(*custom_fake)(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); \
+            void(**custom_fake_seq)(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); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        void 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); \
+    FFF_END_EXTERN_C \
+
+#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) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        void 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) 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) \
+    FFF_END_EXTERN_C \
+
+#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) \
+    FFF_EXTERN_C \
+        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 \
+            void(*custom_fake)(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); \
+            void(**custom_fake_seq)(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); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        void 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); \
+    FFF_END_EXTERN_C \
+
+#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) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        void 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) 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) \
+    FFF_END_EXTERN_C \
+
+#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) \
+    FFF_EXTERN_C \
+        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 \
+            RETURN_TYPE(*custom_fake)(void); \
+            RETURN_TYPE(**custom_fake_seq)(void); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        RETURN_TYPE FUNCNAME(void); \
+    FFF_END_EXTERN_C \
+
+#define DEFINE_FAKE_VALUE_FUNC0(RETURN_TYPE, FUNCNAME) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        RETURN_TYPE 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; \
+                    return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](); \
+                } \
+            } \
+            if (FUNCNAME##_fake.custom_fake) return FUNCNAME##_fake.custom_fake(); \
+            RETURN_FAKE_RESULT(FUNCNAME) \
+        } \
+        DEFINE_RESET_FUNCTION(FUNCNAME) \
+    FFF_END_EXTERN_C \
+
+#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) \
+    FFF_EXTERN_C \
+        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 \
+            RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0); \
+            RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        RETURN_TYPE FUNCNAME(ARG0_TYPE arg0); \
+    FFF_END_EXTERN_C \
+
+#define DEFINE_FAKE_VALUE_FUNC1(RETURN_TYPE, FUNCNAME, ARG0_TYPE) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        RETURN_TYPE 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; \
+                    return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0); \
+                } \
+            } \
+            if (FUNCNAME##_fake.custom_fake) return FUNCNAME##_fake.custom_fake(arg0); \
+            RETURN_FAKE_RESULT(FUNCNAME) \
+        } \
+        DEFINE_RESET_FUNCTION(FUNCNAME) \
+    FFF_END_EXTERN_C \
+
+#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) \
+    FFF_EXTERN_C \
+        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 \
+            RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1); \
+            RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1); \
+    FFF_END_EXTERN_C \
+
+#define DEFINE_FAKE_VALUE_FUNC2(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        RETURN_TYPE 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; \
+                    return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1); \
+                } \
+            } \
+            if (FUNCNAME##_fake.custom_fake) return FUNCNAME##_fake.custom_fake(arg0, arg1); \
+            RETURN_FAKE_RESULT(FUNCNAME) \
+        } \
+        DEFINE_RESET_FUNCTION(FUNCNAME) \
+    FFF_END_EXTERN_C \
+
+#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) \
+    FFF_EXTERN_C \
+        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 \
+            RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2); \
+            RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2); \
+    FFF_END_EXTERN_C \
+
+#define DEFINE_FAKE_VALUE_FUNC3(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        RETURN_TYPE 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; \
+                    return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2); \
+                } \
+            } \
+            if (FUNCNAME##_fake.custom_fake) return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2); \
+            RETURN_FAKE_RESULT(FUNCNAME) \
+        } \
+        DEFINE_RESET_FUNCTION(FUNCNAME) \
+    FFF_END_EXTERN_C \
+
+#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) \
+    FFF_EXTERN_C \
+        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 \
+            RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3); \
+            RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3); \
+    FFF_END_EXTERN_C \
+
+#define DEFINE_FAKE_VALUE_FUNC4(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        RETURN_TYPE 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; \
+                    return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3); \
+                } \
+            } \
+            if (FUNCNAME##_fake.custom_fake) return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3); \
+            RETURN_FAKE_RESULT(FUNCNAME) \
+        } \
+        DEFINE_RESET_FUNCTION(FUNCNAME) \
+    FFF_END_EXTERN_C \
+
+#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) \
+    FFF_EXTERN_C \
+        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 \
+            RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4); \
+            RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4); \
+    FFF_END_EXTERN_C \
+
+#define DEFINE_FAKE_VALUE_FUNC5(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        RETURN_TYPE 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; \
+                    return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4); \
+                } \
+            } \
+            if (FUNCNAME##_fake.custom_fake) return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4); \
+            RETURN_FAKE_RESULT(FUNCNAME) \
+        } \
+        DEFINE_RESET_FUNCTION(FUNCNAME) \
+    FFF_END_EXTERN_C \
+
+#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) \
+    FFF_EXTERN_C \
+        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 \
+            RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5); \
+            RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5); \
+    FFF_END_EXTERN_C \
+
+#define DEFINE_FAKE_VALUE_FUNC6(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        RETURN_TYPE 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; \
+                    return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5); \
+                } \
+            } \
+            if (FUNCNAME##_fake.custom_fake) return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5); \
+            RETURN_FAKE_RESULT(FUNCNAME) \
+        } \
+        DEFINE_RESET_FUNCTION(FUNCNAME) \
+    FFF_END_EXTERN_C \
+
+#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) \
+    FFF_EXTERN_C \
+        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 \
+            RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6); \
+            RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6); \
+    FFF_END_EXTERN_C \
+
+#define DEFINE_FAKE_VALUE_FUNC7(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        RETURN_TYPE 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; \
+                    return FUNCNAME##_fake.custom_fake_seq[FUNCNAME##_fake.custom_fake_seq_len-1](arg0, arg1, arg2, arg3, arg4, arg5, arg6); \
+                } \
+            } \
+            if (FUNCNAME##_fake.custom_fake) return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6); \
+            RETURN_FAKE_RESULT(FUNCNAME) \
+        } \
+        DEFINE_RESET_FUNCTION(FUNCNAME) \
+    FFF_END_EXTERN_C \
+
+#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) \
+    FFF_EXTERN_C \
+        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 \
+            RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7); \
+            RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        RETURN_TYPE 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); \
+    FFF_END_EXTERN_C \
+
+#define DEFINE_FAKE_VALUE_FUNC8(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        RETURN_TYPE 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; \
+                    return 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) return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7); \
+            RETURN_FAKE_RESULT(FUNCNAME) \
+        } \
+        DEFINE_RESET_FUNCTION(FUNCNAME) \
+    FFF_END_EXTERN_C \
+
+#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) \
+    FFF_EXTERN_C \
+        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 \
+            RETURN_TYPE(*custom_fake)(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); \
+            RETURN_TYPE(**custom_fake_seq)(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); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        RETURN_TYPE 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); \
+    FFF_END_EXTERN_C \
+
+#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) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        RETURN_TYPE 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; \
+                    return 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) return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); \
+            RETURN_FAKE_RESULT(FUNCNAME) \
+        } \
+        DEFINE_RESET_FUNCTION(FUNCNAME) \
+    FFF_END_EXTERN_C \
+
+#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) \
+    FFF_EXTERN_C \
+        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 \
+            RETURN_TYPE(*custom_fake)(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); \
+            RETURN_TYPE(**custom_fake_seq)(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); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        RETURN_TYPE 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); \
+    FFF_END_EXTERN_C \
+
+#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) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        RETURN_TYPE 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; \
+                    return 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) return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); \
+            RETURN_FAKE_RESULT(FUNCNAME) \
+        } \
+        DEFINE_RESET_FUNCTION(FUNCNAME) \
+    FFF_END_EXTERN_C \
+
+#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) \
+    FFF_EXTERN_C \
+        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 \
+            RETURN_TYPE(*custom_fake)(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); \
+            RETURN_TYPE(**custom_fake_seq)(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); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        RETURN_TYPE 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); \
+    FFF_END_EXTERN_C \
+
+#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) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        RETURN_TYPE 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; \
+                    return 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) return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10); \
+            RETURN_FAKE_RESULT(FUNCNAME) \
+        } \
+        DEFINE_RESET_FUNCTION(FUNCNAME) \
+    FFF_END_EXTERN_C \
+
+#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) \
+    FFF_EXTERN_C \
+        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 \
+            RETURN_TYPE(*custom_fake)(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); \
+            RETURN_TYPE(**custom_fake_seq)(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); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        RETURN_TYPE 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); \
+    FFF_END_EXTERN_C \
+
+#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) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        RETURN_TYPE 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; \
+                    return 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) return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11); \
+            RETURN_FAKE_RESULT(FUNCNAME) \
+        } \
+        DEFINE_RESET_FUNCTION(FUNCNAME) \
+    FFF_END_EXTERN_C \
+
+#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) \
+    FFF_EXTERN_C \
+        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 \
+            RETURN_TYPE(*custom_fake)(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); \
+            RETURN_TYPE(**custom_fake_seq)(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); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        RETURN_TYPE 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); \
+    FFF_END_EXTERN_C \
+
+#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) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        RETURN_TYPE 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; \
+                    return 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) return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12); \
+            RETURN_FAKE_RESULT(FUNCNAME) \
+        } \
+        DEFINE_RESET_FUNCTION(FUNCNAME) \
+    FFF_END_EXTERN_C \
+
+#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) \
+    FFF_EXTERN_C \
+        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 \
+            RETURN_TYPE(*custom_fake)(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); \
+            RETURN_TYPE(**custom_fake_seq)(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); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        RETURN_TYPE 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); \
+    FFF_END_EXTERN_C \
+
+#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) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        RETURN_TYPE 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; \
+                    return 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) return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13); \
+            RETURN_FAKE_RESULT(FUNCNAME) \
+        } \
+        DEFINE_RESET_FUNCTION(FUNCNAME) \
+    FFF_END_EXTERN_C \
+
+#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) \
+    FFF_EXTERN_C \
+        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 \
+            RETURN_TYPE(*custom_fake)(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); \
+            RETURN_TYPE(**custom_fake_seq)(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); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        RETURN_TYPE 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); \
+    FFF_END_EXTERN_C \
+
+#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) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        RETURN_TYPE 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; \
+                    return 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) return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14); \
+            RETURN_FAKE_RESULT(FUNCNAME) \
+        } \
+        DEFINE_RESET_FUNCTION(FUNCNAME) \
+    FFF_END_EXTERN_C \
+
+#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) \
+    FFF_EXTERN_C \
+        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 \
+            RETURN_TYPE(*custom_fake)(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); \
+            RETURN_TYPE(**custom_fake_seq)(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); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        RETURN_TYPE 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); \
+    FFF_END_EXTERN_C \
+
+#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) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        RETURN_TYPE 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; \
+                    return 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) return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15); \
+            RETURN_FAKE_RESULT(FUNCNAME) \
+        } \
+        DEFINE_RESET_FUNCTION(FUNCNAME) \
+    FFF_END_EXTERN_C \
+
+#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) \
+    FFF_EXTERN_C \
+        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 \
+            RETURN_TYPE(*custom_fake)(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); \
+            RETURN_TYPE(**custom_fake_seq)(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); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        RETURN_TYPE 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); \
+    FFF_END_EXTERN_C \
+
+#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) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        RETURN_TYPE 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; \
+                    return 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) return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16); \
+            RETURN_FAKE_RESULT(FUNCNAME) \
+        } \
+        DEFINE_RESET_FUNCTION(FUNCNAME) \
+    FFF_END_EXTERN_C \
+
+#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) \
+    FFF_EXTERN_C \
+        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 \
+            RETURN_TYPE(*custom_fake)(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); \
+            RETURN_TYPE(**custom_fake_seq)(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); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        RETURN_TYPE 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); \
+    FFF_END_EXTERN_C \
+
+#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) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        RETURN_TYPE 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; \
+                    return 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) return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17); \
+            RETURN_FAKE_RESULT(FUNCNAME) \
+        } \
+        DEFINE_RESET_FUNCTION(FUNCNAME) \
+    FFF_END_EXTERN_C \
+
+#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) \
+    FFF_EXTERN_C \
+        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 \
+            RETURN_TYPE(*custom_fake)(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); \
+            RETURN_TYPE(**custom_fake_seq)(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); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        RETURN_TYPE 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); \
+    FFF_END_EXTERN_C \
+
+#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) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        RETURN_TYPE 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; \
+                    return 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) return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18); \
+            RETURN_FAKE_RESULT(FUNCNAME) \
+        } \
+        DEFINE_RESET_FUNCTION(FUNCNAME) \
+    FFF_END_EXTERN_C \
+
+#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) \
+    FFF_EXTERN_C \
+        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 \
+            RETURN_TYPE(*custom_fake)(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); \
+            RETURN_TYPE(**custom_fake_seq)(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); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        RETURN_TYPE 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); \
+    FFF_END_EXTERN_C \
+
+#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) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        RETURN_TYPE 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; \
+                    return 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) return FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19); \
+            RETURN_FAKE_RESULT(FUNCNAME) \
+        } \
+        DEFINE_RESET_FUNCTION(FUNCNAME) \
+    FFF_END_EXTERN_C \
+
+#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, ...) \
+    FFF_EXTERN_C \
+        typedef struct FUNCNAME##_Fake { \
+            DECLARE_ARG(ARG0_TYPE, 0, FUNCNAME) \
+            DECLARE_ALL_FUNC_COMMON \
+            DECLARE_CUSTOM_FAKE_SEQ_VARIABLES \
+            void(*custom_fake)(ARG0_TYPE arg0, va_list ap); \
+            void(**custom_fake_seq)(ARG0_TYPE arg0, va_list ap); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        void FUNCNAME(ARG0_TYPE arg0, ...); \
+    FFF_END_EXTERN_C \
+
+#define DEFINE_FAKE_VOID_FUNC2_VARARG(FUNCNAME, ARG0_TYPE, ...) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        void 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){ \
+                va_list ap; \
+                va_start(ap, arg0); \
+                FUNCNAME##_fake.custom_fake(arg0, ap); \
+                va_end(ap); \
+            } \
+        } \
+        DEFINE_RESET_FUNCTION(FUNCNAME) \
+    FFF_END_EXTERN_C \
+
+#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, ...) \
+    FFF_EXTERN_C \
+        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 \
+            void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, va_list ap); \
+            void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, va_list ap); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ...); \
+    FFF_END_EXTERN_C \
+
+#define DEFINE_FAKE_VOID_FUNC3_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ...) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        void 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){ \
+                va_list ap; \
+                va_start(ap, arg1); \
+                FUNCNAME##_fake.custom_fake(arg0, arg1, ap); \
+                va_end(ap); \
+            } \
+        } \
+        DEFINE_RESET_FUNCTION(FUNCNAME) \
+    FFF_END_EXTERN_C \
+
+#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, ...) \
+    FFF_EXTERN_C \
+        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 \
+            void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, va_list ap); \
+            void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, va_list ap); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ...); \
+    FFF_END_EXTERN_C \
+
+#define DEFINE_FAKE_VOID_FUNC4_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ...) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        void 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){ \
+                va_list ap; \
+                va_start(ap, arg2); \
+                FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, ap); \
+                va_end(ap); \
+            } \
+        } \
+        DEFINE_RESET_FUNCTION(FUNCNAME) \
+    FFF_END_EXTERN_C \
+
+#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, ...) \
+    FFF_EXTERN_C \
+        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 \
+            void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, va_list ap); \
+            void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, va_list ap); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ...); \
+    FFF_END_EXTERN_C \
+
+#define DEFINE_FAKE_VOID_FUNC5_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ...) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        void 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){ \
+                va_list ap; \
+                va_start(ap, arg3); \
+                FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, ap); \
+                va_end(ap); \
+            } \
+        } \
+        DEFINE_RESET_FUNCTION(FUNCNAME) \
+    FFF_END_EXTERN_C \
+
+#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, ...) \
+    FFF_EXTERN_C \
+        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 \
+            void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, va_list ap); \
+            void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, va_list ap); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ...); \
+    FFF_END_EXTERN_C \
+
+#define DEFINE_FAKE_VOID_FUNC6_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ...) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        void 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){ \
+                va_list ap; \
+                va_start(ap, arg4); \
+                FUNCNAME##_fake.custom_fake(arg0, arg1, arg2, arg3, arg4, ap); \
+                va_end(ap); \
+            } \
+        } \
+        DEFINE_RESET_FUNCTION(FUNCNAME) \
+    FFF_END_EXTERN_C \
+
+#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, ...) \
+    FFF_EXTERN_C \
+        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 \
+            void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, va_list ap); \
+            void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, va_list ap); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ...); \
+    FFF_END_EXTERN_C \
+
+#define DEFINE_FAKE_VOID_FUNC7_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ...) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        void 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){ \
+                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) \
+    FFF_END_EXTERN_C \
+
+#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, ...) \
+    FFF_EXTERN_C \
+        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 \
+            void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, va_list ap); \
+            void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, va_list ap); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        void FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ...); \
+    FFF_END_EXTERN_C \
+
+#define DEFINE_FAKE_VOID_FUNC8_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ...) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        void 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){ \
+                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) \
+    FFF_END_EXTERN_C \
+
+#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, ...) \
+    FFF_EXTERN_C \
+        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 \
+            void(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, va_list ap); \
+            void(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, va_list ap); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        void 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, ...); \
+    FFF_END_EXTERN_C \
+
+#define DEFINE_FAKE_VOID_FUNC9_VARARG(FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ARG7_TYPE, ...) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        void 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){ \
+                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) \
+    FFF_END_EXTERN_C \
+
+#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, ...) \
+    FFF_EXTERN_C \
+        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 \
+            void(*custom_fake)(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, va_list ap); \
+            void(**custom_fake_seq)(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, va_list ap); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        void 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, ...); \
+    FFF_END_EXTERN_C \
+
+#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, ...) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        void 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){ \
+                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) \
+    FFF_END_EXTERN_C \
+
+#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, ...) \
+    FFF_EXTERN_C \
+        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 \
+            void(*custom_fake)(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, va_list ap); \
+            void(**custom_fake_seq)(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, va_list ap); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        void 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, ...); \
+    FFF_END_EXTERN_C \
+
+#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, ...) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        void 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){ \
+                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) \
+    FFF_END_EXTERN_C \
+
+#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, ...) \
+    FFF_EXTERN_C \
+        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 \
+            void(*custom_fake)(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, va_list ap); \
+            void(**custom_fake_seq)(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, va_list ap); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        void 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, ...); \
+    FFF_END_EXTERN_C \
+
+#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, ...) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        void 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){ \
+                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) \
+    FFF_END_EXTERN_C \
+
+#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, ...) \
+    FFF_EXTERN_C \
+        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 \
+            void(*custom_fake)(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, va_list ap); \
+            void(**custom_fake_seq)(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, va_list ap); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        void 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, ...); \
+    FFF_END_EXTERN_C \
+
+#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, ...) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        void 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){ \
+                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) \
+    FFF_END_EXTERN_C \
+
+#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, ...) \
+    FFF_EXTERN_C \
+        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 \
+            void(*custom_fake)(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, va_list ap); \
+            void(**custom_fake_seq)(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, va_list ap); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        void 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, ...); \
+    FFF_END_EXTERN_C \
+
+#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, ...) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        void 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){ \
+                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) \
+    FFF_END_EXTERN_C \
+
+#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, ...) \
+    FFF_EXTERN_C \
+        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 \
+            void(*custom_fake)(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, va_list ap); \
+            void(**custom_fake_seq)(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, va_list ap); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        void 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, ...); \
+    FFF_END_EXTERN_C \
+
+#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, ...) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        void 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){ \
+                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) \
+    FFF_END_EXTERN_C \
+
+#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, ...) \
+    FFF_EXTERN_C \
+        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 \
+            void(*custom_fake)(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, va_list ap); \
+            void(**custom_fake_seq)(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, va_list ap); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        void 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, ...); \
+    FFF_END_EXTERN_C \
+
+#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, ...) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        void 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){ \
+                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) \
+    FFF_END_EXTERN_C \
+
+#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, ...) \
+    FFF_EXTERN_C \
+        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 \
+            void(*custom_fake)(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, va_list ap); \
+            void(**custom_fake_seq)(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, va_list ap); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        void 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, ...); \
+    FFF_END_EXTERN_C \
+
+#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, ...) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        void 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){ \
+                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) \
+    FFF_END_EXTERN_C \
+
+#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, ...) \
+    FFF_EXTERN_C \
+        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 \
+            void(*custom_fake)(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, va_list ap); \
+            void(**custom_fake_seq)(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, va_list ap); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        void 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, ...); \
+    FFF_END_EXTERN_C \
+
+#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, ...) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        void 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){ \
+                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) \
+    FFF_END_EXTERN_C \
+
+#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, ...) \
+    FFF_EXTERN_C \
+        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 \
+            void(*custom_fake)(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, va_list ap); \
+            void(**custom_fake_seq)(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, va_list ap); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        void 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, ...); \
+    FFF_END_EXTERN_C \
+
+#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, ...) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        void 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){ \
+                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) \
+    FFF_END_EXTERN_C \
+
+#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, ...) \
+    FFF_EXTERN_C \
+        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 \
+            void(*custom_fake)(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, va_list ap); \
+            void(**custom_fake_seq)(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, va_list ap); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        void 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, ...); \
+    FFF_END_EXTERN_C \
+
+#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, ...) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        void 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){ \
+                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) \
+    FFF_END_EXTERN_C \
+
+#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, ...) \
+    FFF_EXTERN_C \
+        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 \
+            RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, va_list ap); \
+            RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, va_list ap); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ...); \
+    FFF_END_EXTERN_C \
+
+#define DEFINE_FAKE_VALUE_FUNC2_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ...) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        RETURN_TYPE 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){ \
+                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) \
+    FFF_END_EXTERN_C \
+
+#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, ...) \
+    FFF_EXTERN_C \
+        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 \
+            RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, va_list ap); \
+            RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, va_list ap); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ...); \
+    FFF_END_EXTERN_C \
+
+#define DEFINE_FAKE_VALUE_FUNC3_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ...) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        RETURN_TYPE 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){ \
+                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) \
+    FFF_END_EXTERN_C \
+
+#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, ...) \
+    FFF_EXTERN_C \
+        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 \
+            RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, va_list ap); \
+            RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, va_list ap); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ...); \
+    FFF_END_EXTERN_C \
+
+#define DEFINE_FAKE_VALUE_FUNC4_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ...) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        RETURN_TYPE 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){ \
+                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) \
+    FFF_END_EXTERN_C \
+
+#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, ...) \
+    FFF_EXTERN_C \
+        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 \
+            RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, va_list ap); \
+            RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, va_list ap); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ...); \
+    FFF_END_EXTERN_C \
+
+#define DEFINE_FAKE_VALUE_FUNC5_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ...) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        RETURN_TYPE 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){ \
+                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) \
+    FFF_END_EXTERN_C \
+
+#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, ...) \
+    FFF_EXTERN_C \
+        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 \
+            RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, va_list ap); \
+            RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, va_list ap); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ...); \
+    FFF_END_EXTERN_C \
+
+#define DEFINE_FAKE_VALUE_FUNC6_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ...) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        RETURN_TYPE 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){ \
+                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) \
+    FFF_END_EXTERN_C \
+
+#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, ...) \
+    FFF_EXTERN_C \
+        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 \
+            RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, va_list ap); \
+            RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, va_list ap); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ...); \
+    FFF_END_EXTERN_C \
+
+#define DEFINE_FAKE_VALUE_FUNC7_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ...) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        RETURN_TYPE 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){ \
+                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) \
+    FFF_END_EXTERN_C \
+
+#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, ...) \
+    FFF_EXTERN_C \
+        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 \
+            RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, va_list ap); \
+            RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, va_list ap); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        RETURN_TYPE FUNCNAME(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ...); \
+    FFF_END_EXTERN_C \
+
+#define DEFINE_FAKE_VALUE_FUNC8_VARARG(RETURN_TYPE, FUNCNAME, ARG0_TYPE, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE, ...) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        RETURN_TYPE 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){ \
+                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) \
+    FFF_END_EXTERN_C \
+
+#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, ...) \
+    FFF_EXTERN_C \
+        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 \
+            RETURN_TYPE(*custom_fake)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, va_list ap); \
+            RETURN_TYPE(**custom_fake_seq)(ARG0_TYPE arg0, ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6, ARG7_TYPE arg7, va_list ap); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        RETURN_TYPE 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, ...); \
+    FFF_END_EXTERN_C \
+
+#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, ...) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        RETURN_TYPE 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){ \
+                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) \
+    FFF_END_EXTERN_C \
+
+#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, ...) \
+    FFF_EXTERN_C \
+        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 \
+            RETURN_TYPE(*custom_fake)(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, va_list ap); \
+            RETURN_TYPE(**custom_fake_seq)(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, va_list ap); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        RETURN_TYPE 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, ...); \
+    FFF_END_EXTERN_C \
+
+#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, ...) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        RETURN_TYPE 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){ \
+                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) \
+    FFF_END_EXTERN_C \
+
+#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, ...) \
+    FFF_EXTERN_C \
+        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 \
+            RETURN_TYPE(*custom_fake)(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, va_list ap); \
+            RETURN_TYPE(**custom_fake_seq)(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, va_list ap); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        RETURN_TYPE 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, ...); \
+    FFF_END_EXTERN_C \
+
+#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, ...) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        RETURN_TYPE 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){ \
+                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) \
+    FFF_END_EXTERN_C \
+
+#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, ...) \
+    FFF_EXTERN_C \
+        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 \
+            RETURN_TYPE(*custom_fake)(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, va_list ap); \
+            RETURN_TYPE(**custom_fake_seq)(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, va_list ap); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        RETURN_TYPE 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, ...); \
+    FFF_END_EXTERN_C \
+
+#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, ...) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        RETURN_TYPE 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){ \
+                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) \
+    FFF_END_EXTERN_C \
+
+#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, ...) \
+    FFF_EXTERN_C \
+        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 \
+            RETURN_TYPE(*custom_fake)(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, va_list ap); \
+            RETURN_TYPE(**custom_fake_seq)(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, va_list ap); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        RETURN_TYPE 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, ...); \
+    FFF_END_EXTERN_C \
+
+#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, ...) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        RETURN_TYPE 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){ \
+                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) \
+    FFF_END_EXTERN_C \
+
+#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, ...) \
+    FFF_EXTERN_C \
+        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 \
+            RETURN_TYPE(*custom_fake)(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, va_list ap); \
+            RETURN_TYPE(**custom_fake_seq)(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, va_list ap); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        RETURN_TYPE 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, ...); \
+    FFF_END_EXTERN_C \
+
+#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, ...) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        RETURN_TYPE 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){ \
+                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) \
+    FFF_END_EXTERN_C \
+
+#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, ...) \
+    FFF_EXTERN_C \
+        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 \
+            RETURN_TYPE(*custom_fake)(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, va_list ap); \
+            RETURN_TYPE(**custom_fake_seq)(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, va_list ap); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        RETURN_TYPE 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, ...); \
+    FFF_END_EXTERN_C \
+
+#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, ...) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        RETURN_TYPE 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){ \
+                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) \
+    FFF_END_EXTERN_C \
+
+#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, ...) \
+    FFF_EXTERN_C \
+        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 \
+            RETURN_TYPE(*custom_fake)(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, va_list ap); \
+            RETURN_TYPE(**custom_fake_seq)(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, va_list ap); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        RETURN_TYPE 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, ...); \
+    FFF_END_EXTERN_C \
+
+#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, ...) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        RETURN_TYPE 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){ \
+                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) \
+    FFF_END_EXTERN_C \
+
+#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, ...) \
+    FFF_EXTERN_C \
+        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 \
+            RETURN_TYPE(*custom_fake)(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, va_list ap); \
+            RETURN_TYPE(**custom_fake_seq)(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, va_list ap); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        RETURN_TYPE 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, ...); \
+    FFF_END_EXTERN_C \
+
+#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, ...) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        RETURN_TYPE 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){ \
+                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) \
+    FFF_END_EXTERN_C \
+
+#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, ...) \
+    FFF_EXTERN_C \
+        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 \
+            RETURN_TYPE(*custom_fake)(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, va_list ap); \
+            RETURN_TYPE(**custom_fake_seq)(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, va_list ap); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        RETURN_TYPE 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, ...); \
+    FFF_END_EXTERN_C \
+
+#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, ...) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        RETURN_TYPE 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){ \
+                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) \
+    FFF_END_EXTERN_C \
+
+#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, ...) \
+    FFF_EXTERN_C \
+        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 \
+            RETURN_TYPE(*custom_fake)(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, va_list ap); \
+            RETURN_TYPE(**custom_fake_seq)(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, va_list ap); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        RETURN_TYPE 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, ...); \
+    FFF_END_EXTERN_C \
+
+#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, ...) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        RETURN_TYPE 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){ \
+                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) \
+    FFF_END_EXTERN_C \
+
+#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, ...) \
+    FFF_EXTERN_C \
+        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 \
+            RETURN_TYPE(*custom_fake)(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, va_list ap); \
+            RETURN_TYPE(**custom_fake_seq)(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, va_list ap); \
+        } FUNCNAME##_Fake; \
+        extern FUNCNAME##_Fake FUNCNAME##_fake; \
+        void FUNCNAME##_reset(void); \
+        RETURN_TYPE 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, ...); \
+    FFF_END_EXTERN_C \
+
+#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, ...) \
+    FFF_EXTERN_C \
+        FUNCNAME##_Fake FUNCNAME##_fake; \
+        RETURN_TYPE 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){ \
+                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) \
+    FFF_END_EXTERN_C \
+
+#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/gtest/Makefile b/gtest/Makefile
new file mode 100644
index 0000000..efcfa0b
--- /dev/null
+++ b/gtest/Makefile
@@ -0,0 +1,22 @@
+
+BUILD_DIR = ../build
+LIBS := -lpthread
+CPP_OBJS=$(BUILD_DIR)/gtest-all.o $(BUILD_DIR)/gtest-main.o
+
+SOURCES=gtest-all.cc gtest-main.cc
+
+
+# Each subdirectory must supply rules for building sources it contributes
+$(BUILD_DIR)/%.o: %.cc
+	@echo 'Building file: $<'
+	@echo 'Invoking: GCC C++ Compiler'
+	g++ -I../ -O0 -g3 -Wall -DGTEST_USE_OWN_TR1_TUPLE=1 -c -o "$@" "$<"
+	@echo 'Finished building: $<'
+	@echo ' '
+
+all: $(CPP_OBJS)
+
+clean:
+	-$(RM) $(CPP_OBJS) 
+	-@echo ' '
+
diff --git a/gtest/gtest-all.cc b/gtest/gtest-all.cc
new file mode 100644
index 0000000..5ced66a
--- /dev/null
+++ b/gtest/gtest-all.cc
@@ -0,0 +1,9118 @@
+// Copyright 2008, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Author: mheule@google.com (Markus Heule)
+//
+// Google C++ Testing Framework (Google Test)
+//
+// Sometimes it's desirable to build Google Test by compiling a single file.
+// This file serves this purpose.
+
+// This line ensures that gtest.h can be compiled on its own, even
+// when it's fused.
+#include "gtest/gtest.h"
+
+// The following lines pull in the real gtest *.cc files.
+// Copyright 2005, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Author: wan@google.com (Zhanyong Wan)
+//
+// The Google C++ Testing Framework (Google Test)
+
+// Copyright 2007, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Author: wan@google.com (Zhanyong Wan)
+//
+// Utilities for testing Google Test itself and code that uses Google Test
+// (e.g. frameworks built on top of Google Test).
+
+#ifndef GTEST_INCLUDE_GTEST_GTEST_SPI_H_
+#define GTEST_INCLUDE_GTEST_GTEST_SPI_H_
+
+
+namespace testing {
+
+// This helper class can be used to mock out Google Test failure reporting
+// so that we can test Google Test or code that builds on Google Test.
+//
+// An object of this class appends a TestPartResult object to the
+// TestPartResultArray object given in the constructor whenever a Google Test
+// failure is reported. It can either intercept only failures that are
+// generated in the same thread that created this object or it can intercept
+// all generated failures. The scope of this mock object can be controlled with
+// the second argument to the two arguments constructor.
+class GTEST_API_ ScopedFakeTestPartResultReporter
+    : public TestPartResultReporterInterface {
+ public:
+  // The two possible mocking modes of this object.
+  enum InterceptMode {
+    INTERCEPT_ONLY_CURRENT_THREAD,  // Intercepts only thread local failures.
+    INTERCEPT_ALL_THREADS           // Intercepts all failures.
+  };
+
+  // The c'tor sets this object as the test part result reporter used
+  // by Google Test.  The 'result' parameter specifies where to report the
+  // results. This reporter will only catch failures generated in the current
+  // thread. DEPRECATED
+  explicit ScopedFakeTestPartResultReporter(TestPartResultArray* result);
+
+  // Same as above, but you can choose the interception scope of this object.
+  ScopedFakeTestPartResultReporter(InterceptMode intercept_mode,
+                                   TestPartResultArray* result);
+
+  // The d'tor restores the previous test part result reporter.
+  virtual ~ScopedFakeTestPartResultReporter();
+
+  // Appends the TestPartResult object to the TestPartResultArray
+  // received in the constructor.
+  //
+  // This method is from the TestPartResultReporterInterface
+  // interface.
+  virtual void ReportTestPartResult(const TestPartResult& result);
+ private:
+  void Init();
+
+  const InterceptMode intercept_mode_;
+  TestPartResultReporterInterface* old_reporter_;
+  TestPartResultArray* const result_;
+
+  GTEST_DISALLOW_COPY_AND_ASSIGN_(ScopedFakeTestPartResultReporter);
+};
+
+namespace internal {
+
+// A helper class for implementing EXPECT_FATAL_FAILURE() and
+// EXPECT_NONFATAL_FAILURE().  Its destructor verifies that the given
+// TestPartResultArray contains exactly one failure that has the given
+// type and contains the given substring.  If that's not the case, a
+// non-fatal failure will be generated.
+class GTEST_API_ SingleFailureChecker {
+ public:
+  // The constructor remembers the arguments.
+  SingleFailureChecker(const TestPartResultArray* results,
+                       TestPartResult::Type type,
+                       const string& substr);
+  ~SingleFailureChecker();
+ private:
+  const TestPartResultArray* const results_;
+  const TestPartResult::Type type_;
+  const string substr_;
+
+  GTEST_DISALLOW_COPY_AND_ASSIGN_(SingleFailureChecker);
+};
+
+}  // namespace internal
+
+}  // namespace testing
+
+// A set of macros for testing Google Test assertions or code that's expected
+// to generate Google Test fatal failures.  It verifies that the given
+// statement will cause exactly one fatal Google Test failure with 'substr'
+// being part of the failure message.
+//
+// There are two different versions of this macro. EXPECT_FATAL_FAILURE only
+// affects and considers failures generated in the current thread and
+// EXPECT_FATAL_FAILURE_ON_ALL_THREADS does the same but for all threads.
+//
+// The verification of the assertion is done correctly even when the statement
+// throws an exception or aborts the current function.
+//
+// Known restrictions:
+//   - 'statement' cannot reference local non-static variables or
+//     non-static members of the current object.
+//   - 'statement' cannot return a value.
+//   - You cannot stream a failure message to this macro.
+//
+// Note that even though the implementations of the following two
+// macros are much alike, we cannot refactor them to use a common
+// helper macro, due to some peculiarity in how the preprocessor
+// works.  The AcceptsMacroThatExpandsToUnprotectedComma test in
+// gtest_unittest.cc will fail to compile if we do that.
+#define EXPECT_FATAL_FAILURE(statement, substr) \
+  do { \
+    class GTestExpectFatalFailureHelper {\
+     public:\
+      static void Execute() { statement; }\
+    };\
+    ::testing::TestPartResultArray gtest_failures;\
+    ::testing::internal::SingleFailureChecker gtest_checker(\
+        &gtest_failures, ::testing::TestPartResult::kFatalFailure, (substr));\
+    {\
+      ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\
+          ::testing::ScopedFakeTestPartResultReporter:: \
+          INTERCEPT_ONLY_CURRENT_THREAD, &gtest_failures);\
+      GTestExpectFatalFailureHelper::Execute();\
+    }\
+  } while (::testing::internal::AlwaysFalse())
+
+#define EXPECT_FATAL_FAILURE_ON_ALL_THREADS(statement, substr) \
+  do { \
+    class GTestExpectFatalFailureHelper {\
+     public:\
+      static void Execute() { statement; }\
+    };\
+    ::testing::TestPartResultArray gtest_failures;\
+    ::testing::internal::SingleFailureChecker gtest_checker(\
+        &gtest_failures, ::testing::TestPartResult::kFatalFailure, (substr));\
+    {\
+      ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\
+          ::testing::ScopedFakeTestPartResultReporter:: \
+          INTERCEPT_ALL_THREADS, &gtest_failures);\
+      GTestExpectFatalFailureHelper::Execute();\
+    }\
+  } while (::testing::internal::AlwaysFalse())
+
+// A macro for testing Google Test assertions or code that's expected to
+// generate Google Test non-fatal failures.  It asserts that the given
+// statement will cause exactly one non-fatal Google Test failure with 'substr'
+// being part of the failure message.
+//
+// There are two different versions of this macro. EXPECT_NONFATAL_FAILURE only
+// affects and considers failures generated in the current thread and
+// EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS does the same but for all threads.
+//
+// 'statement' is allowed to reference local variables and members of
+// the current object.
+//
+// The verification of the assertion is done correctly even when the statement
+// throws an exception or aborts the current function.
+//
+// Known restrictions:
+//   - You cannot stream a failure message to this macro.
+//
+// Note that even though the implementations of the following two
+// macros are much alike, we cannot refactor them to use a common
+// helper macro, due to some peculiarity in how the preprocessor
+// works.  If we do that, the code won't compile when the user gives
+// EXPECT_NONFATAL_FAILURE() a statement that contains a macro that
+// expands to code containing an unprotected comma.  The
+// AcceptsMacroThatExpandsToUnprotectedComma test in gtest_unittest.cc
+// catches that.
+//
+// For the same reason, we have to write
+//   if (::testing::internal::AlwaysTrue()) { statement; }
+// instead of
+//   GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement)
+// to avoid an MSVC warning on unreachable code.
+#define EXPECT_NONFATAL_FAILURE(statement, substr) \
+  do {\
+    ::testing::TestPartResultArray gtest_failures;\
+    ::testing::internal::SingleFailureChecker gtest_checker(\
+        &gtest_failures, ::testing::TestPartResult::kNonFatalFailure, \
+        (substr));\
+    {\
+      ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\
+          ::testing::ScopedFakeTestPartResultReporter:: \
+          INTERCEPT_ONLY_CURRENT_THREAD, &gtest_failures);\
+      if (::testing::internal::AlwaysTrue()) { statement; }\
+    }\
+  } while (::testing::internal::AlwaysFalse())
+
+#define EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS(statement, substr) \
+  do {\
+    ::testing::TestPartResultArray gtest_failures;\
+    ::testing::internal::SingleFailureChecker gtest_checker(\
+        &gtest_failures, ::testing::TestPartResult::kNonFatalFailure, \
+        (substr));\
+    {\
+      ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\
+          ::testing::ScopedFakeTestPartResultReporter::INTERCEPT_ALL_THREADS,\
+          &gtest_failures);\
+      if (::testing::internal::AlwaysTrue()) { statement; }\
+    }\
+  } while (::testing::internal::AlwaysFalse())
+
+#endif  // GTEST_INCLUDE_GTEST_GTEST_SPI_H_
+
+#include <ctype.h>
+#include <math.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <wchar.h>
+#include <wctype.h>
+
+#include <algorithm>
+#include <ostream>  // NOLINT
+#include <sstream>
+#include <vector>
+
+#if GTEST_OS_LINUX
+
+// TODO(kenton@google.com): Use autoconf to detect availability of
+// gettimeofday().
+# define GTEST_HAS_GETTIMEOFDAY_ 1
+
+# include <fcntl.h>  // NOLINT
+# include <limits.h>  // NOLINT
+# include <sched.h>  // NOLINT
+// Declares vsnprintf().  This header is not available on Windows.
+# include <strings.h>  // NOLINT
+# include <sys/mman.h>  // NOLINT
+# include <sys/time.h>  // NOLINT
+# include <unistd.h>  // NOLINT
+# include <string>
+
+#elif GTEST_OS_SYMBIAN
+# define GTEST_HAS_GETTIMEOFDAY_ 1
+# include <sys/time.h>  // NOLINT
+
+#elif GTEST_OS_ZOS
+# define GTEST_HAS_GETTIMEOFDAY_ 1
+# include <sys/time.h>  // NOLINT
+
+// On z/OS we additionally need strings.h for strcasecmp.
+# include <strings.h>  // NOLINT
+
+#elif GTEST_OS_WINDOWS_MOBILE  // We are on Windows CE.
+
+# include <windows.h>  // NOLINT
+
+#elif GTEST_OS_WINDOWS  // We are on Windows proper.
+
+# include <io.h>  // NOLINT
+# include <sys/timeb.h>  // NOLINT
+# include <sys/types.h>  // NOLINT
+# include <sys/stat.h>  // NOLINT
+
+# if GTEST_OS_WINDOWS_MINGW
+// MinGW has gettimeofday() but not _ftime64().
+// TODO(kenton@google.com): Use autoconf to detect availability of
+//   gettimeofday().
+// TODO(kenton@google.com): There are other ways to get the time on
+//   Windows, like GetTickCount() or GetSystemTimeAsFileTime().  MinGW
+//   supports these.  consider using them instead.
+#  define GTEST_HAS_GETTIMEOFDAY_ 1
+#  include <sys/time.h>  // NOLINT
+# endif  // GTEST_OS_WINDOWS_MINGW
+
+// cpplint thinks that the header is already included, so we want to
+// silence it.
+# include <windows.h>  // NOLINT
+
+#else
+
+// Assume other platforms have gettimeofday().
+// TODO(kenton@google.com): Use autoconf to detect availability of
+//   gettimeofday().
+# define GTEST_HAS_GETTIMEOFDAY_ 1
+
+// cpplint thinks that the header is already included, so we want to
+// silence it.
+# include <sys/time.h>  // NOLINT
+# include <unistd.h>  // NOLINT
+
+#endif  // GTEST_OS_LINUX
+
+#if GTEST_HAS_EXCEPTIONS
+# include <stdexcept>
+#endif
+
+#if GTEST_CAN_STREAM_RESULTS_
+# include <arpa/inet.h>  // NOLINT
+# include <netdb.h>  // NOLINT
+#endif
+
+// Indicates that this translation unit is part of Google Test's
+// implementation.  It must come before gtest-internal-inl.h is
+// included, or there will be a compiler error.  This trick is to
+// prevent a user from accidentally including gtest-internal-inl.h in
+// his code.
+#define GTEST_IMPLEMENTATION_ 1
+// Copyright 2005, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Utility functions and classes used by the Google C++ testing framework.
+//
+// Author: wan@google.com (Zhanyong Wan)
+//
+// This file contains purely Google Test's internal implementation.  Please
+// DO NOT #INCLUDE IT IN A USER PROGRAM.
+
+#ifndef GTEST_SRC_GTEST_INTERNAL_INL_H_
+#define GTEST_SRC_GTEST_INTERNAL_INL_H_
+
+// GTEST_IMPLEMENTATION_ is defined to 1 iff the current translation unit is
+// part of Google Test's implementation; otherwise it's undefined.
+#if !GTEST_IMPLEMENTATION_
+// A user is trying to include this from his code - just say no.
+# error "gtest-internal-inl.h is part of Google Test's internal implementation."
+# error "It must not be included except by Google Test itself."
+#endif  // GTEST_IMPLEMENTATION_
+
+#ifndef _WIN32_WCE
+# include <errno.h>
+#endif  // !_WIN32_WCE
+#include <stddef.h>
+#include <stdlib.h>  // For strtoll/_strtoul64/malloc/free.
+#include <string.h>  // For memmove.
+
+#include <algorithm>
+#include <string>
+#include <vector>
+
+
+#if GTEST_OS_WINDOWS
+# include <windows.h>  // NOLINT
+#endif  // GTEST_OS_WINDOWS
+
+
+namespace testing {
+
+// Declares the flags.
+//
+// We don't want the users to modify this flag in the code, but want
+// Google Test's own unit tests to be able to access it. Therefore we
+// declare it here as opposed to in gtest.h.
+GTEST_DECLARE_bool_(death_test_use_fork);
+
+namespace internal {
+
+// The value of GetTestTypeId() as seen from within the Google Test
+// library.  This is solely for testing GetTestTypeId().
+GTEST_API_ extern const TypeId kTestTypeIdInGoogleTest;
+
+// Names of the flags (needed for parsing Google Test flags).
+const char kAlsoRunDisabledTestsFlag[] = "also_run_disabled_tests";
+const char kBreakOnFailureFlag[] = "break_on_failure";
+const char kCatchExceptionsFlag[] = "catch_exceptions";
+const char kColorFlag[] = "color";
+const char kFilterFlag[] = "filter";
+const char kListTestsFlag[] = "list_tests";
+const char kOutputFlag[] = "output";
+const char kPrintTimeFlag[] = "print_time";
+const char kRandomSeedFlag[] = "random_seed";
+const char kRepeatFlag[] = "repeat";
+const char kShuffleFlag[] = "shuffle";
+const char kStackTraceDepthFlag[] = "stack_trace_depth";
+const char kStreamResultToFlag[] = "stream_result_to";
+const char kThrowOnFailureFlag[] = "throw_on_failure";
+
+// A valid random seed must be in [1, kMaxRandomSeed].
+const int kMaxRandomSeed = 99999;
+
+// g_help_flag is true iff the --help flag or an equivalent form is
+// specified on the command line.
+GTEST_API_ extern bool g_help_flag;
+
+// Returns the current time in milliseconds.
+GTEST_API_ TimeInMillis GetTimeInMillis();
+
+// Returns true iff Google Test should use colors in the output.
+GTEST_API_ bool ShouldUseColor(bool stdout_is_tty);
+
+// Formats the given time in milliseconds as seconds.
+GTEST_API_ std::string FormatTimeInMillisAsSeconds(TimeInMillis ms);
+
+// Parses a string for an Int32 flag, in the form of "--flag=value".
+//
+// On success, stores the value of the flag in *value, and returns
+// true.  On failure, returns false without changing *value.
+GTEST_API_ bool ParseInt32Flag(
+    const char* str, const char* flag, Int32* value);
+
+// Returns a random seed in range [1, kMaxRandomSeed] based on the
+// given --gtest_random_seed flag value.
+inline int GetRandomSeedFromFlag(Int32 random_seed_flag) {
+  const unsigned int raw_seed = (random_seed_flag == 0) ?
+      static_cast<unsigned int>(GetTimeInMillis()) :
+      static_cast<unsigned int>(random_seed_flag);
+
+  // Normalizes the actual seed to range [1, kMaxRandomSeed] such that
+  // it's easy to type.
+  const int normalized_seed =
+      static_cast<int>((raw_seed - 1U) %
+                       static_cast<unsigned int>(kMaxRandomSeed)) + 1;
+  return normalized_seed;
+}
+
+// Returns the first valid random seed after 'seed'.  The behavior is
+// undefined if 'seed' is invalid.  The seed after kMaxRandomSeed is
+// considered to be 1.
+inline int GetNextRandomSeed(int seed) {
+  GTEST_CHECK_(1 <= seed && seed <= kMaxRandomSeed)
+      << "Invalid random seed " << seed << " - must be in [1, "
+      << kMaxRandomSeed << "].";
+  const int next_seed = seed + 1;
+  return (next_seed > kMaxRandomSeed) ? 1 : next_seed;
+}
+
+// This class saves the values of all Google Test flags in its c'tor, and
+// restores them in its d'tor.
+class GTestFlagSaver {
+ public:
+  // The c'tor.
+  GTestFlagSaver() {
+    also_run_disabled_tests_ = GTEST_FLAG(also_run_disabled_tests);
+    break_on_failure_ = GTEST_FLAG(break_on_failure);
+    catch_exceptions_ = GTEST_FLAG(catch_exceptions);
+    color_ = GTEST_FLAG(color);
+    death_test_style_ = GTEST_FLAG(death_test_style);
+    death_test_use_fork_ = GTEST_FLAG(death_test_use_fork);
+    filter_ = GTEST_FLAG(filter);
+    internal_run_death_test_ = GTEST_FLAG(internal_run_death_test);
+    list_tests_ = GTEST_FLAG(list_tests);
+    output_ = GTEST_FLAG(output);
+    print_time_ = GTEST_FLAG(print_time);
+    random_seed_ = GTEST_FLAG(random_seed);
+    repeat_ = GTEST_FLAG(repeat);
+    shuffle_ = GTEST_FLAG(shuffle);
+    stack_trace_depth_ = GTEST_FLAG(stack_trace_depth);
+    stream_result_to_ = GTEST_FLAG(stream_result_to);
+    throw_on_failure_ = GTEST_FLAG(throw_on_failure);
+  }
+
+  // The d'tor is not virtual.  DO NOT INHERIT FROM THIS CLASS.
+  ~GTestFlagSaver() {
+    GTEST_FLAG(also_run_disabled_tests) = also_run_disabled_tests_;
+    GTEST_FLAG(break_on_failure) = break_on_failure_;
+    GTEST_FLAG(catch_exceptions) = catch_exceptions_;
+    GTEST_FLAG(color) = color_;
+    GTEST_FLAG(death_test_style) = death_test_style_;
+    GTEST_FLAG(death_test_use_fork) = death_test_use_fork_;
+    GTEST_FLAG(filter) = filter_;
+    GTEST_FLAG(internal_run_death_test) = internal_run_death_test_;
+    GTEST_FLAG(list_tests) = list_tests_;
+    GTEST_FLAG(output) = output_;
+    GTEST_FLAG(print_time) = print_time_;
+    GTEST_FLAG(random_seed) = random_seed_;
+    GTEST_FLAG(repeat) = repeat_;
+    GTEST_FLAG(shuffle) = shuffle_;
+    GTEST_FLAG(stack_trace_depth) = stack_trace_depth_;
+    GTEST_FLAG(stream_result_to) = stream_result_to_;
+    GTEST_FLAG(throw_on_failure) = throw_on_failure_;
+  }
+ private:
+  // Fields for saving the original values of flags.
+  bool also_run_disabled_tests_;
+  bool break_on_failure_;
+  bool catch_exceptions_;
+  String color_;
+  String death_test_style_;
+  bool death_test_use_fork_;
+  String filter_;
+  String internal_run_death_test_;
+  bool list_tests_;
+  String output_;
+  bool print_time_;
+  bool pretty_;
+  internal::Int32 random_seed_;
+  internal::Int32 repeat_;
+  bool shuffle_;
+  internal::Int32 stack_trace_depth_;
+  String stream_result_to_;
+  bool throw_on_failure_;
+} GTEST_ATTRIBUTE_UNUSED_;
+
+// Converts a Unicode code point to a narrow string in UTF-8 encoding.
+// code_point parameter is of type UInt32 because wchar_t may not be
+// wide enough to contain a code point.
+// The output buffer str must containt at least 32 characters.
+// The function returns the address of the output buffer.
+// If the code_point is not a valid Unicode code point
+// (i.e. outside of Unicode range U+0 to U+10FFFF) it will be output
+// as '(Invalid Unicode 0xXXXXXXXX)'.
+GTEST_API_ char* CodePointToUtf8(UInt32 code_point, char* str);
+
+// Converts a wide string to a narrow string in UTF-8 encoding.
+// The wide string is assumed to have the following encoding:
+//   UTF-16 if sizeof(wchar_t) == 2 (on Windows, Cygwin, Symbian OS)
+//   UTF-32 if sizeof(wchar_t) == 4 (on Linux)
+// Parameter str points to a null-terminated wide string.
+// Parameter num_chars may additionally limit the number
+// of wchar_t characters processed. -1 is used when the entire string
+// should be processed.
+// If the string contains code points that are not valid Unicode code points
+// (i.e. outside of Unicode range U+0 to U+10FFFF) they will be output
+// as '(Invalid Unicode 0xXXXXXXXX)'. If the string is in UTF16 encoding
+// and contains invalid UTF-16 surrogate pairs, values in those pairs
+// will be encoded as individual Unicode characters from Basic Normal Plane.
+GTEST_API_ String WideStringToUtf8(const wchar_t* str, int num_chars);
+
+// Reads the GTEST_SHARD_STATUS_FILE environment variable, and creates the file
+// if the variable is present. If a file already exists at this location, this
+// function will write over it. If the variable is present, but the file cannot
+// be created, prints an error and exits.
+void WriteToShardStatusFileIfNeeded();
+
+// Checks whether sharding is enabled by examining the relevant
+// environment variable values. If the variables are present,
+// but inconsistent (e.g., shard_index >= total_shards), prints
+// an error and exits. If in_subprocess_for_death_test, sharding is
+// disabled because it must only be applied to the original test
+// process. Otherwise, we could filter out death tests we intended to execute.
+GTEST_API_ bool ShouldShard(const char* total_shards_str,
+                            const char* shard_index_str,
+                            bool in_subprocess_for_death_test);
+
+// Parses the environment variable var as an Int32. If it is unset,
+// returns default_val. If it is not an Int32, prints an error and
+// and aborts.
+GTEST_API_ Int32 Int32FromEnvOrDie(const char* env_var, Int32 default_val);
+
+// Given the total number of shards, the shard index, and the test id,
+// returns true iff the test should be run on this shard. The test id is
+// some arbitrary but unique non-negative integer assigned to each test
+// method. Assumes that 0 <= shard_index < total_shards.
+GTEST_API_ bool ShouldRunTestOnShard(
+    int total_shards, int shard_index, int test_id);
+
+// STL container utilities.
+
+// Returns the number of elements in the given container that satisfy
+// the given predicate.
+template <class Container, typename Predicate>
+inline int CountIf(const Container& c, Predicate predicate) {
+  // Implemented as an explicit loop since std::count_if() in libCstd on
+  // Solaris has a non-standard signature.
+  int count = 0;
+  for (typename Container::const_iterator it = c.begin(); it != c.end(); ++it) {
+    if (predicate(*it))
+      ++count;
+  }
+  return count;
+}
+
+// Applies a function/functor to each element in the container.
+template <class Container, typename Functor>
+void ForEach(const Container& c, Functor functor) {
+  std::for_each(c.begin(), c.end(), functor);
+}
+
+// Returns the i-th element of the vector, or default_value if i is not
+// in range [0, v.size()).
+template <typename E>
+inline E GetElementOr(const std::vector<E>& v, int i, E default_value) {
+  return (i < 0 || i >= static_cast<int>(v.size())) ? default_value : v[i];
+}
+
+// Performs an in-place shuffle of a range of the vector's elements.
+// 'begin' and 'end' are element indices as an STL-style range;
+// i.e. [begin, end) are shuffled, where 'end' == size() means to
+// shuffle to the end of the vector.
+template <typename E>
+void ShuffleRange(internal::Random* random, int begin, int end,
+                  std::vector<E>* v) {
+  const int size = static_cast<int>(v->size());
+  GTEST_CHECK_(0 <= begin && begin <= size)
+      << "Invalid shuffle range start " << begin << ": must be in range [0, "
+      << size << "].";
+  GTEST_CHECK_(begin <= end && end <= size)
+      << "Invalid shuffle range finish " << end << ": must be in range ["
+      << begin << ", " << size << "].";
+
+  // Fisher-Yates shuffle, from
+  // http://en.wikipedia.org/wiki/Fisher-Yates_shuffle
+  for (int range_width = end - begin; range_width >= 2; range_width--) {
+    const int last_in_range = begin + range_width - 1;
+    const int selected = begin + random->Generate(range_width);
+    std::swap((*v)[selected], (*v)[last_in_range]);
+  }
+}
+
+// Performs an in-place shuffle of the vector's elements.
+template <typename E>
+inline void Shuffle(internal::Random* random, std::vector<E>* v) {
+  ShuffleRange(random, 0, static_cast<int>(v->size()), v);
+}
+
+// A function for deleting an object.  Handy for being used as a
+// functor.
+template <typename T>
+static void Delete(T* x) {
+  delete x;
+}
+
+// A predicate that checks the key of a TestProperty against a known key.
+//
+// TestPropertyKeyIs is copyable.
+class TestPropertyKeyIs {
+ public:
+  // Constructor.
+  //
+  // TestPropertyKeyIs has NO default constructor.
+  explicit TestPropertyKeyIs(const char* key)
+      : key_(key) {}
+
+  // Returns true iff the test name of test property matches on key_.
+  bool operator()(const TestProperty& test_property) const {
+    return String(test_property.key()).Compare(key_) == 0;
+  }
+
+ private:
+  String key_;
+};
+
+// Class UnitTestOptions.
+//
+// This class contains functions for processing options the user
+// specifies when running the tests.  It has only static members.
+//
+// In most cases, the user can specify an option using either an
+// environment variable or a command line flag.  E.g. you can set the
+// test filter using either GTEST_FILTER or --gtest_filter.  If both
+// the variable and the flag are present, the latter overrides the
+// former.
+class GTEST_API_ UnitTestOptions {
+ public:
+  // Functions for processing the gtest_output flag.
+
+  // Returns the output format, or "" for normal printed output.
+  static String GetOutputFormat();
+
+  // Returns the absolute path of the requested output file, or the
+  // default (test_detail.xml in the original working directory) if
+  // none was explicitly specified.
+  static String GetAbsolutePathToOutputFile();
+
+  // Functions for processing the gtest_filter flag.
+
+  // Returns true iff the wildcard pattern matches the string.  The
+  // first ':' or '\0' character in pattern marks the end of it.
+  //
+  // This recursive algorithm isn't very efficient, but is clear and
+  // works well enough for matching test names, which are short.
+  static bool PatternMatchesString(const char *pattern, const char *str);
+
+  // Returns true iff the user-specified filter matches the test case
+  // name and the test name.
+  static bool FilterMatchesTest(const String &test_case_name,
+                                const String &test_name);
+
+#if GTEST_OS_WINDOWS
+  // Function for supporting the gtest_catch_exception flag.
+
+  // Returns EXCEPTION_EXECUTE_HANDLER if Google Test should handle the
+  // given SEH exception, or EXCEPTION_CONTINUE_SEARCH otherwise.
+  // This function is useful as an __except condition.
+  static int GTestShouldProcessSEH(DWORD exception_code);
+#endif  // GTEST_OS_WINDOWS
+
+  // Returns true if "name" matches the ':' separated list of glob-style
+  // filters in "filter".
+  static bool MatchesFilter(const String& name, const char* filter);
+};
+
+// Returns the current application's name, removing directory path if that
+// is present.  Used by UnitTestOptions::GetOutputFile.
+GTEST_API_ FilePath GetCurrentExecutableName();
+
+// The role interface for getting the OS stack trace as a string.
+class OsStackTraceGetterInterface {
+ public:
+  OsStackTraceGetterInterface() {}
+  virtual ~OsStackTraceGetterInterface() {}
+
+  // Returns the current OS stack trace as a String.  Parameters:
+  //
+  //   max_depth  - the maximum number of stack frames to be included
+  //                in the trace.
+  //   skip_count - the number of top frames to be skipped; doesn't count
+  //                against max_depth.
+  virtual String CurrentStackTrace(int max_depth, int skip_count) = 0;
+
+  // UponLeavingGTest() should be called immediately before Google Test calls
+  // user code. It saves some information about the current stack that
+  // CurrentStackTrace() will use to find and hide Google Test stack frames.
+  virtual void UponLeavingGTest() = 0;
+
+ private:
+  GTEST_DISALLOW_COPY_AND_ASSIGN_(OsStackTraceGetterInterface);
+};
+
+// A working implementation of the OsStackTraceGetterInterface interface.
+class OsStackTraceGetter : public OsStackTraceGetterInterface {
+ public:
+  OsStackTraceGetter() : caller_frame_(NULL) {}
+  virtual String CurrentStackTrace(int max_depth, int skip_count);
+  virtual void UponLeavingGTest();
+
+  // This string is inserted in place of stack frames that are part of
+  // Google Test's implementation.
+  static const char* const kElidedFramesMarker;
+
+ private:
+  Mutex mutex_;  // protects all internal state
+
+  // We save the stack frame below the frame that calls user code.
+  // We do this because the address of the frame immediately below
+  // the user code changes between the call to UponLeavingGTest()
+  // and any calls to CurrentStackTrace() from within the user code.
+  void* caller_frame_;
+
+  GTEST_DISALLOW_COPY_AND_ASSIGN_(OsStackTraceGetter);
+};
+
+// Information about a Google Test trace point.
+struct TraceInfo {
+  const char* file;
+  int line;
+  String message;
+};
+
+// This is the default global test part result reporter used in UnitTestImpl.
+// This class should only be used by UnitTestImpl.
+class DefaultGlobalTestPartResultReporter
+  : public TestPartResultReporterInterface {
+ public:
+  explicit DefaultGlobalTestPartResultReporter(UnitTestImpl* unit_test);
+  // Implements the TestPartResultReporterInterface. Reports the test part
+  // result in the current test.
+  virtual void ReportTestPartResult(const TestPartResult& result);
+
+ private:
+  UnitTestImpl* const unit_test_;
+
+  GTEST_DISALLOW_COPY_AND_ASSIGN_(DefaultGlobalTestPartResultReporter);
+};
+
+// This is the default per thread test part result reporter used in
+// UnitTestImpl. This class should only be used by UnitTestImpl.
+class DefaultPerThreadTestPartResultReporter
+    : public TestPartResultReporterInterface {
+ public:
+  explicit DefaultPerThreadTestPartResultReporter(UnitTestImpl* unit_test);
+  // Implements the TestPartResultReporterInterface. The implementation just
+  // delegates to the current global test part result reporter of *unit_test_.
+  virtual void ReportTestPartResult(const TestPartResult& result);
+
+ private:
+  UnitTestImpl* const unit_test_;
+
+  GTEST_DISALLOW_COPY_AND_ASSIGN_(DefaultPerThreadTestPartResultReporter);
+};
+
+// The private implementation of the UnitTest class.  We don't protect
+// the methods under a mutex, as this class is not accessible by a
+// user and the UnitTest class that delegates work to this class does
+// proper locking.
+class GTEST_API_ UnitTestImpl {
+ public:
+  explicit UnitTestImpl(UnitTest* parent);
+  virtual ~UnitTestImpl();
+
+  // There are two different ways to register your own TestPartResultReporter.
+  // You can register your own repoter to listen either only for test results
+  // from the current thread or for results from all threads.
+  // By default, each per-thread test result repoter just passes a new
+  // TestPartResult to the global test result reporter, which registers the
+  // test part result for the currently running test.
+
+  // Returns the global test part result reporter.
+  TestPartResultReporterInterface* GetGlobalTestPartResultReporter();
+
+  // Sets the global test part result reporter.
+  void SetGlobalTestPartResultReporter(
+      TestPartResultReporterInterface* reporter);
+
+  // Returns the test part result reporter for the current thread.
+  TestPartResultReporterInterface* GetTestPartResultReporterForCurrentThread();
+
+  // Sets the test part result reporter for the current thread.
+  void SetTestPartResultReporterForCurrentThread(
+      TestPartResultReporterInterface* reporter);
+
+  // Gets the number of successful test cases.
+  int successful_test_case_count() const;
+
+  // Gets the number of failed test cases.
+  int failed_test_case_count() const;
+
+  // Gets the number of all test cases.
+  int total_test_case_count() const;
+
+  // Gets the number of all test cases that contain at least one test
+  // that should run.
+  int test_case_to_run_count() const;
+
+  // Gets the number of successful tests.
+  int successful_test_count() const;
+
+  // Gets the number of failed tests.
+  int failed_test_count() const;
+
+  // Gets the number of disabled tests.
+  int disabled_test_count() const;
+
+  // Gets the number of all tests.
+  int total_test_count() const;
+
+  // Gets the number of tests that should run.
+  int test_to_run_count() const;
+
+  // Gets the elapsed time, in milliseconds.
+  TimeInMillis elapsed_time() const { return elapsed_time_; }
+
+  // Returns true iff the unit test passed (i.e. all test cases passed).
+  bool Passed() const { return !Failed(); }
+
+  // Returns true iff the unit test failed (i.e. some test case failed
+  // or something outside of all tests failed).
+  bool Failed() const {
+    return failed_test_case_count() > 0 || ad_hoc_test_result()->Failed();
+  }
+
+  // Gets the i-th test case among all the test cases. i can range from 0 to
+  // total_test_case_count() - 1. If i is not in that range, returns NULL.
+  const TestCase* GetTestCase(int i) const {
+    const int index = GetElementOr(test_case_indices_, i, -1);
+    return index < 0 ? NULL : test_cases_[i];
+  }
+
+  // Gets the i-th test case among all the test cases. i can range from 0 to
+  // total_test_case_count() - 1. If i is not in that range, returns NULL.
+  TestCase* GetMutableTestCase(int i) {
+    const int index = GetElementOr(test_case_indices_, i, -1);
+    return index < 0 ? NULL : test_cases_[index];
+  }
+
+  // Provides access to the event listener list.
+  TestEventListeners* listeners() { return &listeners_; }
+
+  // Returns the TestResult for the test that's currently running, or
+  // the TestResult for the ad hoc test if no test is running.
+  TestResult* current_test_result();
+
+  // Returns the TestResult for the ad hoc test.
+  const TestResult* ad_hoc_test_result() const { return &ad_hoc_test_result_; }
+
+  // Sets the OS stack trace getter.
+  //
+  // Does nothing if the input and the current OS stack trace getter
+  // are the same; otherwise, deletes the old getter and makes the
+  // input the current getter.
+  void set_os_stack_trace_getter(OsStackTraceGetterInterface* getter);
+
+  // Returns the current OS stack trace getter if it is not NULL;
+  // otherwise, creates an OsStackTraceGetter, makes it the current
+  // getter, and returns it.
+  OsStackTraceGetterInterface* os_stack_trace_getter();
+
+  // Returns the current OS stack trace as a String.
+  //
+  // The maximum number of stack frames to be included is specified by
+  // the gtest_stack_trace_depth flag.  The skip_count parameter
+  // specifies the number of top frames to be skipped, which doesn't
+  // count against the number of frames to be included.
+  //
+  // For example, if Foo() calls Bar(), which in turn calls
+  // CurrentOsStackTraceExceptTop(1), Foo() will be included in the
+  // trace but Bar() and CurrentOsStackTraceExceptTop() won't.
+  String CurrentOsStackTraceExceptTop(int skip_count);
+
+  // Finds and returns a TestCase with the given name.  If one doesn't
+  // exist, creates one and returns it.
+  //
+  // Arguments:
+  //
+  //   test_case_name: name of the test case
+  //   type_param:     the name of the test's type parameter, or NULL if
+  //                   this is not a typed or a type-parameterized test.
+  //   set_up_tc:      pointer to the function that sets up the test case
+  //   tear_down_tc:   pointer to the function that tears down the test case
+  TestCase* GetTestCase(const char* test_case_name,
+                        const char* type_param,
+                        Test::SetUpTestCaseFunc set_up_tc,
+                        Test::TearDownTestCaseFunc tear_down_tc);
+
+  // Adds a TestInfo to the unit test.
+  //
+  // Arguments:
+  //
+  //   set_up_tc:    pointer to the function that sets up the test case
+  //   tear_down_tc: pointer to the function that tears down the test case
+  //   test_info:    the TestInfo object
+  void AddTestInfo(Test::SetUpTestCaseFunc set_up_tc,
+                   Test::TearDownTestCaseFunc tear_down_tc,
+                   TestInfo* test_info) {
+    // In order to support thread-safe death tests, we need to
+    // remember the original working directory when the test program
+    // was first invoked.  We cannot do this in RUN_ALL_TESTS(), as
+    // the user may have changed the current directory before calling
+    // RUN_ALL_TESTS().  Therefore we capture the current directory in
+    // AddTestInfo(), which is called to register a TEST or TEST_F
+    // before main() is reached.
+    if (original_working_dir_.IsEmpty()) {
+      original_working_dir_.Set(FilePath::GetCurrentDir());
+      GTEST_CHECK_(!original_working_dir_.IsEmpty())
+          << "Failed to get the current working directory.";
+    }
+
+    GetTestCase(test_info->test_case_name(),
+                test_info->type_param(),
+                set_up_tc,
+                tear_down_tc)->AddTestInfo(test_info);
+  }
+
+#if GTEST_HAS_PARAM_TEST
+  // Returns ParameterizedTestCaseRegistry object used to keep track of
+  // value-parameterized tests and instantiate and register them.
+  internal::ParameterizedTestCaseRegistry& parameterized_test_registry() {
+    return parameterized_test_registry_;
+  }
+#endif  // GTEST_HAS_PARAM_TEST
+
+  // Sets the TestCase object for the test that's currently running.
+  void set_current_test_case(TestCase* a_current_test_case) {
+    current_test_case_ = a_current_test_case;
+  }
+
+  // Sets the TestInfo object for the test that's currently running.  If
+  // current_test_info is NULL, the assertion results will be stored in
+  // ad_hoc_test_result_.
+  void set_current_test_info(TestInfo* a_current_test_info) {
+    current_test_info_ = a_current_test_info;
+  }
+
+  // Registers all parameterized tests defined using TEST_P and
+  // INSTANTIATE_TEST_CASE_P, creating regular tests for each test/parameter
+  // combination. This method can be called more then once; it has guards
+  // protecting from registering the tests more then once.  If
+  // value-parameterized tests are disabled, RegisterParameterizedTests is
+  // present but does nothing.
+  void RegisterParameterizedTests();
+
+  // Runs all tests in this UnitTest object, prints the result, and
+  // returns true if all tests are successful.  If any exception is
+  // thrown during a test, this test is considered to be failed, but
+  // the rest of the tests will still be run.
+  bool RunAllTests();
+
+  // Clears the results of all tests, except the ad hoc tests.
+  void ClearNonAdHocTestResult() {
+    ForEach(test_cases_, TestCase::ClearTestCaseResult);
+  }
+
+  // Clears the results of ad-hoc test assertions.
+  void ClearAdHocTestResult() {
+    ad_hoc_test_result_.Clear();
+  }
+
+  enum ReactionToSharding {
+    HONOR_SHARDING_PROTOCOL,
+    IGNORE_SHARDING_PROTOCOL
+  };
+
+  // Matches the full name of each test against the user-specified
+  // filter to decide whether the test should run, then records the
+  // result in each TestCase and TestInfo object.
+  // If shard_tests == HONOR_SHARDING_PROTOCOL, further filters tests
+  // based on sharding variables in the environment.
+  // Returns the number of tests that should run.
+  int FilterTests(ReactionToSharding shard_tests);
+
+  // Prints the names of the tests matching the user-specified filter flag.
+  void ListTestsMatchingFilter();
+
+  const TestCase* current_test_case() const { return current_test_case_; }
+  TestInfo* current_test_info() { return current_test_info_; }
+  const TestInfo* current_test_info() const { return current_test_info_; }
+
+  // Returns the vector of environments that need to be set-up/torn-down
+  // before/after the tests are run.
+  std::vector<Environment*>& environments() { return environments_; }
+
+  // Getters for the per-thread Google Test trace stack.
+  std::vector<TraceInfo>& gtest_trace_stack() {
+    return *(gtest_trace_stack_.pointer());
+  }
+  const std::vector<TraceInfo>& gtest_trace_stack() const {
+    return gtest_trace_stack_.get();
+  }
+
+#if GTEST_HAS_DEATH_TEST
+  void InitDeathTestSubprocessControlInfo() {
+    internal_run_death_test_flag_.reset(ParseInternalRunDeathTestFlag());
+  }
+  // Returns a pointer to the parsed --gtest_internal_run_death_test
+  // flag, or NULL if that flag was not specified.
+  // This information is useful only in a death test child process.
+  // Must not be called before a call to InitGoogleTest.
+  const InternalRunDeathTestFlag* internal_run_death_test_flag() const {
+    return internal_run_death_test_flag_.get();
+  }
+
+  // Returns a pointer to the current death test factory.
+  internal::DeathTestFactory* death_test_factory() {
+    return death_test_factory_.get();
+  }
+
+  void SuppressTestEventsIfInSubprocess();
+
+  friend class ReplaceDeathTestFactory;
+#endif  // GTEST_HAS_DEATH_TEST
+
+  // Initializes the event listener performing XML output as specified by
+  // UnitTestOptions. Must not be called before InitGoogleTest.
+  void ConfigureXmlOutput();
+
+#if GTEST_CAN_STREAM_RESULTS_
+  // Initializes the event listener for streaming test results to a socket.
+  // Must not be called before InitGoogleTest.
+  void ConfigureStreamingOutput();
+#endif
+
+  // Performs initialization dependent upon flag values obtained in
+  // ParseGoogleTestFlagsOnly.  Is called from InitGoogleTest after the call to
+  // ParseGoogleTestFlagsOnly.  In case a user neglects to call InitGoogleTest
+  // this function is also called from RunAllTests.  Since this function can be
+  // called more than once, it has to be idempotent.
+  void PostFlagParsingInit();
+
+  // Gets the random seed used at the start of the current test iteration.
+  int random_seed() const { return random_seed_; }
+
+  // Gets the random number generator.
+  internal::Random* random() { return &random_; }
+
+  // Shuffles all test cases, and the tests within each test case,
+  // making sure that death tests are still run first.
+  void ShuffleTests();
+
+  // Restores the test cases and tests to their order before the first shuffle.
+  void UnshuffleTests();
+
+  // Returns the value of GTEST_FLAG(catch_exceptions) at the moment
+  // UnitTest::Run() starts.
+  bool catch_exceptions() const { return catch_exceptions_; }
+
+ private:
+  friend class ::testing::UnitTest;
+
+  // Used by UnitTest::Run() to capture the state of
+  // GTEST_FLAG(catch_exceptions) at the moment it starts.
+  void set_catch_exceptions(bool value) { catch_exceptions_ = value; }
+
+  // The UnitTest object that owns this implementation object.
+  UnitTest* const parent_;
+
+  // The working directory when the first TEST() or TEST_F() was
+  // executed.
+  internal::FilePath original_working_dir_;
+
+  // The default test part result reporters.
+  DefaultGlobalTestPartResultReporter default_global_test_part_result_reporter_;
+  DefaultPerThreadTestPartResultReporter
+      default_per_thread_test_part_result_reporter_;
+
+  // Points to (but doesn't own) the global test part result reporter.
+  TestPartResultReporterInterface* global_test_part_result_repoter_;
+
+  // Protects read and write access to global_test_part_result_reporter_.
+  internal::Mutex global_test_part_result_reporter_mutex_;
+
+  // Points to (but doesn't own) the per-thread test part result reporter.
+  internal::ThreadLocal<TestPartResultReporterInterface*>
+      per_thread_test_part_result_reporter_;
+
+  // The vector of environments that need to be set-up/torn-down
+  // before/after the tests are run.
+  std::vector<Environment*> environments_;
+
+  // The vector of TestCases in their original order.  It owns the
+  // elements in the vector.
+  std::vector<TestCase*> test_cases_;
+
+  // Provides a level of indirection for the test case list to allow
+  // easy shuffling and restoring the test case order.  The i-th
+  // element of this vector is the index of the i-th test case in the
+  // shuffled order.
+  std::vector<int> test_case_indices_;
+
+#if GTEST_HAS_PARAM_TEST
+  // ParameterizedTestRegistry object used to register value-parameterized
+  // tests.
+  internal::ParameterizedTestCaseRegistry parameterized_test_registry_;
+
+  // Indicates whether RegisterParameterizedTests() has been called already.
+  bool parameterized_tests_registered_;
+#endif  // GTEST_HAS_PARAM_TEST
+
+  // Index of the last death test case registered.  Initially -1.
+  int last_death_test_case_;
+
+  // This points to the TestCase for the currently running test.  It
+  // changes as Google Test goes through one test case after another.
+  // When no test is running, this is set to NULL and Google Test
+  // stores assertion results in ad_hoc_test_result_.  Initially NULL.
+  TestCase* current_test_case_;
+
+  // This points to the TestInfo for the currently running test.  It
+  // changes as Google Test goes through one test after another.  When
+  // no test is running, this is set to NULL and Google Test stores
+  // assertion results in ad_hoc_test_result_.  Initially NULL.
+  TestInfo* current_test_info_;
+
+  // Normally, a user only writes assertions inside a TEST or TEST_F,
+  // or inside a function called by a TEST or TEST_F.  Since Google
+  // Test keeps track of which test is current running, it can
+  // associate such an assertion with the test it belongs to.
+  //
+  // If an assertion is encountered when no TEST or TEST_F is running,
+  // Google Test attributes the assertion result to an imaginary "ad hoc"
+  // test, and records the result in ad_hoc_test_result_.
+  TestResult ad_hoc_test_result_;
+
+  // The list of event listeners that can be used to track events inside
+  // Google Test.
+  TestEventListeners listeners_;
+
+  // The OS stack trace getter.  Will be deleted when the UnitTest
+  // object is destructed.  By default, an OsStackTraceGetter is used,
+  // but the user can set this field to use a custom getter if that is
+  // desired.
+  OsStackTraceGetterInterface* os_stack_trace_getter_;
+
+  // True iff PostFlagParsingInit() has been called.
+  bool post_flag_parse_init_performed_;
+
+  // The random number seed used at the beginning of the test run.
+  int random_seed_;
+
+  // Our random number generator.
+  internal::Random random_;
+
+  // How long the test took to run, in milliseconds.
+  TimeInMillis elapsed_time_;
+
+#if GTEST_HAS_DEATH_TEST
+  // The decomposed components of the gtest_internal_run_death_test flag,
+  // parsed when RUN_ALL_TESTS is called.
+  internal::scoped_ptr<InternalRunDeathTestFlag> internal_run_death_test_flag_;
+  internal::scoped_ptr<internal::DeathTestFactory> death_test_factory_;
+#endif  // GTEST_HAS_DEATH_TEST
+
+  // A per-thread stack of traces created by the SCOPED_TRACE() macro.
+  internal::ThreadLocal<std::vector<TraceInfo> > gtest_trace_stack_;
+
+  // The value of GTEST_FLAG(catch_exceptions) at the moment RunAllTests()
+  // starts.
+  bool catch_exceptions_;
+
+  GTEST_DISALLOW_COPY_AND_ASSIGN_(UnitTestImpl);
+};  // class UnitTestImpl
+
+// Convenience function for accessing the global UnitTest
+// implementation object.
+inline UnitTestImpl* GetUnitTestImpl() {
+  return UnitTest::GetInstance()->impl();
+}
+
+#if GTEST_USES_SIMPLE_RE
+
+// Internal helper functions for implementing the simple regular
+// expression matcher.
+GTEST_API_ bool IsInSet(char ch, const char* str);
+GTEST_API_ bool IsAsciiDigit(char ch);
+GTEST_API_ bool IsAsciiPunct(char ch);
+GTEST_API_ bool IsRepeat(char ch);
+GTEST_API_ bool IsAsciiWhiteSpace(char ch);
+GTEST_API_ bool IsAsciiWordChar(char ch);
+GTEST_API_ bool IsValidEscape(char ch);
+GTEST_API_ bool AtomMatchesChar(bool escaped, char pattern, char ch);
+GTEST_API_ bool ValidateRegex(const char* regex);
+GTEST_API_ bool MatchRegexAtHead(const char* regex, const char* str);
+GTEST_API_ bool MatchRepetitionAndRegexAtHead(
+    bool escaped, char ch, char repeat, const char* regex, const char* str);
+GTEST_API_ bool MatchRegexAnywhere(const char* regex, const char* str);
+
+#endif  // GTEST_USES_SIMPLE_RE
+
+// Parses the command line for Google Test flags, without initializing
+// other parts of Google Test.
+GTEST_API_ void ParseGoogleTestFlagsOnly(int* argc, char** argv);
+GTEST_API_ void ParseGoogleTestFlagsOnly(int* argc, wchar_t** argv);
+
+#if GTEST_HAS_DEATH_TEST
+
+// Returns the message describing the last system error, regardless of the
+// platform.
+GTEST_API_ String GetLastErrnoDescription();
+
+# if GTEST_OS_WINDOWS
+// Provides leak-safe Windows kernel handle ownership.
+class AutoHandle {
+ public:
+  AutoHandle() : handle_(INVALID_HANDLE_VALUE) {}
+  explicit AutoHandle(HANDLE handle) : handle_(handle) {}
+
+  ~AutoHandle() { Reset(); }
+
+  HANDLE Get() const { return handle_; }
+  void Reset() { Reset(INVALID_HANDLE_VALUE); }
+  void Reset(HANDLE handle) {
+    if (handle != handle_) {
+      if (handle_ != INVALID_HANDLE_VALUE)
+        ::CloseHandle(handle_);
+      handle_ = handle;
+    }
+  }
+
+ private:
+  HANDLE handle_;
+
+  GTEST_DISALLOW_COPY_AND_ASSIGN_(AutoHandle);
+};
+# endif  // GTEST_OS_WINDOWS
+
+// Attempts to parse a string into a positive integer pointed to by the
+// number parameter.  Returns true if that is possible.
+// GTEST_HAS_DEATH_TEST implies that we have ::std::string, so we can use
+// it here.
+template <typename Integer>
+bool ParseNaturalNumber(const ::std::string& str, Integer* number) {
+  // Fail fast if the given string does not begin with a digit;
+  // this bypasses strtoXXX's "optional leading whitespace and plus
+  // or minus sign" semantics, which are undesirable here.
+  if (str.empty() || !IsDigit(str[0])) {
+    return false;
+  }
+  errno = 0;
+
+  char* end;
+  // BiggestConvertible is the largest integer type that system-provided
+  // string-to-number conversion routines can return.
+
+# if GTEST_OS_WINDOWS && !defined(__GNUC__)
+
+  // MSVC and C++ Builder define __int64 instead of the standard long long.
+  typedef unsigned __int64 BiggestConvertible;
+  const BiggestConvertible parsed = _strtoui64(str.c_str(), &end, 10);
+
+# else
+
+  typedef unsigned long long BiggestConvertible;  // NOLINT
+  const BiggestConvertible parsed = strtoull(str.c_str(), &end, 10);
+
+# endif  // GTEST_OS_WINDOWS && !defined(__GNUC__)
+
+  const bool parse_success = *end == '\0' && errno == 0;
+
+  // TODO(vladl@google.com): Convert this to compile time assertion when it is
+  // available.
+  GTEST_CHECK_(sizeof(Integer) <= sizeof(parsed));
+
+  const Integer result = static_cast<Integer>(parsed);
+  if (parse_success && static_cast<BiggestConvertible>(result) == parsed) {
+    *number = result;
+    return true;
+  }
+  return false;
+}
+#endif  // GTEST_HAS_DEATH_TEST
+
+// TestResult contains some private methods that should be hidden from
+// Google Test user but are required for testing. This class allow our tests
+// to access them.
+//
+// This class is supplied only for the purpose of testing Google Test's own
+// constructs. Do not use it in user tests, either directly or indirectly.
+class TestResultAccessor {
+ public:
+  static void RecordProperty(TestResult* test_result,
+                             const TestProperty& property) {
+    test_result->RecordProperty(property);
+  }
+
+  static void ClearTestPartResults(TestResult* test_result) {
+    test_result->ClearTestPartResults();
+  }
+
+  static const std::vector<testing::TestPartResult>& test_part_results(
+      const TestResult& test_result) {
+    return test_result.test_part_results();
+  }
+};
+
+}  // namespace internal
+}  // namespace testing
+
+#endif  // GTEST_SRC_GTEST_INTERNAL_INL_H_
+#undef GTEST_IMPLEMENTATION_
+
+#if GTEST_OS_WINDOWS
+# define vsnprintf _vsnprintf
+#endif  // GTEST_OS_WINDOWS
+
+namespace testing {
+
+using internal::CountIf;
+using internal::ForEach;
+using internal::GetElementOr;
+using internal::Shuffle;
+
+// Constants.
+
+// A test whose test case name or test name matches this filter is
+// disabled and not run.
+static const char kDisableTestFilter[] = "DISABLED_*:*/DISABLED_*";
+
+// A test case whose name matches this filter is considered a death
+// test case and will be run before test cases whose name doesn't
+// match this filter.
+static const char kDeathTestCaseFilter[] = "*DeathTest:*DeathTest/*";
+
+// A test filter that matches everything.
+static const char kUniversalFilter[] = "*";
+
+// The default output file for XML output.
+static const char kDefaultOutputFile[] = "test_detail.xml";
+
+// The environment variable name for the test shard index.
+static const char kTestShardIndex[] = "GTEST_SHARD_INDEX";
+// The environment variable name for the total number of test shards.
+static const char kTestTotalShards[] = "GTEST_TOTAL_SHARDS";
+// The environment variable name for the test shard status file.
+static const char kTestShardStatusFile[] = "GTEST_SHARD_STATUS_FILE";
+
+namespace internal {
+
+// The text used in failure messages to indicate the start of the
+// stack trace.
+const char kStackTraceMarker[] = "\nStack trace:\n";
+
+// g_help_flag is true iff the --help flag or an equivalent form is
+// specified on the command line.
+bool g_help_flag = false;
+
+}  // namespace internal
+
+GTEST_DEFINE_bool_(
+    also_run_disabled_tests,
+    internal::BoolFromGTestEnv("also_run_disabled_tests", false),
+    "Run disabled tests too, in addition to the tests normally being run.");
+
+GTEST_DEFINE_bool_(
+    break_on_failure,
+    internal::BoolFromGTestEnv("break_on_failure", false),
+    "True iff a failed assertion should be a debugger break-point.");
+
+GTEST_DEFINE_bool_(
+    catch_exceptions,
+    internal::BoolFromGTestEnv("catch_exceptions", true),
+    "True iff " GTEST_NAME_
+    " should catch exceptions and treat them as test failures.");
+
+GTEST_DEFINE_string_(
+    color,
+    internal::StringFromGTestEnv("color", "auto"),
+    "Whether to use colors in the output.  Valid values: yes, no, "
+    "and auto.  'auto' means to use colors if the output is "
+    "being sent to a terminal and the TERM environment variable "
+    "is set to xterm, xterm-color, xterm-256color, linux or cygwin.");
+
+GTEST_DEFINE_string_(
+    filter,
+    internal::StringFromGTestEnv("filter", kUniversalFilter),
+    "A colon-separated list of glob (not regex) patterns "
+    "for filtering the tests to run, optionally followed by a "
+    "'-' and a : separated list of negative patterns (tests to "
+    "exclude).  A test is run if it matches one of the positive "
+    "patterns and does not match any of the negative patterns.");
+
+GTEST_DEFINE_bool_(list_tests, false,
+                   "List all tests without running them.");
+
+GTEST_DEFINE_string_(
+    output,
+    internal::StringFromGTestEnv("output", ""),
+    "A format (currently must be \"xml\"), optionally followed "
+    "by a colon and an output file name or directory. A directory "
+    "is indicated by a trailing pathname separator. "
+    "Examples: \"xml:filename.xml\", \"xml::directoryname/\". "
+    "If a directory is specified, output files will be created "
+    "within that directory, with file-names based on the test "
+    "executable's name and, if necessary, made unique by adding "
+    "digits.");
+
+GTEST_DEFINE_bool_(
+    print_time,
+    internal::BoolFromGTestEnv("print_time", true),
+    "True iff " GTEST_NAME_
+    " should display elapsed time in text output.");
+
+GTEST_DEFINE_int32_(
+    random_seed,
+    internal::Int32FromGTestEnv("random_seed", 0),
+    "Random number seed to use when shuffling test orders.  Must be in range "
+    "[1, 99999], or 0 to use a seed based on the current time.");
+
+GTEST_DEFINE_int32_(
+    repeat,
+    internal::Int32FromGTestEnv("repeat", 1),
+    "How many times to repeat each test.  Specify a negative number "
+    "for repeating forever.  Useful for shaking out flaky tests.");
+
+GTEST_DEFINE_bool_(
+    show_internal_stack_frames, false,
+    "True iff " GTEST_NAME_ " should include internal stack frames when "
+    "printing test failure stack traces.");
+
+GTEST_DEFINE_bool_(
+    shuffle,
+    internal::BoolFromGTestEnv("shuffle", false),
+    "True iff " GTEST_NAME_
+    " should randomize tests' order on every run.");
+
+GTEST_DEFINE_int32_(
+    stack_trace_depth,
+    internal::Int32FromGTestEnv("stack_trace_depth", kMaxStackTraceDepth),
+    "The maximum number of stack frames to print when an "
+    "assertion fails.  The valid range is 0 through 100, inclusive.");
+
+GTEST_DEFINE_string_(
+    stream_result_to,
+    internal::StringFromGTestEnv("stream_result_to", ""),
+    "This flag specifies the host name and the port number on which to stream "
+    "test results. Example: \"localhost:555\". The flag is effective only on "
+    "Linux.");
+
+GTEST_DEFINE_bool_(
+    throw_on_failure,
+    internal::BoolFromGTestEnv("throw_on_failure", false),
+    "When this flag is specified, a failed assertion will throw an exception "
+    "if exceptions are enabled or exit the program with a non-zero code "
+    "otherwise.");
+
+namespace internal {
+
+// Generates a random number from [0, range), using a Linear
+// Congruential Generator (LCG).  Crashes if 'range' is 0 or greater
+// than kMaxRange.
+UInt32 Random::Generate(UInt32 range) {
+  // These constants are the same as are used in glibc's rand(3).
+  state_ = (1103515245U*state_ + 12345U) % kMaxRange;
+
+  GTEST_CHECK_(range > 0)
+      << "Cannot generate a number in the range [0, 0).";
+  GTEST_CHECK_(range <= kMaxRange)
+      << "Generation of a number in [0, " << range << ") was requested, "
+      << "but this can only generate numbers in [0, " << kMaxRange << ").";
+
+  // Converting via modulus introduces a bit of downward bias, but
+  // it's simple, and a linear congruential generator isn't too good
+  // to begin with.
+  return state_ % range;
+}
+
+// GTestIsInitialized() returns true iff the user has initialized
+// Google Test.  Useful for catching the user mistake of not initializing
+// Google Test before calling RUN_ALL_TESTS().
+//
+// A user must call testing::InitGoogleTest() to initialize Google
+// Test.  g_init_gtest_count is set to the number of times
+// InitGoogleTest() has been called.  We don't protect this variable
+// under a mutex as it is only accessed in the main thread.
+int g_init_gtest_count = 0;
+static bool GTestIsInitialized() { return g_init_gtest_count != 0; }
+
+// Iterates over a vector of TestCases, keeping a running sum of the
+// results of calling a given int-returning method on each.
+// Returns the sum.
+static int SumOverTestCaseList(const std::vector<TestCase*>& case_list,
+                               int (TestCase::*method)() const) {
+  int sum = 0;
+  for (size_t i = 0; i < case_list.size(); i++) {
+    sum += (case_list[i]->*method)();
+  }
+  return sum;
+}
+
+// Returns true iff the test case passed.
+static bool TestCasePassed(const TestCase* test_case) {
+  return test_case->should_run() && test_case->Passed();
+}
+
+// Returns true iff the test case failed.
+static bool TestCaseFailed(const TestCase* test_case) {
+  return test_case->should_run() && test_case->Failed();
+}
+
+// Returns true iff test_case contains at least one test that should
+// run.
+static bool ShouldRunTestCase(const TestCase* test_case) {
+  return test_case->should_run();
+}
+
+// AssertHelper constructor.
+AssertHelper::AssertHelper(TestPartResult::Type type,
+                           const char* file,
+                           int line,
+                           const char* message)
+    : data_(new AssertHelperData(type, file, line, message)) {
+}
+
+AssertHelper::~AssertHelper() {
+  delete data_;
+}
+
+// Message assignment, for assertion streaming support.
+void AssertHelper::operator=(const Message& message) const {
+  UnitTest::GetInstance()->
+    AddTestPartResult(data_->type, data_->file, data_->line,
+                      AppendUserMessage(data_->message, message),
+                      UnitTest::GetInstance()->impl()
+                      ->CurrentOsStackTraceExceptTop(1)
+                      // Skips the stack frame for this function itself.
+                      );  // NOLINT
+}
+
+// Mutex for linked pointers.
+GTEST_DEFINE_STATIC_MUTEX_(g_linked_ptr_mutex);
+
+// Application pathname gotten in InitGoogleTest.
+String g_executable_path;
+
+// Returns the current application's name, removing directory path if that
+// is present.
+FilePath GetCurrentExecutableName() {
+  FilePath result;
+
+#if GTEST_OS_WINDOWS
+  result.Set(FilePath(g_executable_path).RemoveExtension("exe"));
+#else
+  result.Set(FilePath(g_executable_path));
+#endif  // GTEST_OS_WINDOWS
+
+  return result.RemoveDirectoryName();
+}
+
+// Functions for processing the gtest_output flag.
+
+// Returns the output format, or "" for normal printed output.
+String UnitTestOptions::GetOutputFormat() {
+  const char* const gtest_output_flag = GTEST_FLAG(output).c_str();
+  if (gtest_output_flag == NULL) return String("");
+
+  const char* const colon = strchr(gtest_output_flag, ':');
+  return (colon == NULL) ?
+      String(gtest_output_flag) :
+      String(gtest_output_flag, colon - gtest_output_flag);
+}
+
+// Returns the name of the requested output file, or the default if none
+// was explicitly specified.
+String UnitTestOptions::GetAbsolutePathToOutputFile() {
+  const char* const gtest_output_flag = GTEST_FLAG(output).c_str();
+  if (gtest_output_flag == NULL)
+    return String("");
+
+  const char* const colon = strchr(gtest_output_flag, ':');
+  if (colon == NULL)
+    return String(internal::FilePath::ConcatPaths(
+               internal::FilePath(
+                   UnitTest::GetInstance()->original_working_dir()),
+               internal::FilePath(kDefaultOutputFile)).ToString() );
+
+  internal::FilePath output_name(colon + 1);
+  if (!output_name.IsAbsolutePath())
+    // TODO(wan@google.com): on Windows \some\path is not an absolute
+    // path (as its meaning depends on the current drive), yet the
+    // following logic for turning it into an absolute path is wrong.
+    // Fix it.
+    output_name = internal::FilePath::ConcatPaths(
+        internal::FilePath(UnitTest::GetInstance()->original_working_dir()),
+        internal::FilePath(colon + 1));
+
+  if (!output_name.IsDirectory())
+    return output_name.ToString();
+
+  internal::FilePath result(internal::FilePath::GenerateUniqueFileName(
+      output_name, internal::GetCurrentExecutableName(),
+      GetOutputFormat().c_str()));
+  return result.ToString();
+}
+
+// Returns true iff the wildcard pattern matches the string.  The
+// first ':' or '\0' character in pattern marks the end of it.
+//
+// This recursive algorithm isn't very efficient, but is clear and
+// works well enough for matching test names, which are short.
+bool UnitTestOptions::PatternMatchesString(const char *pattern,
+                                           const char *str) {
+  switch (*pattern) {
+    case '\0':
+    case ':':  // Either ':' or '\0' marks the end of the pattern.
+      return *str == '\0';
+    case '?':  // Matches any single character.
+      return *str != '\0' && PatternMatchesString(pattern + 1, str + 1);
+    case '*':  // Matches any string (possibly empty) of characters.
+      return (*str != '\0' && PatternMatchesString(pattern, str + 1)) ||
+          PatternMatchesString(pattern + 1, str);
+    default:  // Non-special character.  Matches itself.
+      return *pattern == *str &&
+          PatternMatchesString(pattern + 1, str + 1);
+  }
+}
+
+bool UnitTestOptions::MatchesFilter(const String& name, const char* filter) {
+  const char *cur_pattern = filter;
+  for (;;) {
+    if (PatternMatchesString(cur_pattern, name.c_str())) {
+      return true;
+    }
+
+    // Finds the next pattern in the filter.
+    cur_pattern = strchr(cur_pattern, ':');
+
+    // Returns if no more pattern can be found.
+    if (cur_pattern == NULL) {
+      return false;
+    }
+
+    // Skips the pattern separater (the ':' character).
+    cur_pattern++;
+  }
+}
+
+// TODO(keithray): move String function implementations to gtest-string.cc.
+
+// Returns true iff the user-specified filter matches the test case
+// name and the test name.
+bool UnitTestOptions::FilterMatchesTest(const String &test_case_name,
+                                        const String &test_name) {
+  const String& full_name = String::Format("%s.%s",
+                                           test_case_name.c_str(),
+                                           test_name.c_str());
+
+  // Split --gtest_filter at '-', if there is one, to separate into
+  // positive filter and negative filter portions
+  const char* const p = GTEST_FLAG(filter).c_str();
+  const char* const dash = strchr(p, '-');
+  String positive;
+  String negative;
+  if (dash == NULL) {
+    positive = GTEST_FLAG(filter).c_str();  // Whole string is a positive filter
+    negative = String("");
+  } else {
+    positive = String(p, dash - p);  // Everything up to the dash
+    negative = String(dash+1);       // Everything after the dash
+    if (positive.empty()) {
+      // Treat '-test1' as the same as '*-test1'
+      positive = kUniversalFilter;
+    }
+  }
+
+  // A filter is a colon-separated list of patterns.  It matches a
+  // test if any pattern in it matches the test.
+  return (MatchesFilter(full_name, positive.c_str()) &&
+          !MatchesFilter(full_name, negative.c_str()));
+}
+
+#if GTEST_HAS_SEH
+// Returns EXCEPTION_EXECUTE_HANDLER if Google Test should handle the
+// given SEH exception, or EXCEPTION_CONTINUE_SEARCH otherwise.
+// This function is useful as an __except condition.
+int UnitTestOptions::GTestShouldProcessSEH(DWORD exception_code) {
+  // Google Test should handle a SEH exception if:
+  //   1. the user wants it to, AND
+  //   2. this is not a breakpoint exception, AND
+  //   3. this is not a C++ exception (VC++ implements them via SEH,
+  //      apparently).
+  //
+  // SEH exception code for C++ exceptions.
+  // (see http://support.microsoft.com/kb/185294 for more information).
+  const DWORD kCxxExceptionCode = 0xe06d7363;
+
+  bool should_handle = true;
+
+  if (!GTEST_FLAG(catch_exceptions))
+    should_handle = false;
+  else if (exception_code == EXCEPTION_BREAKPOINT)
+    should_handle = false;
+  else if (exception_code == kCxxExceptionCode)
+    should_handle = false;
+
+  return should_handle ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH;
+}
+#endif  // GTEST_HAS_SEH
+
+}  // namespace internal
+
+// The c'tor sets this object as the test part result reporter used by
+// Google Test.  The 'result' parameter specifies where to report the
+// results. Intercepts only failures from the current thread.
+ScopedFakeTestPartResultReporter::ScopedFakeTestPartResultReporter(
+    TestPartResultArray* result)
+    : intercept_mode_(INTERCEPT_ONLY_CURRENT_THREAD),
+      result_(result) {
+  Init();
+}
+
+// The c'tor sets this object as the test part result reporter used by
+// Google Test.  The 'result' parameter specifies where to report the
+// results.
+ScopedFakeTestPartResultReporter::ScopedFakeTestPartResultReporter(
+    InterceptMode intercept_mode, TestPartResultArray* result)
+    : intercept_mode_(intercept_mode),
+      result_(result) {
+  Init();
+}
+
+void ScopedFakeTestPartResultReporter::Init() {
+  internal::UnitTestImpl* const impl = internal::GetUnitTestImpl();
+  if (intercept_mode_ == INTERCEPT_ALL_THREADS) {
+    old_reporter_ = impl->GetGlobalTestPartResultReporter();
+    impl->SetGlobalTestPartResultReporter(this);
+  } else {
+    old_reporter_ = impl->GetTestPartResultReporterForCurrentThread();
+    impl->SetTestPartResultReporterForCurrentThread(this);
+  }
+}
+
+// The d'tor restores the test part result reporter used by Google Test
+// before.
+ScopedFakeTestPartResultReporter::~ScopedFakeTestPartResultReporter() {
+  internal::UnitTestImpl* const impl = internal::GetUnitTestImpl();
+  if (intercept_mode_ == INTERCEPT_ALL_THREADS) {
+    impl->SetGlobalTestPartResultReporter(old_reporter_);
+  } else {
+    impl->SetTestPartResultReporterForCurrentThread(old_reporter_);
+  }
+}
+
+// Increments the test part result count and remembers the result.
+// This method is from the TestPartResultReporterInterface interface.
+void ScopedFakeTestPartResultReporter::ReportTestPartResult(
+    const TestPartResult& result) {
+  result_->Append(result);
+}
+
+namespace internal {
+
+// Returns the type ID of ::testing::Test.  We should always call this
+// instead of GetTypeId< ::testing::Test>() to get the type ID of
+// testing::Test.  This is to work around a suspected linker bug when
+// using Google Test as a framework on Mac OS X.  The bug causes
+// GetTypeId< ::testing::Test>() to return different values depending
+// on whether the call is from the Google Test framework itself or
+// from user test code.  GetTestTypeId() is guaranteed to always
+// return the same value, as it always calls GetTypeId<>() from the
+// gtest.cc, which is within the Google Test framework.
+TypeId GetTestTypeId() {
+  return GetTypeId<Test>();
+}
+
+// The value of GetTestTypeId() as seen from within the Google Test
+// library.  This is solely for testing GetTestTypeId().
+extern const TypeId kTestTypeIdInGoogleTest = GetTestTypeId();
+
+// This predicate-formatter checks that 'results' contains a test part
+// failure of the given type and that the failure message contains the
+// given substring.
+AssertionResult HasOneFailure(const char* /* results_expr */,
+                              const char* /* type_expr */,
+                              const char* /* substr_expr */,
+                              const TestPartResultArray& results,
+                              TestPartResult::Type type,
+                              const string& substr) {
+  const String expected(type == TestPartResult::kFatalFailure ?
+                        "1 fatal failure" :
+                        "1 non-fatal failure");
+  Message msg;
+  if (results.size() != 1) {
+    msg << "Expected: " << expected << "\n"
+        << "  Actual: " << results.size() << " failures";
+    for (int i = 0; i < results.size(); i++) {
+      msg << "\n" << results.GetTestPartResult(i);
+    }
+    return AssertionFailure() << msg;
+  }
+
+  const TestPartResult& r = results.GetTestPartResult(0);
+  if (r.type() != type) {
+    return AssertionFailure() << "Expected: " << expected << "\n"
+                              << "  Actual:\n"
+                              << r;
+  }
+
+  if (strstr(r.message(), substr.c_str()) == NULL) {
+    return AssertionFailure() << "Expected: " << expected << " containing \""
+                              << substr << "\"\n"
+                              << "  Actual:\n"
+                              << r;
+  }
+
+  return AssertionSuccess();
+}
+
+// The constructor of SingleFailureChecker remembers where to look up
+// test part results, what type of failure we expect, and what
+// substring the failure message should contain.
+SingleFailureChecker:: SingleFailureChecker(
+    const TestPartResultArray* results,
+    TestPartResult::Type type,
+    const string& substr)
+    : results_(results),
+      type_(type),
+      substr_(substr) {}
+
+// The destructor of SingleFailureChecker verifies that the given
+// TestPartResultArray contains exactly one failure that has the given
+// type and contains the given substring.  If that's not the case, a
+// non-fatal failure will be generated.
+SingleFailureChecker::~SingleFailureChecker() {
+  EXPECT_PRED_FORMAT3(HasOneFailure, *results_, type_, substr_);
+}
+
+DefaultGlobalTestPartResultReporter::DefaultGlobalTestPartResultReporter(
+    UnitTestImpl* unit_test) : unit_test_(unit_test) {}
+
+void DefaultGlobalTestPartResultReporter::ReportTestPartResult(
+    const TestPartResult& result) {
+  unit_test_->current_test_result()->AddTestPartResult(result);
+  unit_test_->listeners()->repeater()->OnTestPartResult(result);
+}
+
+DefaultPerThreadTestPartResultReporter::DefaultPerThreadTestPartResultReporter(
+    UnitTestImpl* unit_test) : unit_test_(unit_test) {}
+
+void DefaultPerThreadTestPartResultReporter::ReportTestPartResult(
+    const TestPartResult& result) {
+  unit_test_->GetGlobalTestPartResultReporter()->ReportTestPartResult(result);
+}
+
+// Returns the global test part result reporter.
+TestPartResultReporterInterface*
+UnitTestImpl::GetGlobalTestPartResultReporter() {
+  internal::MutexLock lock(&global_test_part_result_reporter_mutex_);
+  return global_test_part_result_repoter_;
+}
+
+// Sets the global test part result reporter.
+void UnitTestImpl::SetGlobalTestPartResultReporter(
+    TestPartResultReporterInterface* reporter) {
+  internal::MutexLock lock(&global_test_part_result_reporter_mutex_);
+  global_test_part_result_repoter_ = reporter;
+}
+
+// Returns the test part result reporter for the current thread.
+TestPartResultReporterInterface*
+UnitTestImpl::GetTestPartResultReporterForCurrentThread() {
+  return per_thread_test_part_result_reporter_.get();
+}
+
+// Sets the test part result reporter for the current thread.
+void UnitTestImpl::SetTestPartResultReporterForCurrentThread(
+    TestPartResultReporterInterface* reporter) {
+  per_thread_test_part_result_reporter_.set(reporter);
+}
+
+// Gets the number of successful test cases.
+int UnitTestImpl::successful_test_case_count() const {
+  return CountIf(test_cases_, TestCasePassed);
+}
+
+// Gets the number of failed test cases.
+int UnitTestImpl::failed_test_case_count() const {
+  return CountIf(test_cases_, TestCaseFailed);
+}
+
+// Gets the number of all test cases.
+int UnitTestImpl::total_test_case_count() const {
+  return static_cast<int>(test_cases_.size());
+}
+
+// Gets the number of all test cases that contain at least one test
+// that should run.
+int UnitTestImpl::test_case_to_run_count() const {
+  return CountIf(test_cases_, ShouldRunTestCase);
+}
+
+// Gets the number of successful tests.
+int UnitTestImpl::successful_test_count() const {
+  return SumOverTestCaseList(test_cases_, &TestCase::successful_test_count);
+}
+
+// Gets the number of failed tests.
+int UnitTestImpl::failed_test_count() const {
+  return SumOverTestCaseList(test_cases_, &TestCase::failed_test_count);
+}
+
+// Gets the number of disabled tests.
+int UnitTestImpl::disabled_test_count() const {
+  return SumOverTestCaseList(test_cases_, &TestCase::disabled_test_count);
+}
+
+// Gets the number of all tests.
+int UnitTestImpl::total_test_count() const {
+  return SumOverTestCaseList(test_cases_, &TestCase::total_test_count);
+}
+
+// Gets the number of tests that should run.
+int UnitTestImpl::test_to_run_count() const {
+  return SumOverTestCaseList(test_cases_, &TestCase::test_to_run_count);
+}
+
+// Returns the current OS stack trace as a String.
+//
+// The maximum number of stack frames to be included is specified by
+// the gtest_stack_trace_depth flag.  The skip_count parameter
+// specifies the number of top frames to be skipped, which doesn't
+// count against the number of frames to be included.
+//
+// For example, if Foo() calls Bar(), which in turn calls
+// CurrentOsStackTraceExceptTop(1), Foo() will be included in the
+// trace but Bar() and CurrentOsStackTraceExceptTop() won't.
+String UnitTestImpl::CurrentOsStackTraceExceptTop(int skip_count) {
+  (void)skip_count;
+  return String("");
+}
+
+// Returns the current time in milliseconds.
+TimeInMillis GetTimeInMillis() {
+#if GTEST_OS_WINDOWS_MOBILE || defined(__BORLANDC__)
+  // Difference between 1970-01-01 and 1601-01-01 in milliseconds.
+  // http://analogous.blogspot.com/2005/04/epoch.html
+  const TimeInMillis kJavaEpochToWinFileTimeDelta =
+    static_cast<TimeInMillis>(116444736UL) * 100000UL;
+  const DWORD kTenthMicrosInMilliSecond = 10000;
+
+  SYSTEMTIME now_systime;
+  FILETIME now_filetime;
+  ULARGE_INTEGER now_int64;
+  // TODO(kenton@google.com): Shouldn't this just use
+  //   GetSystemTimeAsFileTime()?
+  GetSystemTime(&now_systime);
+  if (SystemTimeToFileTime(&now_systime, &now_filetime)) {
+    now_int64.LowPart = now_filetime.dwLowDateTime;
+    now_int64.HighPart = now_filetime.dwHighDateTime;
+    now_int64.QuadPart = (now_int64.QuadPart / kTenthMicrosInMilliSecond) -
+      kJavaEpochToWinFileTimeDelta;
+    return now_int64.QuadPart;
+  }
+  return 0;
+#elif GTEST_OS_WINDOWS && !GTEST_HAS_GETTIMEOFDAY_
+  __timeb64 now;
+
+# ifdef _MSC_VER
+
+  // MSVC 8 deprecates _ftime64(), so we want to suppress warning 4996
+  // (deprecated function) there.
+  // TODO(kenton@google.com): Use GetTickCount()?  Or use
+  //   SystemTimeToFileTime()
+#  pragma warning(push)          // Saves the current warning state.
+#  pragma warning(disable:4996)  // Temporarily disables warning 4996.
+  _ftime64(&now);
+#  pragma warning(pop)           // Restores the warning state.
+# else
+
+  _ftime64(&now);
+
+# endif  // _MSC_VER
+
+  return static_cast<TimeInMillis>(now.time) * 1000 + now.millitm;
+#elif GTEST_HAS_GETTIMEOFDAY_
+  struct timeval now;
+  gettimeofday(&now, NULL);
+  return static_cast<TimeInMillis>(now.tv_sec) * 1000 + now.tv_usec / 1000;
+#else
+# error "Don't know how to get the current time on your system."
+#endif
+}
+
+// Utilities
+
+// class String
+
+// Returns the input enclosed in double quotes if it's not NULL;
+// otherwise returns "(null)".  For example, "\"Hello\"" is returned
+// for input "Hello".
+//
+// This is useful for printing a C string in the syntax of a literal.
+//
+// Known issue: escape sequences are not handled yet.
+String String::ShowCStringQuoted(const char* c_str) {
+  return c_str ? String::Format("\"%s\"", c_str) : String("(null)");
+}
+
+// Copies at most length characters from str into a newly-allocated
+// piece of memory of size length+1.  The memory is allocated with new[].
+// A terminating null byte is written to the memory, and a pointer to it
+// is returned.  If str is NULL, NULL is returned.
+static char* CloneString(const char* str, size_t length) {
+  if (str == NULL) {
+    return NULL;
+  } else {
+    char* const clone = new char[length + 1];
+    posix::StrNCpy(clone, str, length);
+    clone[length] = '\0';
+    return clone;
+  }
+}
+
+// Clones a 0-terminated C string, allocating memory using new.  The
+// caller is responsible for deleting[] the return value.  Returns the
+// cloned string, or NULL if the input is NULL.
+const char * String::CloneCString(const char* c_str) {
+  return (c_str == NULL) ?
+                    NULL : CloneString(c_str, strlen(c_str));
+}
+
+#if GTEST_OS_WINDOWS_MOBILE
+// Creates a UTF-16 wide string from the given ANSI string, allocating
+// memory using new. The caller is responsible for deleting the return
+// value using delete[]. Returns the wide string, or NULL if the
+// input is NULL.
+LPCWSTR String::AnsiToUtf16(const char* ansi) {
+  if (!ansi) return NULL;
+  const int length = strlen(ansi);
+  const int unicode_length =
+      MultiByteToWideChar(CP_ACP, 0, ansi, length,
+                          NULL, 0);
+  WCHAR* unicode = new WCHAR[unicode_length + 1];
+  MultiByteToWideChar(CP_ACP, 0, ansi, length,
+                      unicode, unicode_length);
+  unicode[unicode_length] = 0;
+  return unicode;
+}
+
+// Creates an ANSI string from the given wide string, allocating
+// memory using new. The caller is responsible for deleting the return
+// value using delete[]. Returns the ANSI string, or NULL if the
+// input is NULL.
+const char* String::Utf16ToAnsi(LPCWSTR utf16_str)  {
+  if (!utf16_str) return NULL;
+  const int ansi_length =
+      WideCharToMultiByte(CP_ACP, 0, utf16_str, -1,
+                          NULL, 0, NULL, NULL);
+  char* ansi = new char[ansi_length + 1];
+  WideCharToMultiByte(CP_ACP, 0, utf16_str, -1,
+                      ansi, ansi_length, NULL, NULL);
+  ansi[ansi_length] = 0;
+  return ansi;
+}
+
+#endif  // GTEST_OS_WINDOWS_MOBILE
+
+// Compares two C strings.  Returns true iff they have the same content.
+//
+// Unlike strcmp(), this function can handle NULL argument(s).  A NULL
+// C string is considered different to any non-NULL C string,
+// including the empty string.
+bool String::CStringEquals(const char * lhs, const char * rhs) {
+  if ( lhs == NULL ) return rhs == NULL;
+
+  if ( rhs == NULL ) return false;
+
+  return strcmp(lhs, rhs) == 0;
+}
+
+#if GTEST_HAS_STD_WSTRING || GTEST_HAS_GLOBAL_WSTRING
+
+// Converts an array of wide chars to a narrow string using the UTF-8
+// encoding, and streams the result to the given Message object.
+static void StreamWideCharsToMessage(const wchar_t* wstr, size_t length,
+                                     Message* msg) {
+  // TODO(wan): consider allowing a testing::String object to
+  // contain '\0'.  This will make it behave more like std::string,
+  // and will allow ToUtf8String() to return the correct encoding
+  // for '\0' s.t. we can get rid of the conditional here (and in
+  // several other places).
+  for (size_t i = 0; i != length; ) {  // NOLINT
+    if (wstr[i] != L'\0') {
+      *msg << WideStringToUtf8(wstr + i, static_cast<int>(length - i));
+      while (i != length && wstr[i] != L'\0')
+        i++;
+    } else {
+      *msg << '\0';
+      i++;
+    }
+  }
+}
+
+#endif  // GTEST_HAS_STD_WSTRING || GTEST_HAS_GLOBAL_WSTRING
+
+}  // namespace internal
+
+#if GTEST_HAS_STD_WSTRING
+// Converts the given wide string to a narrow string using the UTF-8
+// encoding, and streams the result to this Message object.
+Message& Message::operator <<(const ::std::wstring& wstr) {
+  internal::StreamWideCharsToMessage(wstr.c_str(), wstr.length(), this);
+  return *this;
+}
+#endif  // GTEST_HAS_STD_WSTRING
+
+#if GTEST_HAS_GLOBAL_WSTRING
+// Converts the given wide string to a narrow string using the UTF-8
+// encoding, and streams the result to this Message object.
+Message& Message::operator <<(const ::wstring& wstr) {
+  internal::StreamWideCharsToMessage(wstr.c_str(), wstr.length(), this);
+  return *this;
+}
+#endif  // GTEST_HAS_GLOBAL_WSTRING
+
+// AssertionResult constructors.
+// Used in EXPECT_TRUE/FALSE(assertion_result).
+AssertionResult::AssertionResult(const AssertionResult& other)
+    : success_(other.success_),
+      message_(other.message_.get() != NULL ?
+               new ::std::string(*other.message_) :
+               static_cast< ::std::string*>(NULL)) {
+}
+
+// Returns the assertion's negation. Used with EXPECT/ASSERT_FALSE.
+AssertionResult AssertionResult::operator!() const {
+  AssertionResult negation(!success_);
+  if (message_.get() != NULL)
+    negation << *message_;
+  return negation;
+}
+
+// Makes a successful assertion result.
+AssertionResult AssertionSuccess() {
+  return AssertionResult(true);
+}
+
+// Makes a failed assertion result.
+AssertionResult AssertionFailure() {
+  return AssertionResult(false);
+}
+
+// Makes a failed assertion result with the given failure message.
+// Deprecated; use AssertionFailure() << message.
+AssertionResult AssertionFailure(const Message& message) {
+  return AssertionFailure() << message;
+}
+
+namespace internal {
+
+// Constructs and returns the message for an equality assertion
+// (e.g. ASSERT_EQ, EXPECT_STREQ, etc) failure.
+//
+// The first four parameters are the expressions used in the assertion
+// and their values, as strings.  For example, for ASSERT_EQ(foo, bar)
+// where foo is 5 and bar is 6, we have:
+//
+//   expected_expression: "foo"
+//   actual_expression:   "bar"
+//   expected_value:      "5"
+//   actual_value:        "6"
+//
+// The ignoring_case parameter is true iff the assertion is a
+// *_STRCASEEQ*.  When it's true, the string " (ignoring case)" will
+// be inserted into the message.
+AssertionResult EqFailure(const char* expected_expression,
+                          const char* actual_expression,
+                          const String& expected_value,
+                          const String& actual_value,
+                          bool ignoring_case) {
+  Message msg;
+  msg << "Value of: " << actual_expression;
+  if (actual_value != actual_expression) {
+    msg << "\n  Actual: " << actual_value;
+  }
+
+  msg << "\nExpected: " << expected_expression;
+  if (ignoring_case) {
+    msg << " (ignoring case)";
+  }
+  if (expected_value != expected_expression) {
+    msg << "\nWhich is: " << expected_value;
+  }
+
+  return AssertionFailure() << msg;
+}
+
+// Constructs a failure message for Boolean assertions such as EXPECT_TRUE.
+String GetBoolAssertionFailureMessage(const AssertionResult& assertion_result,
+                                      const char* expression_text,
+                                      const char* actual_predicate_value,
+                                      const char* expected_predicate_value) {
+  const char* actual_message = assertion_result.message();
+  Message msg;
+  msg << "Value of: " << expression_text
+      << "\n  Actual: " << actual_predicate_value;
+  if (actual_message[0] != '\0')
+    msg << " (" << actual_message << ")";
+  msg << "\nExpected: " << expected_predicate_value;
+  return msg.GetString();
+}
+
+// Helper function for implementing ASSERT_NEAR.
+AssertionResult DoubleNearPredFormat(const char* expr1,
+                                     const char* expr2,
+                                     const char* abs_error_expr,
+                                     double val1,
+                                     double val2,
+                                     double abs_error) {
+  const double diff = fabs(val1 - val2);
+  if (diff <= abs_error) return AssertionSuccess();
+
+  // TODO(wan): do not print the value of an expression if it's
+  // already a literal.
+  return AssertionFailure()
+      << "The difference between " << expr1 << " and " << expr2
+      << " is " << diff << ", which exceeds " << abs_error_expr << ", where\n"
+      << expr1 << " evaluates to " << val1 << ",\n"
+      << expr2 << " evaluates to " << val2 << ", and\n"
+      << abs_error_expr << " evaluates to " << abs_error << ".";
+}
+
+
+// Helper template for implementing FloatLE() and DoubleLE().
+template <typename RawType>
+AssertionResult FloatingPointLE(const char* expr1,
+                                const char* expr2,
+                                RawType val1,
+                                RawType val2) {
+  // Returns success if val1 is less than val2,
+  if (val1 < val2) {
+    return AssertionSuccess();
+  }
+
+  // or if val1 is almost equal to val2.
+  const FloatingPoint<RawType> lhs(val1), rhs(val2);
+  if (lhs.AlmostEquals(rhs)) {
+    return AssertionSuccess();
+  }
+
+  // Note that the above two checks will both fail if either val1 or
+  // val2 is NaN, as the IEEE floating-point standard requires that
+  // any predicate involving a NaN must return false.
+
+  ::std::stringstream val1_ss;
+  val1_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)
+          << val1;
+
+  ::std::stringstream val2_ss;
+  val2_ss << std::setprecision(std::numeric_limits<RawType>::digits10 + 2)
+          << val2;
+
+  return AssertionFailure()
+      << "Expected: (" << expr1 << ") <= (" << expr2 << ")\n"
+      << "  Actual: " << StringStreamToString(&val1_ss) << " vs "
+      << StringStreamToString(&val2_ss);
+}
+
+}  // namespace internal
+
+// Asserts that val1 is less than, or almost equal to, val2.  Fails
+// otherwise.  In particular, it fails if either val1 or val2 is NaN.
+AssertionResult FloatLE(const char* expr1, const char* expr2,
+                        float val1, float val2) {
+  return internal::FloatingPointLE<float>(expr1, expr2, val1, val2);
+}
+
+// Asserts that val1 is less than, or almost equal to, val2.  Fails
+// otherwise.  In particular, it fails if either val1 or val2 is NaN.
+AssertionResult DoubleLE(const char* expr1, const char* expr2,
+                         double val1, double val2) {
+  return internal::FloatingPointLE<double>(expr1, expr2, val1, val2);
+}
+
+namespace internal {
+
+// The helper function for {ASSERT|EXPECT}_EQ with int or enum
+// arguments.
+AssertionResult CmpHelperEQ(const char* expected_expression,
+                            const char* actual_expression,
+                            BiggestInt expected,
+                            BiggestInt actual) {
+  if (expected == actual) {
+    return AssertionSuccess();
+  }
+
+  return EqFailure(expected_expression,
+                   actual_expression,
+                   FormatForComparisonFailureMessage(expected, actual),
+                   FormatForComparisonFailureMessage(actual, expected),
+                   false);
+}
+
+// A macro for implementing the helper functions needed to implement
+// ASSERT_?? and EXPECT_?? with integer or enum arguments.  It is here
+// just to avoid copy-and-paste of similar code.
+#define GTEST_IMPL_CMP_HELPER_(op_name, op)\
+AssertionResult CmpHelper##op_name(const char* expr1, const char* expr2, \
+                                   BiggestInt val1, BiggestInt val2) {\
+  if (val1 op val2) {\
+    return AssertionSuccess();\
+  } else {\
+    return AssertionFailure() \
+        << "Expected: (" << expr1 << ") " #op " (" << expr2\
+        << "), actual: " << FormatForComparisonFailureMessage(val1, val2)\
+        << " vs " << FormatForComparisonFailureMessage(val2, val1);\
+  }\
+}
+
+// Implements the helper function for {ASSERT|EXPECT}_NE with int or
+// enum arguments.
+GTEST_IMPL_CMP_HELPER_(NE, !=)
+// Implements the helper function for {ASSERT|EXPECT}_LE with int or
+// enum arguments.
+GTEST_IMPL_CMP_HELPER_(LE, <=)
+// Implements the helper function for {ASSERT|EXPECT}_LT with int or
+// enum arguments.
+GTEST_IMPL_CMP_HELPER_(LT, < )
+// Implements the helper function for {ASSERT|EXPECT}_GE with int or
+// enum arguments.
+GTEST_IMPL_CMP_HELPER_(GE, >=)
+// Implements the helper function for {ASSERT|EXPECT}_GT with int or
+// enum arguments.
+GTEST_IMPL_CMP_HELPER_(GT, > )
+
+#undef GTEST_IMPL_CMP_HELPER_
+
+// The helper function for {ASSERT|EXPECT}_STREQ.
+AssertionResult CmpHelperSTREQ(const char* expected_expression,
+                               const char* actual_expression,
+                               const char* expected,
+                               const char* actual) {
+  if (String::CStringEquals(expected, actual)) {
+    return AssertionSuccess();
+  }
+
+  return EqFailure(expected_expression,
+                   actual_expression,
+                   String::ShowCStringQuoted(expected),
+                   String::ShowCStringQuoted(actual),
+                   false);
+}
+
+// The helper function for {ASSERT|EXPECT}_STRCASEEQ.
+AssertionResult CmpHelperSTRCASEEQ(const char* expected_expression,
+                                   const char* actual_expression,
+                                   const char* expected,
+                                   const char* actual) {
+  if (String::CaseInsensitiveCStringEquals(expected, actual)) {
+    return AssertionSuccess();
+  }
+
+  return EqFailure(expected_expression,
+                   actual_expression,
+                   String::ShowCStringQuoted(expected),
+                   String::ShowCStringQuoted(actual),
+                   true);
+}
+
+// The helper function for {ASSERT|EXPECT}_STRNE.
+AssertionResult CmpHelperSTRNE(const char* s1_expression,
+                               const char* s2_expression,
+                               const char* s1,
+                               const char* s2) {
+  if (!String::CStringEquals(s1, s2)) {
+    return AssertionSuccess();
+  } else {
+    return AssertionFailure() << "Expected: (" << s1_expression << ") != ("
+                              << s2_expression << "), actual: \""
+                              << s1 << "\" vs \"" << s2 << "\"";
+  }
+}
+
+// The helper function for {ASSERT|EXPECT}_STRCASENE.
+AssertionResult CmpHelperSTRCASENE(const char* s1_expression,
+                                   const char* s2_expression,
+                                   const char* s1,
+                                   const char* s2) {
+  if (!String::CaseInsensitiveCStringEquals(s1, s2)) {
+    return AssertionSuccess();
+  } else {
+    return AssertionFailure()
+        << "Expected: (" << s1_expression << ") != ("
+        << s2_expression << ") (ignoring case), actual: \""
+        << s1 << "\" vs \"" << s2 << "\"";
+  }
+}
+
+}  // namespace internal
+
+namespace {
+
+// Helper functions for implementing IsSubString() and IsNotSubstring().
+
+// This group of overloaded functions return true iff needle is a
+// substring of haystack.  NULL is considered a substring of itself
+// only.
+
+bool IsSubstringPred(const char* needle, const char* haystack) {
+  if (needle == NULL || haystack == NULL)
+    return needle == haystack;
+
+  return strstr(haystack, needle) != NULL;
+}
+
+bool IsSubstringPred(const wchar_t* needle, const wchar_t* haystack) {
+  if (needle == NULL || haystack == NULL)
+    return needle == haystack;
+
+  return wcsstr(haystack, needle) != NULL;
+}
+
+// StringType here can be either ::std::string or ::std::wstring.
+template <typename StringType>
+bool IsSubstringPred(const StringType& needle,
+                     const StringType& haystack) {
+  return haystack.find(needle) != StringType::npos;
+}
+
+// This function implements either IsSubstring() or IsNotSubstring(),
+// depending on the value of the expected_to_be_substring parameter.
+// StringType here can be const char*, const wchar_t*, ::std::string,
+// or ::std::wstring.
+template <typename StringType>
+AssertionResult IsSubstringImpl(
+    bool expected_to_be_substring,
+    const char* needle_expr, const char* haystack_expr,
+    const StringType& needle, const StringType& haystack) {
+  if (IsSubstringPred(needle, haystack) == expected_to_be_substring)
+    return AssertionSuccess();
+
+  const bool is_wide_string = sizeof(needle[0]) > 1;
+  const char* const begin_string_quote = is_wide_string ? "L\"" : "\"";
+  return AssertionFailure()
+      << "Value of: " << needle_expr << "\n"
+      << "  Actual: " << begin_string_quote << needle << "\"\n"
+      << "Expected: " << (expected_to_be_substring ? "" : "not ")
+      << "a substring of " << haystack_expr << "\n"
+      << "Which is: " << begin_string_quote << haystack << "\"";
+}
+
+}  // namespace
+
+// IsSubstring() and IsNotSubstring() check whether needle is a
+// substring of haystack (NULL is considered a substring of itself
+// only), and return an appropriate error message when they fail.
+
+AssertionResult IsSubstring(
+    const char* needle_expr, const char* haystack_expr,
+    const char* needle, const char* haystack) {
+  return IsSubstringImpl(true, needle_expr, haystack_expr, needle, haystack);
+}
+
+AssertionResult IsSubstring(
+    const char* needle_expr, const char* haystack_expr,
+    const wchar_t* needle, const wchar_t* haystack) {
+  return IsSubstringImpl(true, needle_expr, haystack_expr, needle, haystack);
+}
+
+AssertionResult IsNotSubstring(
+    const char* needle_expr, const char* haystack_expr,
+    const char* needle, const char* haystack) {
+  return IsSubstringImpl(false, needle_expr, haystack_expr, needle, haystack);
+}
+
+AssertionResult IsNotSubstring(
+    const char* needle_expr, const char* haystack_expr,
+    const wchar_t* needle, const wchar_t* haystack) {
+  return IsSubstringImpl(false, needle_expr, haystack_expr, needle, haystack);
+}
+
+AssertionResult IsSubstring(
+    const char* needle_expr, const char* haystack_expr,
+    const ::std::string& needle, const ::std::string& haystack) {
+  return IsSubstringImpl(true, needle_expr, haystack_expr, needle, haystack);
+}
+
+AssertionResult IsNotSubstring(
+    const char* needle_expr, const char* haystack_expr,
+    const ::std::string& needle, const ::std::string& haystack) {
+  return IsSubstringImpl(false, needle_expr, haystack_expr, needle, haystack);
+}
+
+#if GTEST_HAS_STD_WSTRING
+AssertionResult IsSubstring(
+    const char* needle_expr, const char* haystack_expr,
+    const ::std::wstring& needle, const ::std::wstring& haystack) {
+  return IsSubstringImpl(true, needle_expr, haystack_expr, needle, haystack);
+}
+
+AssertionResult IsNotSubstring(
+    const char* needle_expr, const char* haystack_expr,
+    const ::std::wstring& needle, const ::std::wstring& haystack) {
+  return IsSubstringImpl(false, needle_expr, haystack_expr, needle, haystack);
+}
+#endif  // GTEST_HAS_STD_WSTRING
+
+namespace internal {
+
+#if GTEST_OS_WINDOWS
+
+namespace {
+
+// Helper function for IsHRESULT{SuccessFailure} predicates
+AssertionResult HRESULTFailureHelper(const char* expr,
+                                     const char* expected,
+                                     long hr) {  // NOLINT
+# if GTEST_OS_WINDOWS_MOBILE
+
+  // Windows CE doesn't support FormatMessage.
+  const char error_text[] = "";
+
+# else
+
+  // Looks up the human-readable system message for the HRESULT code
+  // and since we're not passing any params to FormatMessage, we don't
+  // want inserts expanded.
+  const DWORD kFlags = FORMAT_MESSAGE_FROM_SYSTEM |
+                       FORMAT_MESSAGE_IGNORE_INSERTS;
+  const DWORD kBufSize = 4096;  // String::Format can't exceed this length.
+  // Gets the system's human readable message string for this HRESULT.
+  char error_text[kBufSize] = { '\0' };
+  DWORD message_length = ::FormatMessageA(kFlags,
+                                          0,  // no source, we're asking system
+                                          hr,  // the error
+                                          0,  // no line width restrictions
+                                          error_text,  // output buffer
+                                          kBufSize,  // buf size
+                                          NULL);  // no arguments for inserts
+  // Trims tailing white space (FormatMessage leaves a trailing cr-lf)
+  for (; message_length && IsSpace(error_text[message_length - 1]);
+          --message_length) {
+    error_text[message_length - 1] = '\0';
+  }
+
+# endif  // GTEST_OS_WINDOWS_MOBILE
+
+  const String error_hex(String::Format("0x%08X ", hr));
+  return ::testing::AssertionFailure()
+      << "Expected: " << expr << " " << expected << ".\n"
+      << "  Actual: " << error_hex << error_text << "\n";
+}
+
+}  // namespace
+
+AssertionResult IsHRESULTSuccess(const char* expr, long hr) {  // NOLINT
+  if (SUCCEEDED(hr)) {
+    return AssertionSuccess();
+  }
+  return HRESULTFailureHelper(expr, "succeeds", hr);
+}
+
+AssertionResult IsHRESULTFailure(const char* expr, long hr) {  // NOLINT
+  if (FAILED(hr)) {
+    return AssertionSuccess();
+  }
+  return HRESULTFailureHelper(expr, "fails", hr);
+}
+
+#endif  // GTEST_OS_WINDOWS
+
+// Utility functions for encoding Unicode text (wide strings) in
+// UTF-8.
+
+// A Unicode code-point can have upto 21 bits, and is encoded in UTF-8
+// like this:
+//
+// Code-point length   Encoding
+//   0 -  7 bits       0xxxxxxx
+//   8 - 11 bits       110xxxxx 10xxxxxx
+//  12 - 16 bits       1110xxxx 10xxxxxx 10xxxxxx
+//  17 - 21 bits       11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
+
+// The maximum code-point a one-byte UTF-8 sequence can represent.
+const UInt32 kMaxCodePoint1 = (static_cast<UInt32>(1) <<  7) - 1;
+
+// The maximum code-point a two-byte UTF-8 sequence can represent.
+const UInt32 kMaxCodePoint2 = (static_cast<UInt32>(1) << (5 + 6)) - 1;
+
+// The maximum code-point a three-byte UTF-8 sequence can represent.
+const UInt32 kMaxCodePoint3 = (static_cast<UInt32>(1) << (4 + 2*6)) - 1;
+
+// The maximum code-point a four-byte UTF-8 sequence can represent.
+const UInt32 kMaxCodePoint4 = (static_cast<UInt32>(1) << (3 + 3*6)) - 1;
+
+// Chops off the n lowest bits from a bit pattern.  Returns the n
+// lowest bits.  As a side effect, the original bit pattern will be
+// shifted to the right by n bits.
+inline UInt32 ChopLowBits(UInt32* bits, int n) {
+  const UInt32 low_bits = *bits & ((static_cast<UInt32>(1) << n) - 1);
+  *bits >>= n;
+  return low_bits;
+}
+
+// Converts a Unicode code point to a narrow string in UTF-8 encoding.
+// code_point parameter is of type UInt32 because wchar_t may not be
+// wide enough to contain a code point.
+// The output buffer str must containt at least 32 characters.
+// The function returns the address of the output buffer.
+// If the code_point is not a valid Unicode code point
+// (i.e. outside of Unicode range U+0 to U+10FFFF) it will be output
+// as '(Invalid Unicode 0xXXXXXXXX)'.
+char* CodePointToUtf8(UInt32 code_point, char* str) {
+  if (code_point <= kMaxCodePoint1) {
+    str[1] = '\0';
+    str[0] = static_cast<char>(code_point);                          // 0xxxxxxx
+  } else if (code_point <= kMaxCodePoint2) {
+    str[2] = '\0';
+    str[1] = static_cast<char>(0x80 | ChopLowBits(&code_point, 6));  // 10xxxxxx
+    str[0] = static_cast<char>(0xC0 | code_point);                   // 110xxxxx
+  } else if (code_point <= kMaxCodePoint3) {
+    str[3] = '\0';
+    str[2] = static_cast<char>(0x80 | ChopLowBits(&code_point, 6));  // 10xxxxxx
+    str[1] = static_cast<char>(0x80 | ChopLowBits(&code_point, 6));  // 10xxxxxx
+    str[0] = static_cast<char>(0xE0 | code_point);                   // 1110xxxx
+  } else if (code_point <= kMaxCodePoint4) {
+    str[4] = '\0';
+    str[3] = static_cast<char>(0x80 | ChopLowBits(&code_point, 6));  // 10xxxxxx
+    str[2] = static_cast<char>(0x80 | ChopLowBits(&code_point, 6));  // 10xxxxxx
+    str[1] = static_cast<char>(0x80 | ChopLowBits(&code_point, 6));  // 10xxxxxx
+    str[0] = static_cast<char>(0xF0 | code_point);                   // 11110xxx
+  } else {
+    // The longest string String::Format can produce when invoked
+    // with these parameters is 28 character long (not including
+    // the terminating nul character). We are asking for 32 character
+    // buffer just in case. This is also enough for strncpy to
+    // null-terminate the destination string.
+    posix::StrNCpy(
+        str, String::Format("(Invalid Unicode 0x%X)", code_point).c_str(), 32);
+    str[31] = '\0';  // Makes sure no change in the format to strncpy leaves
+                     // the result unterminated.
+  }
+  return str;
+}
+
+// The following two functions only make sense if the the system
+// uses UTF-16 for wide string encoding. All supported systems
+// with 16 bit wchar_t (Windows, Cygwin, Symbian OS) do use UTF-16.
+
+// Determines if the arguments constitute UTF-16 surrogate pair
+// and thus should be combined into a single Unicode code point
+// using CreateCodePointFromUtf16SurrogatePair.
+inline bool IsUtf16SurrogatePair(wchar_t first, wchar_t second) {
+  return sizeof(wchar_t) == 2 &&
+      (first & 0xFC00) == 0xD800 && (second & 0xFC00) == 0xDC00;
+}
+
+// Creates a Unicode code point from UTF16 surrogate pair.
+inline UInt32 CreateCodePointFromUtf16SurrogatePair(wchar_t first,
+                                                    wchar_t second) {
+  const UInt32 mask = (1 << 10) - 1;
+  return (sizeof(wchar_t) == 2) ?
+      (((first & mask) << 10) | (second & mask)) + 0x10000 :
+      // This function should not be called when the condition is
+      // false, but we provide a sensible default in case it is.
+      static_cast<UInt32>(first);
+}
+
+// Converts a wide string to a narrow string in UTF-8 encoding.
+// The wide string is assumed to have the following encoding:
+//   UTF-16 if sizeof(wchar_t) == 2 (on Windows, Cygwin, Symbian OS)
+//   UTF-32 if sizeof(wchar_t) == 4 (on Linux)
+// Parameter str points to a null-terminated wide string.
+// Parameter num_chars may additionally limit the number
+// of wchar_t characters processed. -1 is used when the entire string
+// should be processed.
+// If the string contains code points that are not valid Unicode code points
+// (i.e. outside of Unicode range U+0 to U+10FFFF) they will be output
+// as '(Invalid Unicode 0xXXXXXXXX)'. If the string is in UTF16 encoding
+// and contains invalid UTF-16 surrogate pairs, values in those pairs
+// will be encoded as individual Unicode characters from Basic Normal Plane.
+String WideStringToUtf8(const wchar_t* str, int num_chars) {
+  if (num_chars == -1)
+    num_chars = static_cast<int>(wcslen(str));
+
+  ::std::stringstream stream;
+  for (int i = 0; i < num_chars; ++i) {
+    UInt32 unicode_code_point;
+
+    if (str[i] == L'\0') {
+      break;
+    } else if (i + 1 < num_chars && IsUtf16SurrogatePair(str[i], str[i + 1])) {
+      unicode_code_point = CreateCodePointFromUtf16SurrogatePair(str[i],
+                                                                 str[i + 1]);
+      i++;
+    } else {
+      unicode_code_point = static_cast<UInt32>(str[i]);
+    }
+
+    char buffer[32];  // CodePointToUtf8 requires a buffer this big.
+    stream << CodePointToUtf8(unicode_code_point, buffer);
+  }
+  return StringStreamToString(&stream);
+}
+
+// Converts a wide C string to a String using the UTF-8 encoding.
+// NULL will be converted to "(null)".
+String String::ShowWideCString(const wchar_t * wide_c_str) {
+  if (wide_c_str == NULL) return String("(null)");
+
+  return String(internal::WideStringToUtf8(wide_c_str, -1).c_str());
+}
+
+// Similar to ShowWideCString(), except that this function encloses
+// the converted string in double quotes.
+String String::ShowWideCStringQuoted(const wchar_t* wide_c_str) {
+  if (wide_c_str == NULL) return String("(null)");
+
+  return String::Format("L\"%s\"",
+                        String::ShowWideCString(wide_c_str).c_str());
+}
+
+// Compares two wide C strings.  Returns true iff they have the same
+// content.
+//
+// Unlike wcscmp(), this function can handle NULL argument(s).  A NULL
+// C string is considered different to any non-NULL C string,
+// including the empty string.
+bool String::WideCStringEquals(const wchar_t * lhs, const wchar_t * rhs) {
+  if (lhs == NULL) return rhs == NULL;
+
+  if (rhs == NULL) return false;
+
+  return wcscmp(lhs, rhs) == 0;
+}
+
+// Helper function for *_STREQ on wide strings.
+AssertionResult CmpHelperSTREQ(const char* expected_expression,
+                               const char* actual_expression,
+                               const wchar_t* expected,
+                               const wchar_t* actual) {
+  if (String::WideCStringEquals(expected, actual)) {
+    return AssertionSuccess();
+  }
+
+  return EqFailure(expected_expression,
+                   actual_expression,
+                   String::ShowWideCStringQuoted(expected),
+                   String::ShowWideCStringQuoted(actual),
+                   false);
+}
+
+// Helper function for *_STRNE on wide strings.
+AssertionResult CmpHelperSTRNE(const char* s1_expression,
+                               const char* s2_expression,
+                               const wchar_t* s1,
+                               const wchar_t* s2) {
+  if (!String::WideCStringEquals(s1, s2)) {
+    return AssertionSuccess();
+  }
+
+  return AssertionFailure() << "Expected: (" << s1_expression << ") != ("
+                            << s2_expression << "), actual: "
+                            << String::ShowWideCStringQuoted(s1)
+                            << " vs " << String::ShowWideCStringQuoted(s2);
+}
+
+// Compares two C strings, ignoring case.  Returns true iff they have
+// the same content.
+//
+// Unlike strcasecmp(), this function can handle NULL argument(s).  A
+// NULL C string is considered different to any non-NULL C string,
+// including the empty string.
+bool String::CaseInsensitiveCStringEquals(const char * lhs, const char * rhs) {
+  if (lhs == NULL)
+    return rhs == NULL;
+  if (rhs == NULL)
+    return false;
+  return posix::StrCaseCmp(lhs, rhs) == 0;
+}
+
+  // Compares two wide C strings, ignoring case.  Returns true iff they
+  // have the same content.
+  //
+  // Unlike wcscasecmp(), this function can handle NULL argument(s).
+  // A NULL C string is considered different to any non-NULL wide C string,
+  // including the empty string.
+  // NB: The implementations on different platforms slightly differ.
+  // On windows, this method uses _wcsicmp which compares according to LC_CTYPE
+  // environment variable. On GNU platform this method uses wcscasecmp
+  // which compares according to LC_CTYPE category of the current locale.
+  // On MacOS X, it uses towlower, which also uses LC_CTYPE category of the
+  // current locale.
+bool String::CaseInsensitiveWideCStringEquals(const wchar_t* lhs,
+                                              const wchar_t* rhs) {
+  if (lhs == NULL) return rhs == NULL;
+
+  if (rhs == NULL) return false;
+
+#if GTEST_OS_WINDOWS
+  return _wcsicmp(lhs, rhs) == 0;
+#elif GTEST_OS_LINUX && !GTEST_OS_LINUX_ANDROID
+  return wcscasecmp(lhs, rhs) == 0;
+#else
+  // Android, Mac OS X and Cygwin don't define wcscasecmp.
+  // Other unknown OSes may not define it either.
+  wint_t left, right;
+  do {
+    left = towlower(*lhs++);
+    right = towlower(*rhs++);
+  } while (left && left == right);
+  return left == right;
+#endif  // OS selector
+}
+
+// Compares this with another String.
+// Returns < 0 if this is less than rhs, 0 if this is equal to rhs, or > 0
+// if this is greater than rhs.
+int String::Compare(const String & rhs) const {
+  const char* const lhs_c_str = c_str();
+  const char* const rhs_c_str = rhs.c_str();
+
+  if (lhs_c_str == NULL) {
+    return rhs_c_str == NULL ? 0 : -1;  // NULL < anything except NULL
+  } else if (rhs_c_str == NULL) {
+    return 1;
+  }
+
+  const size_t shorter_str_len =
+      length() <= rhs.length() ? length() : rhs.length();
+  for (size_t i = 0; i != shorter_str_len; i++) {
+    if (lhs_c_str[i] < rhs_c_str[i]) {
+      return -1;
+    } else if (lhs_c_str[i] > rhs_c_str[i]) {
+      return 1;
+    }
+  }
+  return (length() < rhs.length()) ? -1 :
+      (length() > rhs.length()) ? 1 : 0;
+}
+
+// Returns true iff this String ends with the given suffix.  *Any*
+// String is considered to end with a NULL or empty suffix.
+bool String::EndsWith(const char* suffix) const {
+  if (suffix == NULL || CStringEquals(suffix, "")) return true;
+
+  if (c_str() == NULL) return false;
+
+  const size_t this_len = strlen(c_str());
+  const size_t suffix_len = strlen(suffix);
+  return (this_len >= suffix_len) &&
+         CStringEquals(c_str() + this_len - suffix_len, suffix);
+}
+
+// Returns true iff this String ends with the given suffix, ignoring case.
+// Any String is considered to end with a NULL or empty suffix.
+bool String::EndsWithCaseInsensitive(const char* suffix) const {
+  if (suffix == NULL || CStringEquals(suffix, "")) return true;
+
+  if (c_str() == NULL) return false;
+
+  const size_t this_len = strlen(c_str());
+  const size_t suffix_len = strlen(suffix);
+  return (this_len >= suffix_len) &&
+         CaseInsensitiveCStringEquals(c_str() + this_len - suffix_len, suffix);
+}
+
+// Formats a list of arguments to a String, using the same format
+// spec string as for printf.
+//
+// We do not use the StringPrintf class as it is not universally
+// available.
+//
+// The result is limited to 4096 characters (including the tailing 0).
+// If 4096 characters are not enough to format the input, or if
+// there's an error, "<formatting error or buffer exceeded>" is
+// returned.
+String String::Format(const char * format, ...) {
+  va_list args;
+  va_start(args, format);
+
+  char buffer[4096];
+  const int kBufferSize = sizeof(buffer)/sizeof(buffer[0]);
+
+  // MSVC 8 deprecates vsnprintf(), so we want to suppress warning
+  // 4996 (deprecated function) there.
+#ifdef _MSC_VER  // We are using MSVC.
+# pragma warning(push)          // Saves the current warning state.
+# pragma warning(disable:4996)  // Temporarily disables warning 4996.
+
+  const int size = vsnprintf(buffer, kBufferSize, format, args);
+
+# pragma warning(pop)           // Restores the warning state.
+#else  // We are not using MSVC.
+  const int size = vsnprintf(buffer, kBufferSize, format, args);
+#endif  // _MSC_VER
+  va_end(args);
+
+  // vsnprintf()'s behavior is not portable.  When the buffer is not
+  // big enough, it returns a negative value in MSVC, and returns the
+  // needed buffer size on Linux.  When there is an output error, it
+  // always returns a negative value.  For simplicity, we lump the two
+  // error cases together.
+  if (size < 0 || size >= kBufferSize) {
+    return String("<formatting error or buffer exceeded>");
+  } else {
+    return String(buffer, size);
+  }
+}
+
+// Converts the buffer in a stringstream to a String, converting NUL
+// bytes to "\\0" along the way.
+String StringStreamToString(::std::stringstream* ss) {
+  const ::std::string& str = ss->str();
+  const char* const start = str.c_str();
+  const char* const end = start + str.length();
+
+  // We need to use a helper stringstream to do this transformation
+  // because String doesn't support push_back().
+  ::std::stringstream helper;
+  for (const char* ch = start; ch != end; ++ch) {
+    if (*ch == '\0') {
+      helper << "\\0";  // Replaces NUL with "\\0";
+    } else {
+      helper.put(*ch);
+    }
+  }
+
+  return String(helper.str().c_str());
+}
+
+// Appends the user-supplied message to the Google-Test-generated message.
+String AppendUserMessage(const String& gtest_msg,
+                         const Message& user_msg) {
+  // Appends the user message if it's non-empty.
+  const String user_msg_string = user_msg.GetString();
+  if (user_msg_string.empty()) {
+    return gtest_msg;
+  }
+
+  Message msg;
+  msg << gtest_msg << "\n" << user_msg_string;
+
+  return msg.GetString();
+}
+
+}  // namespace internal
+
+// class TestResult
+
+// Creates an empty TestResult.
+TestResult::TestResult()
+    : death_test_count_(0),
+      elapsed_time_(0) {
+}
+
+// D'tor.
+TestResult::~TestResult() {
+}
+
+// Returns the i-th test part result among all the results. i can
+// range from 0 to total_part_count() - 1. If i is not in that range,
+// aborts the program.
+const TestPartResult& TestResult::GetTestPartResult(int i) const {
+  if (i < 0 || i >= total_part_count())
+    internal::posix::Abort();
+  return test_part_results_.at(i);
+}
+
+// Returns the i-th test property. i can range from 0 to
+// test_property_count() - 1. If i is not in that range, aborts the
+// program.
+const TestProperty& TestResult::GetTestProperty(int i) const {
+  if (i < 0 || i >= test_property_count())
+    internal::posix::Abort();
+  return test_properties_.at(i);
+}
+
+// Clears the test part results.
+void TestResult::ClearTestPartResults() {
+  test_part_results_.clear();
+}
+
+// Adds a test part result to the list.
+void TestResult::AddTestPartResult(const TestPartResult& test_part_result) {
+  test_part_results_.push_back(test_part_result);
+}
+
+// Adds a test property to the list. If a property with the same key as the
+// supplied property is already represented, the value of this test_property
+// replaces the old value for that key.
+void TestResult::RecordProperty(const TestProperty& test_property) {
+  if (!ValidateTestProperty(test_property)) {
+    return;
+  }
+  internal::MutexLock lock(&test_properites_mutex_);
+  const std::vector<TestProperty>::iterator property_with_matching_key =
+      std::find_if(test_properties_.begin(), test_properties_.end(),
+                   internal::TestPropertyKeyIs(test_property.key()));
+  if (property_with_matching_key == test_properties_.end()) {
+    test_properties_.push_back(test_property);
+    return;
+  }
+  property_with_matching_key->SetValue(test_property.value());
+}
+
+// Adds a failure if the key is a reserved attribute of Google Test
+// testcase tags.  Returns true if the property is valid.
+bool TestResult::ValidateTestProperty(const TestProperty& test_property) {
+  internal::String key(test_property.key());
+  if (key == "name" || key == "status" || key == "time" || key == "classname") {
+    ADD_FAILURE()
+        << "Reserved key used in RecordProperty(): "
+        << key
+        << " ('name', 'status', 'time', and 'classname' are reserved by "
+        << GTEST_NAME_ << ")";
+    return false;
+  }
+  return true;
+}
+
+// Clears the object.
+void TestResult::Clear() {
+  test_part_results_.clear();
+  test_properties_.clear();
+  death_test_count_ = 0;
+  elapsed_time_ = 0;
+}
+
+// Returns true iff the test failed.
+bool TestResult::Failed() const {
+  for (int i = 0; i < total_part_count(); ++i) {
+    if (GetTestPartResult(i).failed())
+      return true;
+  }
+  return false;
+}
+
+// Returns true iff the test part fatally failed.
+static bool TestPartFatallyFailed(const TestPartResult& result) {
+  return result.fatally_failed();
+}
+
+// Returns true iff the test fatally failed.
+bool TestResult::HasFatalFailure() const {
+  return CountIf(test_part_results_, TestPartFatallyFailed) > 0;
+}
+
+// Returns true iff the test part non-fatally failed.
+static bool TestPartNonfatallyFailed(const TestPartResult& result) {
+  return result.nonfatally_failed();
+}
+
+// Returns true iff the test has a non-fatal failure.
+bool TestResult::HasNonfatalFailure() const {
+  return CountIf(test_part_results_, TestPartNonfatallyFailed) > 0;
+}
+
+// Gets the number of all test parts.  This is the sum of the number
+// of successful test parts and the number of failed test parts.
+int TestResult::total_part_count() const {
+  return static_cast<int>(test_part_results_.size());
+}
+
+// Returns the number of the test properties.
+int TestResult::test_property_count() const {
+  return static_cast<int>(test_properties_.size());
+}
+
+// class Test
+
+// Creates a Test object.
+
+// The c'tor saves the values of all Google Test flags.
+Test::Test()
+    : gtest_flag_saver_(new internal::GTestFlagSaver) {
+}
+
+// The d'tor restores the values of all Google Test flags.
+Test::~Test() {
+  delete gtest_flag_saver_;
+}
+
+// Sets up the test fixture.
+//
+// A sub-class may override this.
+void Test::SetUp() {
+}
+
+// Tears down the test fixture.
+//
+// A sub-class may override this.
+void Test::TearDown() {
+}
+
+// Allows user supplied key value pairs to be recorded for later output.
+void Test::RecordProperty(const char* key, const char* value) {
+  UnitTest::GetInstance()->RecordPropertyForCurrentTest(key, value);
+}
+
+// Allows user supplied key value pairs to be recorded for later output.
+void Test::RecordProperty(const char* key, int value) {
+  Message value_message;
+  value_message << value;
+  RecordProperty(key, value_message.GetString().c_str());
+}
+
+namespace internal {
+
+void ReportFailureInUnknownLocation(TestPartResult::Type result_type,
+                                    const String& message) {
+  // This function is a friend of UnitTest and as such has access to
+  // AddTestPartResult.
+  UnitTest::GetInstance()->AddTestPartResult(
+      result_type,
+      NULL,  // No info about the source file where the exception occurred.
+      -1,    // We have no info on which line caused the exception.
+      message,
+      String());  // No stack trace, either.
+}
+
+}  // namespace internal
+
+// Google Test requires all tests in the same test case to use the same test
+// fixture class.  This function checks if the current test has the
+// same fixture class as the first test in the current test case.  If
+// yes, it returns true; otherwise it generates a Google Test failure and
+// returns false.
+bool Test::HasSameFixtureClass() {
+  internal::UnitTestImpl* const impl = internal::GetUnitTestImpl();
+  const TestCase* const test_case = impl->current_test_case();
+
+  // Info about the first test in the current test case.
+  const TestInfo* const first_test_info = test_case->test_info_list()[0];
+  const internal::TypeId first_fixture_id = first_test_info->fixture_class_id_;
+  const char* const first_test_name = first_test_info->name();
+
+  // Info about the current test.
+  const TestInfo* const this_test_info = impl->current_test_info();
+  const internal::TypeId this_fixture_id = this_test_info->fixture_class_id_;
+  const char* const this_test_name = this_test_info->name();
+
+  if (this_fixture_id != first_fixture_id) {
+    // Is the first test defined using TEST?
+    const bool first_is_TEST = first_fixture_id == internal::GetTestTypeId();
+    // Is this test defined using TEST?
+    const bool this_is_TEST = this_fixture_id == internal::GetTestTypeId();
+
+    if (first_is_TEST || this_is_TEST) {
+      // The user mixed TEST and TEST_F in this test case - we'll tell
+      // him/her how to fix it.
+
+      // Gets the name of the TEST and the name of the TEST_F.  Note
+      // that first_is_TEST and this_is_TEST cannot both be true, as
+      // the fixture IDs are different for the two tests.
+      const char* const TEST_name =
+          first_is_TEST ? first_test_name : this_test_name;
+      const char* const TEST_F_name =
+          first_is_TEST ? this_test_name : first_test_name;
+
+      ADD_FAILURE()
+          << "All tests in the same test case must use the same test fixture\n"
+          << "class, so mixing TEST_F and TEST in the same test case is\n"
+          << "illegal.  In test case " << this_test_info->test_case_name()
+          << ",\n"
+          << "test " << TEST_F_name << " is defined using TEST_F but\n"
+          << "test " << TEST_name << " is defined using TEST.  You probably\n"
+          << "want to change the TEST to TEST_F or move it to another test\n"
+          << "case.";
+    } else {
+      // The user defined two fixture classes with the same name in
+      // two namespaces - we'll tell him/her how to fix it.
+      ADD_FAILURE()
+          << "All tests in the same test case must use the same test fixture\n"
+          << "class.  However, in test case "
+          << this_test_info->test_case_name() << ",\n"
+          << "you defined test " << first_test_name
+          << " and test " << this_test_name << "\n"
+          << "using two different test fixture classes.  This can happen if\n"
+          << "the two classes are from different namespaces or translation\n"
+          << "units and have the same name.  You should probably rename one\n"
+          << "of the classes to put the tests into different test cases.";
+    }
+    return false;
+  }
+
+  return true;
+}
+
+#if GTEST_HAS_SEH
+
+// Adds an "exception thrown" fatal failure to the current test.  This
+// function returns its result via an output parameter pointer because VC++
+// prohibits creation of objects with destructors on stack in functions
+// using __try (see error C2712).
+static internal::String* FormatSehExceptionMessage(DWORD exception_code,
+                                                   const char* location) {
+  Message message;
+  message << "SEH exception with code 0x" << std::setbase(16) <<
+    exception_code << std::setbase(10) << " thrown in " << location << ".";
+
+  return new internal::String(message.GetString());
+}
+
+#endif  // GTEST_HAS_SEH
+
+#if GTEST_HAS_EXCEPTIONS
+
+// Adds an "exception thrown" fatal failure to the current test.
+static internal::String FormatCxxExceptionMessage(const char* description,
+                                                  const char* location) {
+  Message message;
+  if (description != NULL) {
+    message << "C++ exception with description \"" << description << "\"";
+  } else {
+    message << "Unknown C++ exception";
+  }
+  message << " thrown in " << location << ".";
+
+  return message.GetString();
+}
+
+static internal::String PrintTestPartResultToString(
+    const TestPartResult& test_part_result);
+
+// A failed Google Test assertion will throw an exception of this type when
+// GTEST_FLAG(throw_on_failure) is true (if exceptions are enabled).  We
+// derive it from std::runtime_error, which is for errors presumably
+// detectable only at run time.  Since std::runtime_error inherits from
+// std::exception, many testing frameworks know how to extract and print the
+// message inside it.
+class GoogleTestFailureException : public ::std::runtime_error {
+ public:
+  explicit GoogleTestFailureException(const TestPartResult& failure)
+      : ::std::runtime_error(PrintTestPartResultToString(failure).c_str()) {}
+};
+#endif  // GTEST_HAS_EXCEPTIONS
+
+namespace internal {
+// We put these helper functions in the internal namespace as IBM's xlC
+// compiler rejects the code if they were declared static.
+
+// Runs the given method and handles SEH exceptions it throws, when
+// SEH is supported; returns the 0-value for type Result in case of an
+// SEH exception.  (Microsoft compilers cannot handle SEH and C++
+// exceptions in the same function.  Therefore, we provide a separate
+// wrapper function for handling SEH exceptions.)
+template <class T, typename Result>
+Result HandleSehExceptionsInMethodIfSupported(
+    T* object, Result (T::*method)(), const char* location) {
+#if GTEST_HAS_SEH
+  __try {
+    return (object->*method)();
+  } __except (internal::UnitTestOptions::GTestShouldProcessSEH(  // NOLINT
+      GetExceptionCode())) {
+    // We create the exception message on the heap because VC++ prohibits
+    // creation of objects with destructors on stack in functions using __try
+    // (see error C2712).
+    internal::String* exception_message = FormatSehExceptionMessage(
+        GetExceptionCode(), location);
+    internal::ReportFailureInUnknownLocation(TestPartResult::kFatalFailure,
+                                             *exception_message);
+    delete exception_message;
+    return static_cast<Result>(0);
+  }
+#else
+  (void)location;
+  return (object->*method)();
+#endif  // GTEST_HAS_SEH
+}
+
+// Runs the given method and catches and reports C++ and/or SEH-style
+// exceptions, if they are supported; returns the 0-value for type
+// Result in case of an SEH exception.
+template <class T, typename Result>
+Result HandleExceptionsInMethodIfSupported(
+    T* object, Result (T::*method)(), const char* location) {
+  // NOTE: The user code can affect the way in which Google Test handles
+  // exceptions by setting GTEST_FLAG(catch_exceptions), but only before
+  // RUN_ALL_TESTS() starts. It is technically possible to check the flag
+  // after the exception is caught and either report or re-throw the
+  // exception based on the flag's value:
+  //
+  // try {
+  //   // Perform the test method.
+  // } catch (...) {
+  //   if (GTEST_FLAG(catch_exceptions))
+  //     // Report the exception as failure.
+  //   else
+  //     throw;  // Re-throws the original exception.
+  // }
+  //
+  // However, the purpose of this flag is to allow the program to drop into
+  // the debugger when the exception is thrown. On most platforms, once the
+  // control enters the catch block, the exception origin information is
+  // lost and the debugger will stop the program at the point of the
+  // re-throw in this function -- instead of at the point of the original
+  // throw statement in the code under test.  For this reason, we perform
+  // the check early, sacrificing the ability to affect Google Test's
+  // exception handling in the method where the exception is thrown.
+  if (internal::GetUnitTestImpl()->catch_exceptions()) {
+#if GTEST_HAS_EXCEPTIONS
+    try {
+      return HandleSehExceptionsInMethodIfSupported(object, method, location);
+    } catch (const GoogleTestFailureException&) {  // NOLINT
+      // This exception doesn't originate in code under test. It makes no
+      // sense to report it as a test failure.
+      throw;
+    } catch (const std::exception& e) {  // NOLINT
+      internal::ReportFailureInUnknownLocation(
+          TestPartResult::kFatalFailure,
+          FormatCxxExceptionMessage(e.what(), location));
+    } catch (...) {  // NOLINT
+      internal::ReportFailureInUnknownLocation(
+          TestPartResult::kFatalFailure,
+          FormatCxxExceptionMessage(NULL, location));
+    }
+    return static_cast<Result>(0);
+#else
+    return HandleSehExceptionsInMethodIfSupported(object, method, location);
+#endif  // GTEST_HAS_EXCEPTIONS
+  } else {
+    return (object->*method)();
+  }
+}
+
+}  // namespace internal
+
+// Runs the test and updates the test result.
+void Test::Run() {
+  if (!HasSameFixtureClass()) return;
+
+  internal::UnitTestImpl* const impl = internal::GetUnitTestImpl();
+  impl->os_stack_trace_getter()->UponLeavingGTest();
+  internal::HandleExceptionsInMethodIfSupported(this, &Test::SetUp, "SetUp()");
+  // We will run the test only if SetUp() was successful.
+  if (!HasFatalFailure()) {
+    impl->os_stack_trace_getter()->UponLeavingGTest();
+    internal::HandleExceptionsInMethodIfSupported(
+        this, &Test::TestBody, "the test body");
+  }
+
+  // However, we want to clean up as much as possible.  Hence we will
+  // always call TearDown(), even if SetUp() or the test body has
+  // failed.
+  impl->os_stack_trace_getter()->UponLeavingGTest();
+  internal::HandleExceptionsInMethodIfSupported(
+      this, &Test::TearDown, "TearDown()");
+}
+
+// Returns true iff the current test has a fatal failure.
+bool Test::HasFatalFailure() {
+  return internal::GetUnitTestImpl()->current_test_result()->HasFatalFailure();
+}
+
+// Returns true iff the current test has a non-fatal failure.
+bool Test::HasNonfatalFailure() {
+  return internal::GetUnitTestImpl()->current_test_result()->
+      HasNonfatalFailure();
+}
+
+// class TestInfo
+
+// Constructs a TestInfo object. It assumes ownership of the test factory
+// object.
+// TODO(vladl@google.com): Make a_test_case_name and a_name const string&'s
+// to signify they cannot be NULLs.
+TestInfo::TestInfo(const char* a_test_case_name,
+                   const char* a_name,
+                   const char* a_type_param,
+                   const char* a_value_param,
+                   internal::TypeId fixture_class_id,
+                   internal::TestFactoryBase* factory)
+    : test_case_name_(a_test_case_name),
+      name_(a_name),
+      type_param_(a_type_param ? new std::string(a_type_param) : NULL),
+      value_param_(a_value_param ? new std::string(a_value_param) : NULL),
+      fixture_class_id_(fixture_class_id),
+      should_run_(false),
+      is_disabled_(false),
+      matches_filter_(false),
+      factory_(factory),
+      result_() {}
+
+// Destructs a TestInfo object.
+TestInfo::~TestInfo() { delete factory_; }
+
+namespace internal {
+
+// Creates a new TestInfo object and registers it with Google Test;
+// returns the created object.
+//
+// Arguments:
+//
+//   test_case_name:   name of the test case
+//   name:             name of the test
+//   type_param:       the name of the test's type parameter, or NULL if
+//                     this is not a typed or a type-parameterized test.
+//   value_param:      text representation of the test's value parameter,
+//                     or NULL if this is not a value-parameterized test.
+//   fixture_class_id: ID of the test fixture class
+//   set_up_tc:        pointer to the function that sets up the test case
+//   tear_down_tc:     pointer to the function that tears down the test case
+//   factory:          pointer to the factory that creates a test object.
+//                     The newly created TestInfo instance will assume
+//                     ownership of the factory object.
+TestInfo* MakeAndRegisterTestInfo(
+    const char* test_case_name, const char* name,
+    const char* type_param,
+    const char* value_param,
+    TypeId fixture_class_id,
+    SetUpTestCaseFunc set_up_tc,
+    TearDownTestCaseFunc tear_down_tc,
+    TestFactoryBase* factory) {
+  TestInfo* const test_info =
+      new TestInfo(test_case_name, name, type_param, value_param,
+                   fixture_class_id, factory);
+  GetUnitTestImpl()->AddTestInfo(set_up_tc, tear_down_tc, test_info);
+  return test_info;
+}
+
+#if GTEST_HAS_PARAM_TEST
+void ReportInvalidTestCaseType(const char* test_case_name,
+                               const char* file, int line) {
+  Message errors;
+  errors
+      << "Attempted redefinition of test case " << test_case_name << ".\n"
+      << "All tests in the same test case must use the same test fixture\n"
+      << "class.  However, in test case " << test_case_name << ", you tried\n"
+      << "to define a test using a fixture class different from the one\n"
+      << "used earlier. This can happen if the two fixture classes are\n"
+      << "from different namespaces and have the same name. You should\n"
+      << "probably rename one of the classes to put the tests into different\n"
+      << "test cases.";
+
+  fprintf(stderr, "%s %s", FormatFileLocation(file, line).c_str(),
+          errors.GetString().c_str());
+}
+#endif  // GTEST_HAS_PARAM_TEST
+
+}  // namespace internal
+
+namespace {
+
+// A predicate that checks the test name of a TestInfo against a known
+// value.
+//
+// This is used for implementation of the TestCase class only.  We put
+// it in the anonymous namespace to prevent polluting the outer
+// namespace.
+//
+// TestNameIs is copyable.
+class TestNameIs {
+ public:
+  // Constructor.
+  //
+  // TestNameIs has NO default constructor.
+  explicit TestNameIs(const char* name)
+      : name_(name) {}
+
+  // Returns true iff the test name of test_info matches name_.
+  bool operator()(const TestInfo * test_info) const {
+    return test_info && internal::String(test_info->name()).Compare(name_) == 0;
+  }
+
+ private:
+  internal::String name_;
+};
+
+}  // namespace
+
+namespace internal {
+
+// This method expands all parameterized tests registered with macros TEST_P
+// and INSTANTIATE_TEST_CASE_P into regular tests and registers those.
+// This will be done just once during the program runtime.
+void UnitTestImpl::RegisterParameterizedTests() {
+#if GTEST_HAS_PARAM_TEST
+  if (!parameterized_tests_registered_) {
+    parameterized_test_registry_.RegisterTests();
+    parameterized_tests_registered_ = true;
+  }
+#endif
+}
+
+}  // namespace internal
+
+// Creates the test object, runs it, records its result, and then
+// deletes it.
+void TestInfo::Run() {
+  if (!should_run_) return;
+
+  // Tells UnitTest where to store test result.
+  internal::UnitTestImpl* const impl = internal::GetUnitTestImpl();
+  impl->set_current_test_info(this);
+
+  TestEventListener* repeater = UnitTest::GetInstance()->listeners().repeater();
+
+  // Notifies the unit test event listeners that a test is about to start.
+  repeater->OnTestStart(*this);
+
+  const TimeInMillis start = internal::GetTimeInMillis();
+
+  impl->os_stack_trace_getter()->UponLeavingGTest();
+
+  // Creates the test object.
+  Test* const test = internal::HandleExceptionsInMethodIfSupported(
+      factory_, &internal::TestFactoryBase::CreateTest,
+      "the test fixture's constructor");
+
+  // Runs the test only if the test object was created and its
+  // constructor didn't generate a fatal failure.
+  if ((test != NULL) && !Test::HasFatalFailure()) {
+    // This doesn't throw as all user code that can throw are wrapped into
+    // exception handling code.
+    test->Run();
+  }
+
+  // Deletes the test object.
+  impl->os_stack_trace_getter()->UponLeavingGTest();
+  internal::HandleExceptionsInMethodIfSupported(
+      test, &Test::DeleteSelf_, "the test fixture's destructor");
+
+  result_.set_elapsed_time(internal::GetTimeInMillis() - start);
+
+  // Notifies the unit test event listener that a test has just finished.
+  repeater->OnTestEnd(*this);
+
+  // Tells UnitTest to stop associating assertion results to this
+  // test.
+  impl->set_current_test_info(NULL);
+}
+
+// class TestCase
+
+// Gets the number of successful tests in this test case.
+int TestCase::successful_test_count() const {
+  return CountIf(test_info_list_, TestPassed);
+}
+
+// Gets the number of failed tests in this test case.
+int TestCase::failed_test_count() const {
+  return CountIf(test_info_list_, TestFailed);
+}
+
+int TestCase::disabled_test_count() const {
+  return CountIf(test_info_list_, TestDisabled);
+}
+
+// Get the number of tests in this test case that should run.
+int TestCase::test_to_run_count() const {
+  return CountIf(test_info_list_, ShouldRunTest);
+}
+
+// Gets the number of all tests.
+int TestCase::total_test_count() const {
+  return static_cast<int>(test_info_list_.size());
+}
+
+// Creates a TestCase with the given name.
+//
+// Arguments:
+//
+//   name:         name of the test case
+//   a_type_param: the name of the test case's type parameter, or NULL if
+//                 this is not a typed or a type-parameterized test case.
+//   set_up_tc:    pointer to the function that sets up the test case
+//   tear_down_tc: pointer to the function that tears down the test case
+TestCase::TestCase(const char* a_name, const char* a_type_param,
+                   Test::SetUpTestCaseFunc set_up_tc,
+                   Test::TearDownTestCaseFunc tear_down_tc)
+    : name_(a_name),
+      type_param_(a_type_param ? new std::string(a_type_param) : NULL),
+      set_up_tc_(set_up_tc),
+      tear_down_tc_(tear_down_tc),
+      should_run_(false),
+      elapsed_time_(0) {
+}
+
+// Destructor of TestCase.
+TestCase::~TestCase() {
+  // Deletes every Test in the collection.
+  ForEach(test_info_list_, internal::Delete<TestInfo>);
+}
+
+// Returns the i-th test among all the tests. i can range from 0 to
+// total_test_count() - 1. If i is not in that range, returns NULL.
+const TestInfo* TestCase::GetTestInfo(int i) const {
+  const int index = GetElementOr(test_indices_, i, -1);
+  return index < 0 ? NULL : test_info_list_[index];
+}
+
+// Returns the i-th test among all the tests. i can range from 0 to
+// total_test_count() - 1. If i is not in that range, returns NULL.
+TestInfo* TestCase::GetMutableTestInfo(int i) {
+  const int index = GetElementOr(test_indices_, i, -1);
+  return index < 0 ? NULL : test_info_list_[index];
+}
+
+// Adds a test to this test case.  Will delete the test upon
+// destruction of the TestCase object.
+void TestCase::AddTestInfo(TestInfo * test_info) {
+  test_info_list_.push_back(test_info);
+  test_indices_.push_back(static_cast<int>(test_indices_.size()));
+}
+
+// Runs every test in this TestCase.
+void TestCase::Run() {
+  if (!should_run_) return;
+
+  internal::UnitTestImpl* const impl = internal::GetUnitTestImpl();
+  impl->set_current_test_case(this);
+
+  TestEventListener* repeater = UnitTest::GetInstance()->listeners().repeater();
+
+  repeater->OnTestCaseStart(*this);
+  impl->os_stack_trace_getter()->UponLeavingGTest();
+  internal::HandleExceptionsInMethodIfSupported(
+      this, &TestCase::RunSetUpTestCase, "SetUpTestCase()");
+
+  const internal::TimeInMillis start = internal::GetTimeInMillis();
+  for (int i = 0; i < total_test_count(); i++) {
+    GetMutableTestInfo(i)->Run();
+  }
+  elapsed_time_ = internal::GetTimeInMillis() - start;
+
+  impl->os_stack_trace_getter()->UponLeavingGTest();
+  internal::HandleExceptionsInMethodIfSupported(
+      this, &TestCase::RunTearDownTestCase, "TearDownTestCase()");
+
+  repeater->OnTestCaseEnd(*this);
+  impl->set_current_test_case(NULL);
+}
+
+// Clears the results of all tests in this test case.
+void TestCase::ClearResult() {
+  ForEach(test_info_list_, TestInfo::ClearTestResult);
+}
+
+// Shuffles the tests in this test case.
+void TestCase::ShuffleTests(internal::Random* random) {
+  Shuffle(random, &test_indices_);
+}
+
+// Restores the test order to before the first shuffle.
+void TestCase::UnshuffleTests() {
+  for (size_t i = 0; i < test_indices_.size(); i++) {
+    test_indices_[i] = static_cast<int>(i);
+  }
+}
+
+// Formats a countable noun.  Depending on its quantity, either the
+// singular form or the plural form is used. e.g.
+//
+// FormatCountableNoun(1, "formula", "formuli") returns "1 formula".
+// FormatCountableNoun(5, "book", "books") returns "5 books".
+static internal::String FormatCountableNoun(int count,
+                                            const char * singular_form,
+                                            const char * plural_form) {
+  return internal::String::Format("%d %s", count,
+                                  count == 1 ? singular_form : plural_form);
+}
+
+// Formats the count of tests.
+static internal::String FormatTestCount(int test_count) {
+  return FormatCountableNoun(test_count, "test", "tests");
+}
+
+// Formats the count of test cases.
+static internal::String FormatTestCaseCount(int test_case_count) {
+  return FormatCountableNoun(test_case_count, "test case", "test cases");
+}
+
+// Converts a TestPartResult::Type enum to human-friendly string
+// representation.  Both kNonFatalFailure and kFatalFailure are translated
+// to "Failure", as the user usually doesn't care about the difference
+// between the two when viewing the test result.
+static const char * TestPartResultTypeToString(TestPartResult::Type type) {
+  switch (type) {
+    case TestPartResult::kSuccess:
+      return "Success";
+
+    case TestPartResult::kNonFatalFailure:
+    case TestPartResult::kFatalFailure:
+#ifdef _MSC_VER
+      return "error: ";
+#else
+      return "Failure\n";
+#endif
+    default:
+      return "Unknown result type";
+  }
+}
+
+// Prints a TestPartResult to a String.
+static internal::String PrintTestPartResultToString(
+    const TestPartResult& test_part_result) {
+  return (Message()
+          << internal::FormatFileLocation(test_part_result.file_name(),
+                                          test_part_result.line_number())
+          << " " << TestPartResultTypeToString(test_part_result.type())
+          << test_part_result.message()).GetString();
+}
+
+// Prints a TestPartResult.
+static void PrintTestPartResult(const TestPartResult& test_part_result) {
+  const internal::String& result =
+      PrintTestPartResultToString(test_part_result);
+  printf("%s\n", result.c_str());
+  fflush(stdout);
+  // If the test program runs in Visual Studio or a debugger, the
+  // following statements add the test part result message to the Output
+  // window such that the user can double-click on it to jump to the
+  // corresponding source code location; otherwise they do nothing.
+#if GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MOBILE
+  // We don't call OutputDebugString*() on Windows Mobile, as printing
+  // to stdout is done by OutputDebugString() there already - we don't
+  // want the same message printed twice.
+  ::OutputDebugStringA(result.c_str());
+  ::OutputDebugStringA("\n");
+#endif
+}
+
+// class PrettyUnitTestResultPrinter
+
+namespace internal {
+
+enum GTestColor {
+  COLOR_DEFAULT,
+  COLOR_RED,
+  COLOR_GREEN,
+  COLOR_YELLOW
+};
+
+#if GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MOBILE
+
+// Returns the character attribute for the given color.
+WORD GetColorAttribute(GTestColor color) {
+  switch (color) {
+    case COLOR_RED:    return FOREGROUND_RED;
+    case COLOR_GREEN:  return FOREGROUND_GREEN;
+    case COLOR_YELLOW: return FOREGROUND_RED | FOREGROUND_GREEN;
+    default:           return 0;
+  }
+}
+
+#else
+
+// Returns the ANSI color code for the given color.  COLOR_DEFAULT is
+// an invalid input.
+const char* GetAnsiColorCode(GTestColor color) {
+  switch (color) {
+    case COLOR_RED:     return "1";
+    case COLOR_GREEN:   return "2";
+    case COLOR_YELLOW:  return "3";
+    default:            return NULL;
+  };
+}
+
+#endif  // GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MOBILE
+
+// Returns true iff Google Test should use colors in the output.
+bool ShouldUseColor(bool stdout_is_tty) {
+  const char* const gtest_color = GTEST_FLAG(color).c_str();
+
+  if (String::CaseInsensitiveCStringEquals(gtest_color, "auto")) {
+#if GTEST_OS_WINDOWS
+    // On Windows the TERM variable is usually not set, but the
+    // console there does support colors.
+    return stdout_is_tty;
+#else
+    // On non-Windows platforms, we rely on the TERM variable.
+    const char* const term = posix::GetEnv("TERM");
+    const bool term_supports_color =
+        String::CStringEquals(term, "xterm") ||
+        String::CStringEquals(term, "xterm-color") ||
+        String::CStringEquals(term, "xterm-256color") ||
+        String::CStringEquals(term, "screen") ||
+        String::CStringEquals(term, "linux") ||
+        String::CStringEquals(term, "cygwin");
+    return stdout_is_tty && term_supports_color;
+#endif  // GTEST_OS_WINDOWS
+  }
+
+  return String::CaseInsensitiveCStringEquals(gtest_color, "yes") ||
+      String::CaseInsensitiveCStringEquals(gtest_color, "true") ||
+      String::CaseInsensitiveCStringEquals(gtest_color, "t") ||
+      String::CStringEquals(gtest_color, "1");
+  // We take "yes", "true", "t", and "1" as meaning "yes".  If the
+  // value is neither one of these nor "auto", we treat it as "no" to
+  // be conservative.
+}
+
+// Helpers for printing colored strings to stdout. Note that on Windows, we
+// cannot simply emit special characters and have the terminal change colors.
+// This routine must actually emit the characters rather than return a string
+// that would be colored when printed, as can be done on Linux.
+void ColoredPrintf(GTestColor color, const char* fmt, ...) {
+  va_list args;
+  va_start(args, fmt);
+
+#if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_SYMBIAN || GTEST_OS_ZOS
+  const bool use_color = false;
+#else
+  static const bool in_color_mode =
+      ShouldUseColor(posix::IsATTY(posix::FileNo(stdout)) != 0);
+  const bool use_color = in_color_mode && (color != COLOR_DEFAULT);
+#endif  // GTEST_OS_WINDOWS_MOBILE || GTEST_OS_SYMBIAN || GTEST_OS_ZOS
+  // The '!= 0' comparison is necessary to satisfy MSVC 7.1.
+
+  if (!use_color) {
+    vprintf(fmt, args);
+    va_end(args);
+    return;
+  }
+
+#if GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MOBILE
+  const HANDLE stdout_handle = GetStdHandle(STD_OUTPUT_HANDLE);
+
+  // Gets the current text color.
+  CONSOLE_SCREEN_BUFFER_INFO buffer_info;
+  GetConsoleScreenBufferInfo(stdout_handle, &buffer_info);
+  const WORD old_color_attrs = buffer_info.wAttributes;
+
+  // We need to flush the stream buffers into the console before each
+  // SetConsoleTextAttribute call lest it affect the text that is already
+  // printed but has not yet reached the console.
+  fflush(stdout);
+  SetConsoleTextAttribute(stdout_handle,
+                          GetColorAttribute(color) | FOREGROUND_INTENSITY);
+  vprintf(fmt, args);
+
+  fflush(stdout);
+  // Restores the text color.
+  SetConsoleTextAttribute(stdout_handle, old_color_attrs);
+#else
+  printf("\033[0;3%sm", GetAnsiColorCode(color));
+  vprintf(fmt, args);
+  printf("\033[m");  // Resets the terminal to default.
+#endif  // GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_MOBILE
+  va_end(args);
+}
+
+void PrintFullTestCommentIfPresent(const TestInfo& test_info) {
+  const char* const type_param = test_info.type_param();
+  const char* const value_param = test_info.value_param();
+
+  if (type_param != NULL || value_param != NULL) {
+    printf(", where ");
+    if (type_param != NULL) {
+      printf("TypeParam = %s", type_param);
+      if (value_param != NULL)
+        printf(" and ");
+    }
+    if (value_param != NULL) {
+      printf("GetParam() = %s", value_param);
+    }
+  }
+}
+
+// This class implements the TestEventListener interface.
+//
+// Class PrettyUnitTestResultPrinter is copyable.
+class PrettyUnitTestResultPrinter : public TestEventListener {
+ public:
+  PrettyUnitTestResultPrinter() {}
+  static void PrintTestName(const char * test_case, const char * test) {
+    printf("%s.%s", test_case, test);
+  }
+
+  // The following methods override what's in the TestEventListener class.
+  virtual void OnTestProgramStart(const UnitTest& /*unit_test*/) {}
+  virtual void OnTestIterationStart(const UnitTest& unit_test, int iteration);
+  virtual void OnEnvironmentsSetUpStart(const UnitTest& unit_test);
+  virtual void OnEnvironmentsSetUpEnd(const UnitTest& /*unit_test*/) {}
+  virtual void OnTestCaseStart(const TestCase& test_case);
+  virtual void OnTestStart(const TestInfo& test_info);
+  virtual void OnTestPartResult(const TestPartResult& result);
+  virtual void OnTestEnd(const TestInfo& test_info);
+  virtual void OnTestCaseEnd(const TestCase& test_case);
+  virtual void OnEnvironmentsTearDownStart(const UnitTest& unit_test);
+  virtual void OnEnvironmentsTearDownEnd(const UnitTest& /*unit_test*/) {}
+  virtual void OnTestIterationEnd(const UnitTest& unit_test, int iteration);
+  virtual void OnTestProgramEnd(const UnitTest& /*unit_test*/) {}
+
+ private:
+  static void PrintFailedTests(const UnitTest& unit_test);
+
+  internal::String test_case_name_;
+};
+
+  // Fired before each iteration of tests starts.
+void PrettyUnitTestResultPrinter::OnTestIterationStart(
+    const UnitTest& unit_test, int iteration) {
+  if (GTEST_FLAG(repeat) != 1)
+    printf("\nRepeating all tests (iteration %d) . . .\n\n", iteration + 1);
+
+  const char* const filter = GTEST_FLAG(filter).c_str();
+
+  // Prints the filter if it's not *.  This reminds the user that some
+  // tests may be skipped.
+  if (!internal::String::CStringEquals(filter, kUniversalFilter)) {
+    ColoredPrintf(COLOR_YELLOW,
+                  "Note: %s filter = %s\n", GTEST_NAME_, filter);
+  }
+
+  if (internal::ShouldShard(kTestTotalShards, kTestShardIndex, false)) {
+    const Int32 shard_index = Int32FromEnvOrDie(kTestShardIndex, -1);
+    ColoredPrintf(COLOR_YELLOW,
+                  "Note: This is test shard %d of %s.\n",
+                  static_cast<int>(shard_index) + 1,
+                  internal::posix::GetEnv(kTestTotalShards));
+  }
+
+  if (GTEST_FLAG(shuffle)) {
+    ColoredPrintf(COLOR_YELLOW,
+                  "Note: Randomizing tests' orders with a seed of %d .\n",
+                  unit_test.random_seed());
+  }
+
+  ColoredPrintf(COLOR_GREEN,  "[==========] ");
+  printf("Running %s from %s.\n",
+         FormatTestCount(unit_test.test_to_run_count()).c_str(),
+         FormatTestCaseCount(unit_test.test_case_to_run_count()).c_str());
+  fflush(stdout);
+}
+
+void PrettyUnitTestResultPrinter::OnEnvironmentsSetUpStart(
+    const UnitTest& /*unit_test*/) {
+  ColoredPrintf(COLOR_GREEN,  "[----------] ");
+  printf("Global test environment set-up.\n");
+  fflush(stdout);
+}
+
+void PrettyUnitTestResultPrinter::OnTestCaseStart(const TestCase& test_case) {
+  test_case_name_ = test_case.name();
+  const internal::String counts =
+      FormatCountableNoun(test_case.test_to_run_count(), "test", "tests");
+  ColoredPrintf(COLOR_GREEN, "[----------] ");
+  printf("%s from %s", counts.c_str(), test_case_name_.c_str());
+  if (test_case.type_param() == NULL) {
+    printf("\n");
+  } else {
+    printf(", where TypeParam = %s\n", test_case.type_param());
+  }
+  fflush(stdout);
+}
+
+void PrettyUnitTestResultPrinter::OnTestStart(const TestInfo& test_info) {
+  ColoredPrintf(COLOR_GREEN,  "[ RUN      ] ");
+  PrintTestName(test_case_name_.c_str(), test_info.name());
+  printf("\n");
+  fflush(stdout);
+}
+
+// Called after an assertion failure.
+void PrettyUnitTestResultPrinter::OnTestPartResult(
+    const TestPartResult& result) {
+  // If the test part succeeded, we don't need to do anything.
+  if (result.type() == TestPartResult::kSuccess)
+    return;
+
+  // Print failure message from the assertion (e.g. expected this and got that).
+  PrintTestPartResult(result);
+  fflush(stdout);
+}
+
+void PrettyUnitTestResultPrinter::OnTestEnd(const TestInfo& test_info) {
+  if (test_info.result()->Passed()) {
+    ColoredPrintf(COLOR_GREEN, "[       OK ] ");
+  } else {
+    ColoredPrintf(COLOR_RED, "[  FAILED  ] ");
+  }
+  PrintTestName(test_case_name_.c_str(), test_info.name());
+  if (test_info.result()->Failed())
+    PrintFullTestCommentIfPresent(test_info);
+
+  if (GTEST_FLAG(print_time)) {
+    printf(" (%s ms)\n", internal::StreamableToString(
+           test_info.result()->elapsed_time()).c_str());
+  } else {
+    printf("\n");
+  }
+  fflush(stdout);
+}
+
+void PrettyUnitTestResultPrinter::OnTestCaseEnd(const TestCase& test_case) {
+  if (!GTEST_FLAG(print_time)) return;
+
+  test_case_name_ = test_case.name();
+  const internal::String counts =
+      FormatCountableNoun(test_case.test_to_run_count(), "test", "tests");
+  ColoredPrintf(COLOR_GREEN, "[----------] ");
+  printf("%s from %s (%s ms total)\n\n",
+         counts.c_str(), test_case_name_.c_str(),
+         internal::StreamableToString(test_case.elapsed_time()).c_str());
+  fflush(stdout);
+}
+
+void PrettyUnitTestResultPrinter::OnEnvironmentsTearDownStart(
+    const UnitTest& /*unit_test*/) {
+  ColoredPrintf(COLOR_GREEN,  "[----------] ");
+  printf("Global test environment tear-down\n");
+  fflush(stdout);
+}
+
+// Internal helper for printing the list of failed tests.
+void PrettyUnitTestResultPrinter::PrintFailedTests(const UnitTest& unit_test) {
+  const int failed_test_count = unit_test.failed_test_count();
+  if (failed_test_count == 0) {
+    return;
+  }
+
+  for (int i = 0; i < unit_test.total_test_case_count(); ++i) {
+    const TestCase& test_case = *unit_test.GetTestCase(i);
+    if (!test_case.should_run() || (test_case.failed_test_count() == 0)) {
+      continue;
+    }
+    for (int j = 0; j < test_case.total_test_count(); ++j) {
+      const TestInfo& test_info = *test_case.GetTestInfo(j);
+      if (!test_info.should_run() || test_info.result()->Passed()) {
+        continue;
+      }
+      ColoredPrintf(COLOR_RED, "[  FAILED  ] ");
+      printf("%s.%s", test_case.name(), test_info.name());
+      PrintFullTestCommentIfPresent(test_info);
+      printf("\n");
+    }
+  }
+}
+
+void PrettyUnitTestResultPrinter::OnTestIterationEnd(const UnitTest& unit_test,
+                                                     int /*iteration*/) {
+  ColoredPrintf(COLOR_GREEN,  "[==========] ");
+  printf("%s from %s ran.",
+         FormatTestCount(unit_test.test_to_run_count()).c_str(),
+         FormatTestCaseCount(unit_test.test_case_to_run_count()).c_str());
+  if (GTEST_FLAG(print_time)) {
+    printf(" (%s ms total)",
+           internal::StreamableToString(unit_test.elapsed_time()).c_str());
+  }
+  printf("\n");
+  ColoredPrintf(COLOR_GREEN,  "[  PASSED  ] ");
+  printf("%s.\n", FormatTestCount(unit_test.successful_test_count()).c_str());
+
+  int num_failures = unit_test.failed_test_count();
+  if (!unit_test.Passed()) {
+    const int failed_test_count = unit_test.failed_test_count();
+    ColoredPrintf(COLOR_RED,  "[  FAILED  ] ");
+    printf("%s, listed below:\n", FormatTestCount(failed_test_count).c_str());
+    PrintFailedTests(unit_test);
+    printf("\n%2d FAILED %s\n", num_failures,
+                        num_failures == 1 ? "TEST" : "TESTS");
+  }
+
+  int num_disabled = unit_test.disabled_test_count();
+  if (num_disabled && !GTEST_FLAG(also_run_disabled_tests)) {
+    if (!num_failures) {
+      printf("\n");  // Add a spacer if no FAILURE banner is displayed.
+    }
+    ColoredPrintf(COLOR_YELLOW,
+                  "  YOU HAVE %d DISABLED %s\n\n",
+                  num_disabled,
+                  num_disabled == 1 ? "TEST" : "TESTS");
+  }
+  // Ensure that Google Test output is printed before, e.g., heapchecker output.
+  fflush(stdout);
+}
+
+// End PrettyUnitTestResultPrinter
+
+// class TestEventRepeater
+//
+// This class forwards events to other event listeners.
+class TestEventRepeater : public TestEventListener {
+ public:
+  TestEventRepeater() : forwarding_enabled_(true) {}
+  virtual ~TestEventRepeater();
+  void Append(TestEventListener *listener);
+  TestEventListener* Release(TestEventListener* listener);
+
+  // Controls whether events will be forwarded to listeners_. Set to false
+  // in death test child processes.
+  bool forwarding_enabled() const { return forwarding_enabled_; }
+  void set_forwarding_enabled(bool enable) { forwarding_enabled_ = enable; }
+
+  virtual void OnTestProgramStart(const UnitTest& unit_test);
+  virtual void OnTestIterationStart(const UnitTest& unit_test, int iteration);
+  virtual void OnEnvironmentsSetUpStart(const UnitTest& unit_test);
+  virtual void OnEnvironmentsSetUpEnd(const UnitTest& unit_test);
+  virtual void OnTestCaseStart(const TestCase& test_case);
+  virtual void OnTestStart(const TestInfo& test_info);
+  virtual void OnTestPartResult(const TestPartResult& result);
+  virtual void OnTestEnd(const TestInfo& test_info);
+  virtual void OnTestCaseEnd(const TestCase& test_case);
+  virtual void OnEnvironmentsTearDownStart(const UnitTest& unit_test);
+  virtual void OnEnvironmentsTearDownEnd(const UnitTest& unit_test);
+  virtual void OnTestIterationEnd(const UnitTest& unit_test, int iteration);
+  virtual void OnTestProgramEnd(const UnitTest& unit_test);
+
+ private:
+  // Controls whether events will be forwarded to listeners_. Set to false
+  // in death test child processes.
+  bool forwarding_enabled_;
+  // The list of listeners that receive events.
+  std::vector<TestEventListener*> listeners_;
+
+  GTEST_DISALLOW_COPY_AND_ASSIGN_(TestEventRepeater);
+};
+
+TestEventRepeater::~TestEventRepeater() {
+  ForEach(listeners_, Delete<TestEventListener>);
+}
+
+void TestEventRepeater::Append(TestEventListener *listener) {
+  listeners_.push_back(listener);
+}
+
+// TODO(vladl@google.com): Factor the search functionality into Vector::Find.
+TestEventListener* TestEventRepeater::Release(TestEventListener *listener) {
+  for (size_t i = 0; i < listeners_.size(); ++i) {
+    if (listeners_[i] == listener) {
+      listeners_.erase(listeners_.begin() + i);
+      return listener;
+    }
+  }
+
+  return NULL;
+}
+
+// Since most methods are very similar, use macros to reduce boilerplate.
+// This defines a member that forwards the call to all listeners.
+#define GTEST_REPEATER_METHOD_(Name, Type) \
+void TestEventRepeater::Name(const Type& parameter) { \
+  if (forwarding_enabled_) { \
+    for (size_t i = 0; i < listeners_.size(); i++) { \
+      listeners_[i]->Name(parameter); \
+    } \
+  } \
+}
+// This defines a member that forwards the call to all listeners in reverse
+// order.
+#define GTEST_REVERSE_REPEATER_METHOD_(Name, Type) \
+void TestEventRepeater::Name(const Type& parameter) { \
+  if (forwarding_enabled_) { \
+    for (int i = static_cast<int>(listeners_.size()) - 1; i >= 0; i--) { \
+      listeners_[i]->Name(parameter); \
+    } \
+  } \
+}
+
+GTEST_REPEATER_METHOD_(OnTestProgramStart, UnitTest)
+GTEST_REPEATER_METHOD_(OnEnvironmentsSetUpStart, UnitTest)
+GTEST_REPEATER_METHOD_(OnTestCaseStart, TestCase)
+GTEST_REPEATER_METHOD_(OnTestStart, TestInfo)
+GTEST_REPEATER_METHOD_(OnTestPartResult, TestPartResult)
+GTEST_REPEATER_METHOD_(OnEnvironmentsTearDownStart, UnitTest)
+GTEST_REVERSE_REPEATER_METHOD_(OnEnvironmentsSetUpEnd, UnitTest)
+GTEST_REVERSE_REPEATER_METHOD_(OnEnvironmentsTearDownEnd, UnitTest)
+GTEST_REVERSE_REPEATER_METHOD_(OnTestEnd, TestInfo)
+GTEST_REVERSE_REPEATER_METHOD_(OnTestCaseEnd, TestCase)
+GTEST_REVERSE_REPEATER_METHOD_(OnTestProgramEnd, UnitTest)
+
+#undef GTEST_REPEATER_METHOD_
+#undef GTEST_REVERSE_REPEATER_METHOD_
+
+void TestEventRepeater::OnTestIterationStart(const UnitTest& unit_test,
+                                             int iteration) {
+  if (forwarding_enabled_) {
+    for (size_t i = 0; i < listeners_.size(); i++) {
+      listeners_[i]->OnTestIterationStart(unit_test, iteration);
+    }
+  }
+}
+
+void TestEventRepeater::OnTestIterationEnd(const UnitTest& unit_test,
+                                           int iteration) {
+  if (forwarding_enabled_) {
+    for (int i = static_cast<int>(listeners_.size()) - 1; i >= 0; i--) {
+      listeners_[i]->OnTestIterationEnd(unit_test, iteration);
+    }
+  }
+}
+
+// End TestEventRepeater
+
+// This class generates an XML output file.
+class XmlUnitTestResultPrinter : public EmptyTestEventListener {
+ public:
+  explicit XmlUnitTestResultPrinter(const char* output_file);
+
+  virtual void OnTestIterationEnd(const UnitTest& unit_test, int iteration);
+
+ private:
+  // Is c a whitespace character that is normalized to a space character
+  // when it appears in an XML attribute value?
+  static bool IsNormalizableWhitespace(char c) {
+    return c == 0x9 || c == 0xA || c == 0xD;
+  }
+
+  // May c appear in a well-formed XML document?
+  static bool IsValidXmlCharacter(char c) {
+    return IsNormalizableWhitespace(c) || c >= 0x20;
+  }
+
+  // Returns an XML-escaped copy of the input string str.  If
+  // is_attribute is true, the text is meant to appear as an attribute
+  // value, and normalizable whitespace is preserved by replacing it
+  // with character references.
+  static String EscapeXml(const char* str, bool is_attribute);
+
+  // Returns the given string with all characters invalid in XML removed.
+  static string RemoveInvalidXmlCharacters(const string& str);
+
+  // Convenience wrapper around EscapeXml when str is an attribute value.
+  static String EscapeXmlAttribute(const char* str) {
+    return EscapeXml(str, true);
+  }
+
+  // Convenience wrapper around EscapeXml when str is not an attribute value.
+  static String EscapeXmlText(const char* str) { return EscapeXml(str, false); }
+
+  // Streams an XML CDATA section, escaping invalid CDATA sequences as needed.
+  static void OutputXmlCDataSection(::std::ostream* stream, const char* data);
+
+  // Streams an XML representation of a TestInfo object.
+  static void OutputXmlTestInfo(::std::ostream* stream,
+                                const char* test_case_name,
+                                const TestInfo& test_info);
+
+  // Prints an XML representation of a TestCase object
+  static void PrintXmlTestCase(FILE* out, const TestCase& test_case);
+
+  // Prints an XML summary of unit_test to output stream out.
+  static void PrintXmlUnitTest(FILE* out, const UnitTest& unit_test);
+
+  // Produces a string representing the test properties in a result as space
+  // delimited XML attributes based on the property key="value" pairs.
+  // When the String is not empty, it includes a space at the beginning,
+  // to delimit this attribute from prior attributes.
+  static String TestPropertiesAsXmlAttributes(const TestResult& result);
+
+  // The output file.
+  const String output_file_;
+
+  GTEST_DISALLOW_COPY_AND_ASSIGN_(XmlUnitTestResultPrinter);
+};
+
+// Creates a new XmlUnitTestResultPrinter.
+XmlUnitTestResultPrinter::XmlUnitTestResultPrinter(const char* output_file)
+    : output_file_(output_file) {
+  if (output_file_.c_str() == NULL || output_file_.empty()) {
+    fprintf(stderr, "XML output file may not be null\n");
+    fflush(stderr);
+    exit(EXIT_FAILURE);
+  }
+}
+
+// Called after the unit test ends.
+void XmlUnitTestResultPrinter::OnTestIterationEnd(const UnitTest& unit_test,
+                                                  int /*iteration*/) {
+  FILE* xmlout = NULL;
+  FilePath output_file(output_file_);
+  FilePath output_dir(output_file.RemoveFileName());
+
+  if (output_dir.CreateDirectoriesRecursively()) {
+    xmlout = posix::FOpen(output_file_.c_str(), "w");
+  }
+  if (xmlout == NULL) {
+    // TODO(wan): report the reason of the failure.
+    //
+    // We don't do it for now as:
+    //
+    //   1. There is no urgent need for it.
+    //   2. It's a bit involved to make the errno variable thread-safe on
+    //      all three operating systems (Linux, Windows, and Mac OS).
+    //   3. To interpret the meaning of errno in a thread-safe way,
+    //      we need the strerror_r() function, which is not available on
+    //      Windows.
+    fprintf(stderr,
+            "Unable to open file \"%s\"\n",
+            output_file_.c_str());
+    fflush(stderr);
+    exit(EXIT_FAILURE);
+  }
+  PrintXmlUnitTest(xmlout, unit_test);
+  fclose(xmlout);
+}
+
+// Returns an XML-escaped copy of the input string str.  If is_attribute
+// is true, the text is meant to appear as an attribute value, and
+// normalizable whitespace is preserved by replacing it with character
+// references.
+//
+// Invalid XML characters in str, if any, are stripped from the output.
+// It is expected that most, if not all, of the text processed by this
+// module will consist of ordinary English text.
+// If this module is ever modified to produce version 1.1 XML output,
+// most invalid characters can be retained using character references.
+// TODO(wan): It might be nice to have a minimally invasive, human-readable
+// escaping scheme for invalid characters, rather than dropping them.
+String XmlUnitTestResultPrinter::EscapeXml(const char* str, bool is_attribute) {
+  Message m;
+
+  if (str != NULL) {
+    for (const char* src = str; *src; ++src) {
+      switch (*src) {
+        case '<':
+          m << "&lt;";
+          break;
+        case '>':
+          m << "&gt;";
+          break;
+        case '&':
+          m << "&amp;";
+          break;
+        case '\'':
+          if (is_attribute)
+            m << "&apos;";
+          else
+            m << '\'';
+          break;
+        case '"':
+          if (is_attribute)
+            m << "&quot;";
+          else
+            m << '"';
+          break;
+        default:
+          if (IsValidXmlCharacter(*src)) {
+            if (is_attribute && IsNormalizableWhitespace(*src))
+              m << String::Format("&#x%02X;", unsigned(*src));
+            else
+              m << *src;
+          }
+          break;
+      }
+    }
+  }
+
+  return m.GetString();
+}
+
+// Returns the given string with all characters invalid in XML removed.
+// Currently invalid characters are dropped from the string. An
+// alternative is to replace them with certain characters such as . or ?.
+string XmlUnitTestResultPrinter::RemoveInvalidXmlCharacters(const string& str) {
+  string output;
+  output.reserve(str.size());
+  for (string::const_iterator it = str.begin(); it != str.end(); ++it)
+    if (IsValidXmlCharacter(*it))
+      output.push_back(*it);
+
+  return output;
+}
+
+// The following routines generate an XML representation of a UnitTest
+// object.
+//
+// This is how Google Test concepts map to the DTD:
+//
+// <testsuites name="AllTests">        <-- corresponds to a UnitTest object
+//   <testsuite name="testcase-name">  <-- corresponds to a TestCase object
+//     <testcase name="test-name">     <-- corresponds to a TestInfo object
+//       <failure message="...">...</failure>
+//       <failure message="...">...</failure>
+//       <failure message="...">...</failure>
+//                                     <-- individual assertion failures
+//     </testcase>
+//   </testsuite>
+// </testsuites><