提交 3a82e1ee 编写于 作者: M mvandervoord

- fixed summarizer to handle more generic input

- ignore comments in test parser
- fixed a couple bugs in 16-bit support
- fixed minor compiler errors for less lenient compilers
- fixed error in docs.
- renamed link to link_it in rakefiles to avoid collision in new versions of rake

git-svn-id: http://unity.svn.sourceforge.net/svnroot/unity/trunk@136 e7d17a6e-8845-0410-bbbc-c8efb4fdad7e
上级 152e78a4
......@@ -111,12 +111,17 @@ class UnityTestRunnerGenerator
def find_includes(input_file)
input_file.rewind
includes = []
input_file.readlines.each do |line|
scan_results = line.scan(/^\s*#include\s+\"\s*(.+)\.[hH]\s*\"/)
includes << scan_results[0][0] if (scan_results.size > 0)
end
return includes
#read in file
source = input_file.read
#remove comments (block and line, in three steps to ensure correct precedence)
source.gsub!(/\/\/(?:.+\/\*|\*(?:$|[^\/])).*$/, '') # remove line comments that comment out the start of blocks
source.gsub!(/\/\*.*?\*\//m, '') # remove block comments
source.gsub!(/\/\/.*$/, '') # remove line comments (all that remain)
#parse out includes
return source.scan(/^\s*#include\s+\"\s*(.+)\.[hH]\s*\"/).flatten
end
def find_mocks(includes)
......
......@@ -105,7 +105,7 @@ class UnityTestSummary
end
def parse_test_summary(summary)
if summary[-3..-1].join("\n") =~ /(\d+) Tests (\d+) Failures (\d+) Ignored/
if summary.find { |v| v =~ /(\d+) Tests (\d+) Failures (\d+) Ignored/ }
[$1.to_i,$2.to_i,$3.to_i]
else
raise "Couldn't parse test results: #{summary}"
......
此差异由.gitattributes 抑制。
此差异由.gitattributes 抑制。
......@@ -109,7 +109,7 @@ module RakefileHelpers
return {:command => command, :options => options, :includes => includes}
end
def link(exe_name, obj_list)
def link_it(exe_name, obj_list)
linker = build_linker_fields
cmd_str = "#{linker[:command]}#{linker[:options]}#{linker[:includes]} " +
(obj_list.map{|obj|"#{$cfg['linker']['object_files']['path']}#{obj} "}).join +
......@@ -205,7 +205,7 @@ module RakefileHelpers
obj_list << test_base.ext($cfg['compiler']['object_files']['extension'])
# Link the test executable
link(test_base, obj_list)
link_it(test_base, obj_list)
# Execute unit test and generate results file
simulator = build_simulator_fields
......@@ -250,7 +250,7 @@ module RakefileHelpers
obj_list << main_base.ext($cfg['compiler']['object_files']['extension'])
# Create the executable
link(main_base, obj_list)
link_it(main_base, obj_list)
end
def fail_out(msg)
......
......@@ -2,6 +2,11 @@
#include "ProductionCode2.h"
#include "unity.h"
/* These should be ignored because they are commented out in various ways:
#include "whatever.h"
*/
//#include "somethingelse.h"
void setUp(void)
{
}
......
......@@ -120,7 +120,7 @@ module RakefileHelpers
return {:command => command, :options => options, :includes => includes}
end
def link(exe_name, obj_list)
def link_it(exe_name, obj_list)
linker = build_linker_fields
cmd_str = "#{linker[:command]}#{linker[:options]}#{linker[:includes]} " +
(obj_list.map{|obj|"#{$cfg['linker']['object_files']['path']}#{obj} "}).join +
......@@ -219,7 +219,7 @@ module RakefileHelpers
obj_list << test_base.ext($cfg['compiler']['object_files']['extension'])
# Link the test executable
link(test_base, obj_list)
link_it(test_base, obj_list)
# Execute unit test and generate results file
simulator = build_simulator_fields
......
......@@ -816,8 +816,8 @@ void UnityAssertEqualStringArray( const char** expected,
//-----------------------------------------------
void UnityAssertEqualMemory( const void* expected,
const void* actual,
_UU32 length,
_UU32 num_elements,
const _UU32 length,
const _UU32 num_elements,
const char* msg,
const UNITY_LINE_TYPE lineNumber)
{
......@@ -933,6 +933,10 @@ void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int
void UnityBegin(void)
{
Unity.NumberOfTests = 0;
Unity.TestFailures = 0;
Unity.TestIgnores = 0;
Unity.CurrentTestFailed = 0;
Unity.CurrentTestIgnored = 0;
}
//-----------------------------------------------
......
......@@ -183,14 +183,23 @@ typedef void (*UnityTestFunction)(void);
typedef enum
{
#if (UNITY_INT_WIDTH == 16)
UNITY_DISPLAY_STYLE_INT = 2 + UNITY_DISPLAY_RANGE_INT + UNITY_DISPLAY_RANGE_AUTO,
#elif (UNITY_INT_WIDTH == 32)
UNITY_DISPLAY_STYLE_INT = 4 + UNITY_DISPLAY_RANGE_INT + UNITY_DISPLAY_RANGE_AUTO,
#endif
UNITY_DISPLAY_STYLE_INT8 = 1 + UNITY_DISPLAY_RANGE_INT,
UNITY_DISPLAY_STYLE_INT16 = 2 + UNITY_DISPLAY_RANGE_INT,
UNITY_DISPLAY_STYLE_INT32 = 4 + UNITY_DISPLAY_RANGE_INT,
#ifdef UNITY_SUPPORT_64
UNITY_DISPLAY_STYLE_INT64 = 8 + UNITY_DISPLAY_RANGE_INT,
#endif
#if (UNITY_INT_WIDTH == 16)
UNITY_DISPLAY_STYLE_UINT = 4 + UNITY_DISPLAY_RANGE_UINT + UNITY_DISPLAY_RANGE_AUTO,
#elif (UNITY_INT_WIDTH == 32)
UNITY_DISPLAY_STYLE_UINT = 2 + UNITY_DISPLAY_RANGE_UINT + UNITY_DISPLAY_RANGE_AUTO,
#endif
UNITY_DISPLAY_STYLE_UINT8 = 1 + UNITY_DISPLAY_RANGE_UINT,
UNITY_DISPLAY_STYLE_UINT16 = 2 + UNITY_DISPLAY_RANGE_UINT,
UNITY_DISPLAY_STYLE_UINT32 = 4 + UNITY_DISPLAY_RANGE_UINT,
......@@ -203,6 +212,7 @@ typedef enum
#ifdef UNITY_SUPPORT_64
UNITY_DISPLAY_STYLE_HEX64 = 8 + UNITY_DISPLAY_RANGE_HEX,
#endif
UNITY_DISPLAY_STYLE_UNKNOWN
} UNITY_DISPLAY_STYLE_T;
struct _Unity
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册