提交 5e75c90c 编写于 作者: M mvandervoord

- standardized output format for test results

- added color coding to output

git-svn-id: http://unity.svn.sourceforge.net/svnroot/unity/trunk@58 e7d17a6e-8845-0410-bbbc-c8efb4fdad7e
上级 e966e563
if RUBY_PLATFORM =~/(win|w)32$/
begin
require 'Win32API'
rescue LoadError
puts "ERROR! \"Win32API\" library not found"
puts "\"Win32API\" is required for colour on a windows machine"
puts " try => \"gem install Win32API\" on the command line"
puts
end
# puts
# puts 'Windows Environment Detected...'
# puts 'Win32API Library Found.'
# puts
end
class ColourCommandLine
def initialize
if RUBY_PLATFORM =~/(win|w)32$/
get_std_handle = Win32API.new("kernel32", "GetStdHandle", ['L'], 'L')
@set_console_txt_attrb =
Win32API.new("kernel32","SetConsoleTextAttribute",['L','N'], 'I')
@hout = get_std_handle.call(-11)
end
end
def change_to(new_colour)
if RUBY_PLATFORM =~/(win|w)32$/
@set_console_txt_attrb.call(@hout,self.win32_colour(new_colour))
else
"\033[30;#{posix_colour(new_colour)};22m"
end
end
def win32_colour(colour)
case colour
when :black then 0
when :dark_blue then 1
when :dark_green then 2
when :dark_cyan then 3
when :dark_red then 4
when :dark_purple then 5
when :dark_yellow, :narrative then 6
when :default_white, :default, :dark_white then 7
when :silver then 8
when :blue then 9
when :green, :success then 10
when :cyan, :output then 11
when :red, :failure then 12
when :purple then 13
when :yellow then 14
when :white then 15
else
0
end
end
def posix_colour(colour)
case colour
when :black then 30
when :red, :failure then 31
when :green, :success then 32
when :yellow then 33
when :blue, :narrative then 34
when :purple, :magenta then 35
when :cyan, :output then 36
when :white, :default_white, :default then 37
else
30
end
end
def out_c(mode, colour, str)
case RUBY_PLATFORM
when /(win|w)32$/
change_to(colour)
$stdout.puts str if mode == :puts
$stdout.print str if mode == :print
change_to(:default_white)
else
$stdout.puts("#{change_to(colour)}#{str}\033[0m") if mode == :puts
$stdout.print("#{change_to(colour)}#{str}\033[0m") if mode == :print
end
end
end # ColourCommandLine
def colour_puts(role,str) ColourCommandLine.new.out_c(:puts, role, str) end
def colour_print(role,str) ColourCommandLine.new.out_c(:print, role, str) end
File.expand_path(File.join(File.dirname(__FILE__),'colour_prompt'))
class UnityTestRunnerGenerator
......@@ -17,10 +18,10 @@ class UnityTestRunnerGenerator
require 'yaml'
yaml_guts = YAML.load_file(config_file)
yaml_goodness = yaml_guts[:unity] ? yaml_guts[:unity] : yaml_guts[:cmock]
options[:cexception] = 1 if (yaml_goodness[:plugins].include? :cexception)
options[:coverage ] = 1 if (yaml_goodness[:coverage])
options[:order] = 1 if (yaml_goodness[:enforce_strict_ordering])
options[:includes] << (yaml_goodness[:includes])
options[:cexception] = 1 unless (yaml_goodness[:plugins] & ['cexception', :cexception]).empty?
options[:coverage ] = 1 if (yaml_goodness[:coverage])
options[:order] = 1 if (yaml_goodness[:enforce_strict_ordering])
options[:includes] << (yaml_goodness[:includes])
end
return(options)
end
......@@ -59,19 +60,35 @@ class UnityTestRunnerGenerator
end
def find_tests(input_file)
tests_raw = []
tests_and_line_numbers = []
input_file.rewind
tests = []
source = input_file.read()
source = source.gsub(/\/\/.*$/, '') #remove line comments
source = source.gsub(/\/\*.*?\*\//m, '') #remove block comments
lines = source.split(/(^\s*\#.*$) # Treat preprocessor directives as a logical line
source_raw = input_file.read
source_scrubbed = source_raw.gsub(/\/\/.*$/, '') #remove line comments
source_scrubbed = source_scrubbed.gsub(/\/\*.*?\*\//m, '') #remove block comments
lines = source_scrubbed.split(/(^\s*\#.*$) # Treat preprocessor directives as a logical line
| (;|\{|\}) /x) # Match ;, {, and } as end of lines
lines.each do |line|
lines.each_with_index do |line, index|
if line =~ /^\s*void\s+test(.*?)\s*\(\s*void\s*\)/
tests << "test" + $1
tests_raw << ("test" + $1)
end
end
source_lines = source_raw.split("\n")
source_index = 0;
tests_raw.each do |test|
source_lines[source_index..-1].each_with_index do |line, index|
if (line =~ /#{test}/)
source_index += index
tests_and_line_numbers << {:name => test, :line_number => (source_index+1)}
break
end
end
end
return tests
return tests_and_line_numbers
end
def find_includes(input_file)
......@@ -122,7 +139,7 @@ class UnityTestRunnerGenerator
output.puts("extern void tearDown(void);")
output.puts('')
tests.each do |test|
output.puts("extern void #{test}(void);")
output.puts("extern void #{test[:name]}(void);")
end
output.puts('')
end
......@@ -202,7 +219,7 @@ class UnityTestRunnerGenerator
output.puts(" // RUN_TEST calls runTest")
tests.each do |test|
output.puts(" RUN_TEST(#{test});")
output.puts(" RUN_TEST(#{test[:name]}, #{test[:line_number]});")
end
output.puts()
......
......@@ -2,13 +2,46 @@ require 'yaml'
require 'fileutils'
require 'auto/unity_test_summary'
require 'auto/generate_test_runner'
require 'auto/colour_prompt'
require 'auto/test_file_filter'
module RakefileHelpers
C_EXTENSION = '.c'
COLOUR = true
def report(message)
puts message
if not COLOUR
puts($stdout.puts(message))
else
message.each_line do |line|
line.chomp!
if line.include?('Tests') &&
line.include?('Failures') &&
line.include?('Ignored')
if line.include?('0 Failures')
colour = :green
else
colour = :red
end
elsif line.include?('PASS') ||
line == 'OK'
colour = :green
elsif line.include? "Running Unity system tests..."
colour = :blue
elsif line.include?('FAIL') ||
line.include?('Expected') ||
line.include?('Memory Mismatch') ||
line.include?('not within delta')
colour = :red
elsif line.include?(' IGNORED')
colour = :yellow
else
colour = :blue
end
colour_puts colour, line
end
end
$stdout.flush
$stderr.flush
end
......
......@@ -133,9 +133,9 @@ void UnityPrintMask(const unsigned long mask, const unsigned long number)
}
}
void UnityTestResultsBegin(const long line)
void UnityTestResultsBegin(const char* file, const long line)
{
UnityPrint(Unity.TestFile);
UnityPrint(file);
UNITY_OUTPUT_CHAR(':');
UnityPrintNumber(line);
UNITY_OUTPUT_CHAR(':');
......@@ -143,6 +143,12 @@ void UnityTestResultsBegin(const long line)
UNITY_OUTPUT_CHAR(':');
}
void UnityTestResultsFailBegin(const long line)
{
UnityTestResultsBegin(Unity.AssertContainerFile, line);
UnityPrint("FAIL:");
}
void UnityConcludeTest()
{
if (Unity.CurrentTestIgnored)
......@@ -151,8 +157,8 @@ void UnityConcludeTest()
}
else if (!Unity.CurrentTestFailed)
{
UnityPrint(Unity.CurrentTestName);
UnityPrint("::: PASS\n");
UnityTestResultsBegin(Unity.TestFile, Unity.CurrentTestLineNumber);
UnityPrint("PASS\n");
}
else
{
......@@ -173,7 +179,7 @@ void UnityAssertBits(const long mask,
{
Unity.CurrentTestFailed = 1;
UnityTestResultsBegin(lineNumber);
UnityTestResultsFailBegin(lineNumber);
UnityPrint("Expected ");
UnityPrintMask(mask, expected);
UnityPrint(" was ");
......@@ -198,7 +204,7 @@ void UnityAssertEqualNumber(const long expected,
{
Unity.CurrentTestFailed = 1;
UnityTestResultsBegin(lineNumber);
UnityTestResultsFailBegin(lineNumber);
UnityPrint("Expected ");
UnityPrintNumberByStyle(expected, style);
UnityPrint(" was ");
......@@ -223,7 +229,7 @@ void UnityAssertEqualNumberUnsigned(const unsigned long expected,
{
Unity.CurrentTestFailed = 1;
UnityTestResultsBegin(lineNumber);
UnityTestResultsFailBegin(lineNumber);
UnityPrint("Expected ");
UnityPrintNumberByStyle(expected, style);
UnityPrint(" was ");
......@@ -253,7 +259,7 @@ void UnityAssertEqualIntArray(const int* expected,
{
Unity.CurrentTestFailed = 1;
UnityTestResultsBegin(lineNumber);
UnityTestResultsFailBegin(lineNumber);
UnityPrint("You asked me to compare 0 elements of an array, which was pointless.");
if (msg)
{
......@@ -270,7 +276,7 @@ void UnityAssertEqualIntArray(const int* expected,
{
Unity.CurrentTestFailed = 1;
UnityTestResultsBegin(lineNumber);
UnityTestResultsFailBegin(lineNumber);
UnityPrint("Element ");
UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT);
UnityPrint(" Expected ");
......@@ -304,7 +310,7 @@ void UnityAssertEqualUnsignedIntArray(const unsigned int* expected,
{
Unity.CurrentTestFailed = 1;
UnityTestResultsBegin(lineNumber);
UnityTestResultsFailBegin(lineNumber);
UnityPrint("You asked me to compare nothing, which was pointless.");
if (msg)
{
......@@ -321,7 +327,7 @@ void UnityAssertEqualUnsignedIntArray(const unsigned int* expected,
{
Unity.CurrentTestFailed = 1;
UnityTestResultsBegin(lineNumber);
UnityTestResultsFailBegin(lineNumber);
UnityPrint("Element ");
UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT);
UnityPrint(" Expected ");
......@@ -362,7 +368,7 @@ void UnityAssertFloatsWithin(const _UF delta,
if (pos_delta < diff)
{
Unity.CurrentTestFailed = 1;
UnityTestResultsBegin(lineNumber);
UnityTestResultsFailBegin(lineNumber);
UnityPrint("Floats not within delta.");
if (msg)
{
......@@ -390,7 +396,7 @@ void UnityAssertNumbersWithin(const long delta,
if (delta < diff)
{
Unity.CurrentTestFailed = 1;
UnityTestResultsBegin(lineNumber);
UnityTestResultsFailBegin(lineNumber);
UnityPrint("Values not within delta.");
if (msg)
{
......@@ -412,7 +418,7 @@ void UnityAssertNumbersUnsignedWithin(const unsigned long delta,
if (delta < diff)
{
Unity.CurrentTestFailed = 1;
UnityTestResultsBegin(lineNumber);
UnityTestResultsFailBegin(lineNumber);
UnityPrint("Values not within delta.");
if (msg)
{
......@@ -451,7 +457,7 @@ void UnityAssertEqualString(const char* expected,
if (Unity.CurrentTestFailed)
{
UnityTestResultsBegin(lineNumber);
UnityTestResultsFailBegin(lineNumber);
UnityPrint("Expected '");
UnityPrint(expected);
UnityPrint("' was '");
......@@ -478,7 +484,7 @@ void UnityAssertEqualMemory(const void* expected,
{
Unity.CurrentTestFailed = 1;
UnityTestResultsBegin(lineNumber);
UnityTestResultsFailBegin(lineNumber);
UnityPrint("You asked me to compare nothing, which was pointless.");
if (msg)
{
......@@ -507,7 +513,7 @@ void UnityAssertEqualMemory(const void* expected,
if (Unity.CurrentTestFailed)
{
UnityTestResultsBegin(lineNumber);
UnityTestResultsFailBegin(lineNumber);
UnityPrint("Memory Mismatch.");
if (msg)
{
......@@ -532,7 +538,7 @@ void UnityAssertEqualMemoryArray(const void* expected,
{
Unity.CurrentTestFailed = 1;
UnityTestResultsBegin(lineNumber);
UnityTestResultsFailBegin(lineNumber);
UnityPrint("You asked me to compare nothing, which was pointless.");
if (msg)
{
......@@ -567,7 +573,7 @@ void UnityAssertEqualMemoryArray(const void* expected,
if (Unity.CurrentTestFailed)
{
UnityTestResultsBegin(lineNumber);
UnityTestResultsFailBegin(lineNumber);
UnityPrint("Element ");
UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT);
UnityPrint(" Memory Mismatch.");
......@@ -583,17 +589,27 @@ void UnityAssertEqualMemoryArray(const void* expected,
void UnityFail(const char* message, const long line)
{
Unity.CurrentTestFailed = 1;
UnityTestResultsBegin(line);
UnityPrint(message);
UnityTestResultsBegin(Unity.AssertContainerFile, line);
UnityPrint("FAIL");
if (message != NULL)
{
UNITY_OUTPUT_CHAR(':');
UnityPrint(message);
}
UNITY_OUTPUT_CHAR('\n');
}
void UnityIgnore(const char* message, const long line)
{
Unity.CurrentTestIgnored = 1;
UnityTestResultsBegin(line);
UnityPrint(message);
UnityPrint(" IGNORED\n");
UnityTestResultsBegin(Unity.AssertContainerFile, line);
UnityPrint("IGNORE");
if (message != NULL)
{
UNITY_OUTPUT_CHAR(':');
UnityPrint(message);
}
UNITY_OUTPUT_CHAR('\n');
}
void UnityBegin()
......
......@@ -76,7 +76,9 @@ typedef enum
struct _Unity
{
const char* TestFile;
const char* AssertContainerFile;
const char* CurrentTestName;
unsigned long CurrentTestLineNumber;
unsigned char NumberOfTests;
unsigned char TestFailures;
unsigned char TestIgnores;
......@@ -199,8 +201,9 @@ void UnityAssertFloatsWithin(const _UF delta,
#define ABORT_IF_NECESSARY() \
if( Unity.CurrentTestFailed || Unity.CurrentTestIgnored ) {TEST_ABORT();}
#define RUN_TEST(func) \
#define RUN_TEST(func, line_num) \
Unity.CurrentTestName = #func; \
Unity.CurrentTestLineNumber = line_num; \
Unity.NumberOfTests ++; \
runTest(func); \
UnityConcludeTest();
......@@ -228,13 +231,13 @@ void UnityAssertFloatsWithin(const _UF delta,
#define TEST_ASSERT_NOT_NULL_MESSAGE(pointer, message) TEST_ASSERT_MESSAGE(pointer != NULL, message)
#define TEST_ASSERT_EQUAL_INT_MESSAGE(expected, actual, message) \
Unity.TestFile=__FILE__; \
Unity.AssertContainerFile=__FILE__; \
UnityAssertEqualNumber((long)(expected), (long)(actual), (message), (unsigned short)__LINE__, UNITY_DISPLAY_STYLE_INT); \
ABORT_IF_NECESSARY();
#define TEST_ASSERT_EQUAL_INT(expected, actual) TEST_ASSERT_EQUAL_INT_MESSAGE(expected, actual, NULL)
#define TEST_ASSERT_EQUAL_INT_ARRAY_MESSAGE(expected, actual, num_elements, message) \
Unity.TestFile=__FILE__; \
Unity.AssertContainerFile=__FILE__; \
UnityAssertEqualIntArray((const int*)(expected), (const int*)(actual), (unsigned long)(num_elements), (message), (unsigned short)__LINE__, UNITY_DISPLAY_STYLE_INT); \
ABORT_IF_NECESSARY();
#define TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements) TEST_ASSERT_EQUAL_INT_ARRAY_MESSAGE(expected, actual, num_elements, NULL)
......@@ -246,43 +249,43 @@ void UnityAssertFloatsWithin(const _UF delta,
#define TEST_ASSERT_NOT_EQUAL(expected, actual) TEST_ASSERT_FALSE((expected) == (actual))
#define TEST_ASSERT_INT_WITHIN_MESSAGE(delta, expected, actual, message) \
Unity.TestFile=__FILE__; \
Unity.AssertContainerFile=__FILE__; \
UnityAssertNumbersWithin((long)(delta), (long)(expected), (long)(actual), NULL, (unsigned short)__LINE__); \
ABORT_IF_NECESSARY();
#define TEST_ASSERT_INT_WITHIN(delta, expected, actual) TEST_ASSERT_INT_WITHIN_MESSAGE(delta, expected, actual, NULL)
#define TEST_ASSERT_EQUAL_UINT_MESSAGE(expected, actual, message) \
Unity.TestFile=__FILE__; \
Unity.AssertContainerFile=__FILE__; \
UnityAssertEqualNumberUnsigned((unsigned long)(expected), (unsigned long)(actual), (message), (unsigned short)__LINE__, UNITY_DISPLAY_STYLE_UINT); \
ABORT_IF_NECESSARY();
#define TEST_ASSERT_EQUAL_UINT(expected, actual) TEST_ASSERT_EQUAL_UINT_MESSAGE(expected, actual, NULL)
#define TEST_ASSERT_EQUAL_UINT_ARRAY_MESSAGE(expected, actual, num_elements, message) \
Unity.TestFile=__FILE__; \
Unity.AssertContainerFile=__FILE__; \
UnityAssertEqualUnsignedIntArray((const unsigned int*)(expected), (const unsigned int*)(actual), (unsigned long)(num_elements), (message), (unsigned short)__LINE__, UNITY_DISPLAY_STYLE_UINT); \
ABORT_IF_NECESSARY();
#define TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements) TEST_ASSERT_EQUAL_UINT_ARRAY_MESSAGE(expected, actual, num_elements, NULL)
#define TEST_ASSERT_EQUAL_HEX8_MESSAGE(expected, actual, message) \
Unity.TestFile=__FILE__; \
Unity.AssertContainerFile=__FILE__; \
UnityAssertEqualNumberUnsigned((unsigned long)(expected), (unsigned long)(actual), (message), (unsigned short)__LINE__, UNITY_DISPLAY_STYLE_HEX8); \
ABORT_IF_NECESSARY();
#define TEST_ASSERT_EQUAL_HEX8(expected, actual) TEST_ASSERT_EQUAL_HEX8_MESSAGE(expected, actual, NULL)
#define TEST_ASSERT_EQUAL_HEX16_MESSAGE(expected, actual, message) \
Unity.TestFile=__FILE__; \
Unity.AssertContainerFile=__FILE__; \
UnityAssertEqualNumberUnsigned((unsigned long)(expected), (unsigned long)(actual), (message), (unsigned short)__LINE__, UNITY_DISPLAY_STYLE_HEX16); \
ABORT_IF_NECESSARY();
#define TEST_ASSERT_EQUAL_HEX16(expected, actual) TEST_ASSERT_EQUAL_HEX16_MESSAGE(expected, actual, NULL)
#define TEST_ASSERT_EQUAL_HEX32_MESSAGE(expected, actual, message) \
Unity.TestFile=__FILE__; \
Unity.AssertContainerFile=__FILE__; \
UnityAssertEqualNumber((long)(expected), (long)(actual), (message), (unsigned short)__LINE__, UNITY_DISPLAY_STYLE_HEX32); \
ABORT_IF_NECESSARY();
#define TEST_ASSERT_EQUAL_HEX32(expected, actual) TEST_ASSERT_EQUAL_HEX32_MESSAGE(expected, actual, NULL)
#define TEST_ASSERT_EQUAL_HEX32_ARRAY_MESSAGE(expected, actual, num_elements, message) \
Unity.TestFile=__FILE__; \
Unity.AssertContainerFile=__FILE__; \
UnityAssertEqualIntArray((const int*)(expected), (const int*)(actual), (unsigned long)(num_elements), (message), (unsigned short)__LINE__, UNITY_DISPLAY_STYLE_HEX32); \
ABORT_IF_NECESSARY();
#define TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements) TEST_ASSERT_EQUAL_HEX32_ARRAY_MESSAGE(expected, actual, num_elements, NULL)
......@@ -291,62 +294,63 @@ void UnityAssertFloatsWithin(const _UF delta,
#define TEST_ASSERT_EQUAL_HEX(expected, actual) TEST_ASSERT_EQUAL_HEX32(expected, actual)
#define TEST_ASSERT_EQUAL_HEX_ARRAY_MESSAGE(expected, actual, num_elements, message) \
Unity.TestFile=__FILE__; \
Unity.AssertContainerFile=__FILE__; \
UnityAssertEqualIntArray((const int*)(expected), (const int*)(actual), (unsigned long)(num_elements), (message), (unsigned short)__LINE__, UNITY_DISPLAY_STYLE_HEX32); \
ABORT_IF_NECESSARY();
#define TEST_ASSERT_EQUAL_HEX_ARRAY(expected, actual, num_elements) TEST_ASSERT_EQUAL_HEX32_ARRAY_MESSAGE(expected, actual, num_elements, NULL)
#define TEST_ASSERT_BITS_MESSAGE(mask, expected, actual, message) \
Unity.TestFile=__FILE__; \
Unity.AssertContainerFile=__FILE__; \
UnityAssertBits((mask), (expected), (actual), (message), (unsigned short)__LINE__); \
ABORT_IF_NECESSARY();
#define TEST_ASSERT_BITS(mask, expected, actual) TEST_ASSERT_BITS_MESSAGE(mask, expected, actual, NULL)
#define TEST_ASSERT_BITS_HIGH_MESSAGE(mask, actual, message) \
Unity.TestFile=__FILE__; \
Unity.AssertContainerFile=__FILE__; \
UnityAssertBits((mask), (-1), (actual), (message), (unsigned short)__LINE__); \
ABORT_IF_NECESSARY();
#define TEST_ASSERT_BITS_HIGH(mask, actual) TEST_ASSERT_BITS_HIGH_MESSAGE(mask, actual, NULL)
#define TEST_ASSERT_BITS_LOW_MESSAGE(mask, actual, message) \
Unity.TestFile=__FILE__; \
Unity.AssertContainerFile=__FILE__; \
UnityAssertBits((mask), (0), (actual), (message), (unsigned short)__LINE__); \
ABORT_IF_NECESSARY();
#define TEST_ASSERT_BITS_LOW(mask, actual) TEST_ASSERT_BITS_LOW_MESSAGE(mask, actual, NULL)
#define TEST_ASSERT_BIT_HIGH_MESSAGE(bit, actual, message) \
Unity.TestFile=__FILE__; \
Unity.AssertContainerFile=__FILE__; \
UnityAssertBits(((_UU32)1 << bit), (-1), (actual), (message), (unsigned short)__LINE__); \
ABORT_IF_NECESSARY();
#define TEST_ASSERT_BIT_HIGH(bit, actual) TEST_ASSERT_BIT_HIGH_MESSAGE(bit, actual, NULL)
#define TEST_ASSERT_BIT_LOW_MESSAGE(bit, actual, message) \
Unity.TestFile=__FILE__; \
Unity.AssertContainerFile=__FILE__; \
UnityAssertBits(((_UU32)1 << bit), (0), (actual), (message), (unsigned short)__LINE__); \
ABORT_IF_NECESSARY();
#define TEST_ASSERT_BIT_LOW(bit, actual) TEST_ASSERT_BIT_LOW_MESSAGE(bit, actual, NULL)
#define TEST_ASSERT_EQUAL_STRING_MESSAGE(expected, actual, message) \
Unity.TestFile=__FILE__; \
Unity.AssertContainerFile=__FILE__; \
UnityAssertEqualString((expected), (actual), (message), (unsigned short)__LINE__); \
ABORT_IF_NECESSARY();
#define TEST_ASSERT_EQUAL_STRING(expected, actual) TEST_ASSERT_EQUAL_STRING_MESSAGE(expected, actual, NULL)
#define TEST_ASSERT_EQUAL_MEMORY_MESSAGE(expected, actual, len, message) \
Unity.TestFile=__FILE__; \
Unity.AssertContainerFile=__FILE__; \
UnityAssertEqualMemory((expected), (actual), (len), (message), (unsigned short)__LINE__); \
ABORT_IF_NECESSARY();
#define TEST_ASSERT_EQUAL_MEMORY(expected, actual, len) TEST_ASSERT_EQUAL_MEMORY_MESSAGE(expected, actual, len, NULL)
#define TEST_ASSERT_EQUAL_MEMORY_ARRAY_MESSAGE(expected, actual, len, num_elements, message) \
Unity.TestFile=__FILE__; \
Unity.AssertContainerFile=__FILE__; \
UnityAssertEqualMemoryArray((expected), (actual), (len), (num_elements), (message), (unsigned short)__LINE__); \
ABORT_IF_NECESSARY();
#define TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements) TEST_ASSERT_EQUAL_MEMORY_ARRAY_MESSAGE(expected, actual, len, num_elements, NULL)
#define TEST_FAIL(message) { Unity.TestFile=__FILE__; UnityFail((message), (unsigned short)__LINE__); TEST_ABORT(); }
#define TEST_IGNORE_MESSAGE(message) { Unity.TestFile=__FILE__; UnityIgnore((message), (unsigned short)__LINE__); TEST_ABORT(); }
#define TEST_FAIL(message) { Unity.AssertContainerFile=__FILE__; UnityFail((message), (unsigned short)__LINE__); TEST_ABORT(); }
#define TEST_IGNORE_MESSAGE(message) { Unity.AssertContainerFile=__FILE__; UnityIgnore((message), (unsigned short)__LINE__); TEST_ABORT(); }
#define TEST_IGNORE() TEST_IGNORE_MESSAGE(NULL)
#define TEST_ONLY()
#ifdef UNITY_EXCLUDE_FLOAT
#define TEST_ASSERT_FLOAT_WITHIN_MESSAGE(delta, expected, actual, message) TEST_FAIL("Unity Floating Point Disabled");
......@@ -355,7 +359,7 @@ void UnityAssertFloatsWithin(const _UF delta,
#define TEST_ASSERT_EQUAL_FLOAT(expected, actual) TEST_FAIL("Unity Floating Point Disabled");
#else
#define TEST_ASSERT_FLOAT_WITHIN_MESSAGE(delta, expected, actual, message) \
Unity.TestFile=__FILE__; \
Unity.AssertContainerFile=__FILE__; \
UnityAssertFloatsWithin((delta), (expected), (actual), (message), (unsigned short)__LINE__); \
ABORT_IF_NECESSARY();
#define TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual) TEST_ASSERT_FLOAT_WITHIN_MESSAGE(delta, expected, actual, NULL)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册