From 91de19e504a14a401f8e651d0b958fa34d86a29d Mon Sep 17 00:00:00 2001 From: mvandervoord Date: Mon, 8 Mar 2010 13:31:11 +0000 Subject: [PATCH] - 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 --- auto/generate_test_runner.rb | 3 ++- src/unity.h | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/auto/generate_test_runner.rb b/auto/generate_test_runner.rb index f30593f..14f71e2 100644 --- a/auto/generate_test_runner.rb +++ b/auto/generate_test_runner.rb @@ -17,7 +17,7 @@ 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[: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]) @@ -95,6 +95,7 @@ class UnityTestRunnerGenerator def create_header(output, mocks) output.puts('/* AUTOGENERATED FILE. DO NOT EDIT. */') output.puts('#include "unity.h"') + output.puts('#include "cmock.h"') @options[:includes].flatten.each do |includes| output.puts("#include \"#{includes.gsub('.h','')}.h\"") end diff --git a/src/unity.h b/src/unity.h index edc4324..0865317 100644 --- a/src/unity.h +++ b/src/unity.h @@ -211,7 +211,7 @@ void UnityAssertFloatsWithin(const _UF delta, // these are the macros you are looking for #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(condition) TEST_ASSERT_MESSAGE(condition, "Expected TRUE was FALSE.") @@ -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_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_MESSAGE(pointer, message) TEST_ASSERT_MESSAGE(pointer != NULL, message) #define TEST_ASSERT_EQUAL_INT_MESSAGE(expected, actual, message) \ Unity.TestFile=__FILE__; \