mirror of
https://github.com/ThrowTheSwitch/Unity.git
synced 2026-01-23 00:15:58 +01:00
Merge branch 'master' into unit-test-execution-time
This commit is contained in:
@@ -15,7 +15,11 @@ CFLAGS += -Wbad-function-cast -Wcast-qual -Wold-style-definition -Wshadow -Wstri
|
||||
CFLAGS += $(DEBUG)
|
||||
DEFINES = -D UNITY_OUTPUT_CHAR=putcharSpy
|
||||
DEFINES += -D UNITY_OUTPUT_CHAR_HEADER_DECLARATION=putcharSpy\(int\)
|
||||
DEFINES += -D UNITY_SUPPORT_64 -D UNITY_INCLUDE_DOUBLE
|
||||
DEFINES += -D UNITY_OUTPUT_FLUSH=flushSpy
|
||||
DEFINES += -D UNITY_OUTPUT_FLUSH_HEADER_DECLARATION=flushSpy\(void\)
|
||||
DEFINES += $(UNITY_SUPPORT_64) $(UNITY_INCLUDE_DOUBLE)
|
||||
UNITY_SUPPORT_64 = -D UNITY_SUPPORT_64
|
||||
UNITY_INCLUDE_DOUBLE = -D UNITY_INCLUDE_DOUBLE
|
||||
SRC = ../src/unity.c tests/testunity.c build/testunityRunner.c
|
||||
INC_DIR = -I ../src
|
||||
COV_FLAGS = -fprofile-arcs -ftest-coverage -I ../../src
|
||||
|
||||
5
test/testdata/testRunnerGenerator.c
vendored
5
test/testdata/testRunnerGenerator.c
vendored
@@ -21,7 +21,10 @@
|
||||
|
||||
/* Support for Meta Test Rig */
|
||||
#define TEST_CASE(a)
|
||||
void putcharSpy(int c) { (void)putchar(c);} // include passthrough for linking tests
|
||||
|
||||
/* Include Passthroughs for Linking Tests */
|
||||
void putcharSpy(int c) { (void)putchar(c);}
|
||||
void flushSpy(void) {}
|
||||
|
||||
/* Global Variables Used During These Tests */
|
||||
int CounterSetup = 0;
|
||||
|
||||
5
test/testdata/testRunnerGeneratorSmall.c
vendored
5
test/testdata/testRunnerGeneratorSmall.c
vendored
@@ -13,7 +13,10 @@ TEST_FILE("some_file.c")
|
||||
|
||||
/* Support for Meta Test Rig */
|
||||
#define TEST_CASE(a)
|
||||
void putcharSpy(int c) { (void)putchar(c);} // include passthrough for linking tests
|
||||
|
||||
/* Include Passthroughs for Linking Tests */
|
||||
void putcharSpy(int c) { (void)putchar(c);}
|
||||
void flushSpy(void) {}
|
||||
|
||||
/* Global Variables Used During These Tests */
|
||||
int CounterSetup = 0;
|
||||
|
||||
5
test/testdata/testRunnerGeneratorWithMocks.c
vendored
5
test/testdata/testRunnerGeneratorWithMocks.c
vendored
@@ -22,7 +22,10 @@
|
||||
|
||||
/* Support for Meta Test Rig */
|
||||
#define TEST_CASE(a)
|
||||
void putcharSpy(int c) { (void)putchar(c);} // include passthrough for linking tests
|
||||
|
||||
/* Include Passthroughs for Linking Tests */
|
||||
void putcharSpy(int c) { (void)putchar(c);}
|
||||
void flushSpy(void) {}
|
||||
|
||||
/* Global Variables Used During These Tests */
|
||||
int CounterSetup = 0;
|
||||
|
||||
@@ -8,10 +8,13 @@
|
||||
#include <stdio.h>
|
||||
#include "unity.h"
|
||||
|
||||
void putcharSpy(int c) { (void)putchar(c);} // include passthrough for linking tests
|
||||
|
||||
/* Support for Meta Test Rig */
|
||||
#define TEST_CASE(...)
|
||||
|
||||
/* Include Passthroughs for Linking Tests */
|
||||
void putcharSpy(int c) { (void)putchar(c);}
|
||||
void flushSpy(void) {}
|
||||
|
||||
#define EXPECT_ABORT_BEGIN \
|
||||
if (TEST_PROTECT()) \
|
||||
{
|
||||
|
||||
@@ -54,6 +54,10 @@ void startPutcharSpy(void);
|
||||
void endPutcharSpy(void);
|
||||
char* getBufferPutcharSpy(void);
|
||||
|
||||
void startFlushSpy(void);
|
||||
void endFlushSpy(void);
|
||||
int getFlushSpyCalls(void);
|
||||
|
||||
static int SetToOneToFailInTearDown;
|
||||
static int SetToOneMeanWeAlreadyCheckedThisGuy;
|
||||
|
||||
@@ -3343,14 +3347,35 @@ void putcharSpy(int c)
|
||||
#endif
|
||||
}
|
||||
|
||||
/* This is for counting the calls to the flushSpy */
|
||||
static int flushSpyEnabled;
|
||||
static int flushSpyCalls = 0;
|
||||
|
||||
void startFlushSpy(void) { flushSpyCalls = 0; flushSpyEnabled = 1; }
|
||||
void endFlushSpy(void) { flushSpyCalls = 0; flushSpyEnabled = 0; }
|
||||
int getFlushSpyCalls(void) { return flushSpyCalls; }
|
||||
|
||||
void flushSpy(void)
|
||||
{
|
||||
if (flushSpyEnabled){ flushSpyCalls++; }
|
||||
}
|
||||
|
||||
void testFailureCountIncrementsAndIsReturnedAtEnd(void)
|
||||
{
|
||||
UNITY_UINT savedFailures = Unity.TestFailures;
|
||||
Unity.CurrentTestFailed = 1;
|
||||
startPutcharSpy(); // Suppress output
|
||||
startFlushSpy();
|
||||
TEST_ASSERT_EQUAL(0, getFlushSpyCalls());
|
||||
UnityConcludeTest();
|
||||
endPutcharSpy();
|
||||
TEST_ASSERT_EQUAL(savedFailures + 1, Unity.TestFailures);
|
||||
#if defined(UNITY_OUTPUT_FLUSH) && defined(UNITY_OUTPUT_FLUSH_HEADER_DECLARATION)
|
||||
TEST_ASSERT_EQUAL(1, getFlushSpyCalls());
|
||||
#else
|
||||
TEST_ASSERT_EQUAL(0, getFlushSpyCalls());
|
||||
#endif
|
||||
endFlushSpy();
|
||||
|
||||
startPutcharSpy(); // Suppress output
|
||||
int failures = UnityEnd();
|
||||
@@ -3420,6 +3445,7 @@ void testPrintNumbersUnsigned32(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
// ===================== THESE TEST WILL RUN IF YOUR CONFIG INCLUDES 64 BIT SUPPORT ==================
|
||||
|
||||
void testPrintNumbersInt64(void)
|
||||
|
||||
Reference in New Issue
Block a user