diff --git a/auto/generate_test_runner.rb b/auto/generate_test_runner.rb index 15459af..a3158cb 100644 --- a/auto/generate_test_runner.rb +++ b/auto/generate_test_runner.rb @@ -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) diff --git a/auto/unity_test_summary.rb b/auto/unity_test_summary.rb index 969ac0d..ee13b04 100644 --- a/auto/unity_test_summary.rb +++ b/auto/unity_test_summary.rb @@ -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}" diff --git a/docs/Unity Summary.odt b/docs/Unity Summary.odt index f699661..8bb3ed9 100644 Binary files a/docs/Unity Summary.odt and b/docs/Unity Summary.odt differ diff --git a/docs/Unity Summary.pdf b/docs/Unity Summary.pdf index ad1a956..10337aa 100644 Binary files a/docs/Unity Summary.pdf and b/docs/Unity Summary.pdf differ diff --git a/examples/rakefile_helper.rb b/examples/rakefile_helper.rb index 3bda369..145ca26 100644 --- a/examples/rakefile_helper.rb +++ b/examples/rakefile_helper.rb @@ -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) diff --git a/examples/test/TestProductionCode2.c b/examples/test/TestProductionCode2.c index 8192d32..009a2d3 100644 --- a/examples/test/TestProductionCode2.c +++ b/examples/test/TestProductionCode2.c @@ -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) { } diff --git a/rakefile_helper.rb b/rakefile_helper.rb index 537aa18..445b4a5 100644 --- a/rakefile_helper.rb +++ b/rakefile_helper.rb @@ -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 diff --git a/src/unity.c b/src/unity.c index 120d2fc..028d5c9 100644 --- a/src/unity.c +++ b/src/unity.c @@ -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; } //----------------------------------------------- diff --git a/src/unity_internals.h b/src/unity_internals.h index 39e27c4..4e49c0a 100644 --- a/src/unity_internals.h +++ b/src/unity_internals.h @@ -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