Added flushSpy and the respective helper functions

This commit is contained in:
Fabian Zahn
2018-02-18 14:46:42 +01:00
parent 456759296b
commit 25804f3ab4
+27 -4
View File
@@ -54,6 +54,10 @@ void startPutcharSpy(void);
void endPutcharSpy(void); void endPutcharSpy(void);
char* getBufferPutcharSpy(void); char* getBufferPutcharSpy(void);
void startFlushSpy(void);
void endFlushSpy(void);
unsigned int getFlushSpyCalls(void);
static int SetToOneToFailInTearDown; static int SetToOneToFailInTearDown;
static int SetToOneMeanWeAlreadyCheckedThisGuy; static int SetToOneMeanWeAlreadyCheckedThisGuy;
@@ -3335,13 +3339,18 @@ void putcharSpy(int c)
#endif #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) void flushSpy(void)
{ {
static unsigned int calls = 0; if (flushSpyEnabled){ flushSpyCalls++; }
calls++; // count every call
} }
#endif
void testFailureCountIncrementsAndIsReturnedAtEnd(void) void testFailureCountIncrementsAndIsReturnedAtEnd(void)
{ {
@@ -3420,6 +3429,20 @@ void testPrintNumbersUnsigned32(void)
#endif #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 ================== // ===================== THESE TEST WILL RUN IF YOUR CONFIG INCLUDES 64 BIT SUPPORT ==================
void testPrintNumbersInt64(void) void testPrintNumbersInt64(void)