提交 91de19e5 编写于 作者: M mvandervoord

- added message support to NULL macros

- tweaked runner generator to use symbols for cexception like everything else.

git-svn-id: http://unity.svn.sourceforge.net/svnroot/unity/trunk@56 e7d17a6e-8845-0410-bbbc-c8efb4fdad7e
上级 836ae000
...@@ -17,7 +17,7 @@ class UnityTestRunnerGenerator ...@@ -17,7 +17,7 @@ class UnityTestRunnerGenerator
require 'yaml' require 'yaml'
yaml_guts = YAML.load_file(config_file) yaml_guts = YAML.load_file(config_file)
yaml_goodness = yaml_guts[:unity] ? yaml_guts[:unity] : yaml_guts[:cmock] yaml_goodness = yaml_guts[:unity] ? yaml_guts[:unity] : yaml_guts[:cmock]
options[:cexception] = 1 if (yaml_goodness[:plugins].include? 'cexception') options[:cexception] = 1 if (yaml_goodness[:plugins].include? :cexception)
options[:coverage ] = 1 if (yaml_goodness[:coverage]) options[:coverage ] = 1 if (yaml_goodness[:coverage])
options[:order] = 1 if (yaml_goodness[:enforce_strict_ordering]) options[:order] = 1 if (yaml_goodness[:enforce_strict_ordering])
options[:includes] << (yaml_goodness[:includes]) options[:includes] << (yaml_goodness[:includes])
...@@ -95,6 +95,7 @@ class UnityTestRunnerGenerator ...@@ -95,6 +95,7 @@ class UnityTestRunnerGenerator
def create_header(output, mocks) def create_header(output, mocks)
output.puts('/* AUTOGENERATED FILE. DO NOT EDIT. */') output.puts('/* AUTOGENERATED FILE. DO NOT EDIT. */')
output.puts('#include "unity.h"') output.puts('#include "unity.h"')
output.puts('#include "cmock.h"')
@options[:includes].flatten.each do |includes| @options[:includes].flatten.each do |includes|
output.puts("#include \"#{includes.gsub('.h','')}.h\"") output.puts("#include \"#{includes.gsub('.h','')}.h\"")
end end
......
...@@ -211,7 +211,7 @@ void UnityAssertFloatsWithin(const _UF delta, ...@@ -211,7 +211,7 @@ void UnityAssertFloatsWithin(const _UF delta,
// these are the macros you are looking for // these are the macros you are looking for
#define TEST_ASSERT_MESSAGE(condition, message) if (condition) {} else {TEST_FAIL(message);} #define TEST_ASSERT_MESSAGE(condition, message) if (condition) {} else {TEST_FAIL(message);}
#define TEST_ASSERT(condition) TEST_ASSERT_MESSAGE(condition, NULL) #define TEST_ASSERT(condition) TEST_ASSERT_MESSAGE(condition, "Expectation Failed.")
#define TEST_ASSERT_TRUE_MESSAGE(condition, message) TEST_ASSERT_MESSAGE(condition, message) #define TEST_ASSERT_TRUE_MESSAGE(condition, message) TEST_ASSERT_MESSAGE(condition, message)
#define TEST_ASSERT_TRUE(condition) TEST_ASSERT_MESSAGE(condition, "Expected TRUE was FALSE.") #define TEST_ASSERT_TRUE(condition) TEST_ASSERT_MESSAGE(condition, "Expected TRUE was FALSE.")
...@@ -223,7 +223,9 @@ void UnityAssertFloatsWithin(const _UF delta, ...@@ -223,7 +223,9 @@ void UnityAssertFloatsWithin(const _UF delta,
#define TEST_ASSERT_FALSE(condition) TEST_ASSERT_MESSAGE(!(condition), "Expected FALSE was TRUE.") #define TEST_ASSERT_FALSE(condition) TEST_ASSERT_MESSAGE(!(condition), "Expected FALSE was TRUE.")
#define TEST_ASSERT_NULL(pointer) TEST_ASSERT_MESSAGE(pointer == NULL, #pointer " was not null.") #define TEST_ASSERT_NULL(pointer) TEST_ASSERT_MESSAGE(pointer == NULL, #pointer " was not null.")
#define TEST_ASSERT_NULL_MESSAGE(pointer, message) TEST_ASSERT_MESSAGE(pointer == NULL, message)
#define TEST_ASSERT_NOT_NULL(pointer) TEST_ASSERT_MESSAGE(pointer != NULL, #pointer " was null.") #define TEST_ASSERT_NOT_NULL(pointer) TEST_ASSERT_MESSAGE(pointer != NULL, #pointer " was null.")
#define TEST_ASSERT_NOT_NULL_MESSAGE(pointer, message) TEST_ASSERT_MESSAGE(pointer != NULL, message)
#define TEST_ASSERT_EQUAL_INT_MESSAGE(expected, actual, message) \ #define TEST_ASSERT_EQUAL_INT_MESSAGE(expected, actual, message) \
Unity.TestFile=__FILE__; \ Unity.TestFile=__FILE__; \
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册