Merge pull request #59 from codehearts/reset-call-history-with-FFF_RESET_HISTORY

Clear `fff.call_history` when calling `FFF_RESET_HISTORY`
diff --git a/fakegen.rb b/fakegen.rb
index e21387f..b070183 100644
--- a/fakegen.rb
+++ b/fakegen.rb
@@ -466,7 +466,11 @@
     putd "FFF_END_EXTERN_C"
   }
   puts
-  putd "#define FFF_RESET_HISTORY() fff.call_history_idx = 0;"
+  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 {
diff --git a/fff.h b/fff.h
index 230144e..e12f798 100644
--- a/fff.h
+++ b/fff.h
@@ -133,7 +133,9 @@
         fff_globals_t fff; \
     FFF_END_EXTERN_C
 
-#define FFF_RESET_HISTORY() fff.call_history_idx = 0;
+#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) \
diff --git a/test/test_cases.include b/test/test_cases.include
index de84a5e..51484c1 100644
--- a/test/test_cases.include
+++ b/test/test_cases.include
@@ -158,11 +158,13 @@
 TEST_F(FFFTestSuite, reset_call_history_resets_call_history)
 {
     REGISTER_CALL(longfunc0);
+    REGISTER_CALL(voidfunc1);
     FFF_RESET_HISTORY();
     REGISTER_CALL(voidfunc2);
 
     ASSERT_EQ(1u, fff.call_history_idx);
     ASSERT_EQ(fff.call_history[0], (void *)voidfunc2);
+    ASSERT_EQ(fff.call_history[1], (void *)0);
 }
 
 TEST_F(FFFTestSuite, call_history_will_not_write_past_array_bounds)