mirror of
https://github.com/ThrowTheSwitch/Unity.git
synced 2026-01-23 00:15:58 +01:00
Merge branch 'master' into float-printing
This commit is contained in:
@@ -18,7 +18,7 @@ Style/HashSyntax:
|
||||
EnforcedStyle: no_mixed_keys
|
||||
|
||||
# This is disabled because it seems to get confused over nested hashes
|
||||
Style/AlignHash:
|
||||
Layout/AlignHash:
|
||||
Enabled: false
|
||||
EnforcedHashRocketStyle: table
|
||||
EnforcedColonStyle: table
|
||||
|
||||
@@ -15,6 +15,8 @@ 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_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
|
||||
|
||||
@@ -4,17 +4,16 @@
|
||||
# [Released under MIT License. Please refer to license.txt for details]
|
||||
# ==========================================
|
||||
|
||||
UNITY_ROOT = File.expand_path(File.dirname(__FILE__)) + '/'
|
||||
$verbose = false
|
||||
|
||||
require 'rake'
|
||||
require 'rake/clean'
|
||||
require UNITY_ROOT + 'rakefile_helper'
|
||||
require_relative 'rakefile_helper'
|
||||
require 'rspec/core/rake_task'
|
||||
|
||||
TEMP_DIRS = [
|
||||
File.join(UNITY_ROOT, 'build'),
|
||||
File.join(UNITY_ROOT, 'sandbox')
|
||||
File.join(__dir__, 'build'),
|
||||
File.join(__dir__, 'sandbox')
|
||||
]
|
||||
|
||||
TEMP_DIRS.each do |dir|
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
|
||||
require 'yaml'
|
||||
require 'fileutils'
|
||||
require UNITY_ROOT + '../auto/unity_test_summary'
|
||||
require UNITY_ROOT + '../auto/generate_test_runner'
|
||||
require UNITY_ROOT + '../auto/colour_reporter'
|
||||
require_relative '../auto/unity_test_summary'
|
||||
require_relative '../auto/generate_test_runner'
|
||||
require_relative '../auto/colour_reporter'
|
||||
|
||||
module RakefileHelpers
|
||||
C_EXTENSION = '.c'.freeze
|
||||
@@ -179,7 +179,7 @@ module RakefileHelpers
|
||||
|
||||
def report_summary
|
||||
summary = UnityTestSummary.new
|
||||
summary.root = UNITY_ROOT
|
||||
summary.root = __dir__
|
||||
results_glob = "#{$cfg['compiler']['build_path']}*.test*"
|
||||
results_glob.tr!('\\', '/')
|
||||
results = Dir[results_glob]
|
||||
|
||||
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;
|
||||
|
||||
@@ -99,6 +103,10 @@ void testUnitySizeInitializationReminder(void)
|
||||
UNITY_COUNTER_TYPE TestIgnores;
|
||||
UNITY_COUNTER_TYPE CurrentTestFailed;
|
||||
UNITY_COUNTER_TYPE CurrentTestIgnored;
|
||||
#ifdef UNITY_INCLUDE_EXEC_TIME
|
||||
UNITY_COUNTER_TYPE CurrentTestStartTime;
|
||||
UNITY_COUNTER_TYPE CurrentTestStopTime;
|
||||
#endif
|
||||
#ifndef UNITY_EXCLUDE_SETJMP_H
|
||||
jmp_buf AbortFrame;
|
||||
#endif
|
||||
@@ -115,6 +123,10 @@ void testUnitySizeInitializationReminder(void)
|
||||
UNITY_COUNTER_TYPE TestIgnores;
|
||||
UNITY_COUNTER_TYPE CurrentTestFailed;
|
||||
UNITY_COUNTER_TYPE CurrentTestIgnored;
|
||||
#ifdef UNITY_INCLUDE_EXEC_TIME
|
||||
UNITY_COUNTER_TYPE CurrentTestStartTime;
|
||||
UNITY_COUNTER_TYPE CurrentTestStopTime;
|
||||
#endif
|
||||
#ifndef UNITY_EXCLUDE_SETJMP_H
|
||||
jmp_buf AbortFrame;
|
||||
#endif
|
||||
@@ -3335,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();
|
||||
@@ -3412,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