diff --git a/test/tests/testunity.c b/test/tests/testunity.c index 1884cbb..3496990 100644 --- a/test/tests/testunity.c +++ b/test/tests/testunity.c @@ -54,6 +54,10 @@ void startPutcharSpy(void); void endPutcharSpy(void); char* getBufferPutcharSpy(void); +void startFlushSpy(void); +void endFlushSpy(void); +unsigned int getFlushSpyCalls(void); + static int SetToOneToFailInTearDown; static int SetToOneMeanWeAlreadyCheckedThisGuy; @@ -3335,13 +3339,18 @@ void putcharSpy(int c) #endif } -#if 0 +/* This is for counting the calls to the flushSpy */ +static int flushSpyEnabled; +static unsigned int flushSpyCalls = 0; + +void startFlushSpy(void) { flushSpyCalls = 0; flushSpyEnabled = 1; } +void endFlushSpy(void) { flushSpyCalls = 0; flushSpyEnabled = 0; } +unsigned int getFlushSpyCalls(void) { return flushSpyCalls; } + void flushSpy(void) { - static unsigned int calls = 0; - calls++; // count every call + if (flushSpyEnabled){ flushSpyCalls++; } } -#endif void testFailureCountIncrementsAndIsReturnedAtEnd(void) { @@ -3420,6 +3429,20 @@ void testPrintNumbersUnsigned32(void) #endif } + +/* This is for counting the calls to the flushSpy */ +static int flushSpyEnabled; +static unsigned int flushSpyCalls = 0; + +void startFlushSpy(void) { flushSpyCalls = 0; flushSpyEnabled = 1; } +void endFlushSpy(void) { flushSpyCalls = 0; flushSpyEnabled = 0; } +unsigned int getFlushSpyCalls(void) { return flushSpyCalls; } + +void flushSpy(void) +{ + if (flushSpyEnabled){ flushSpyCalls++; } +} + // ===================== THESE TEST WILL RUN IF YOUR CONFIG INCLUDES 64 BIT SUPPORT ================== void testPrintNumbersInt64(void)