mirror of
https://github.com/ThrowTheSwitch/Unity.git
synced 2026-01-25 17:31:36 +01:00
- added an "equal" check for floating point (where it checks that floats are within a significant digit of eachother)
- added array support for unknown types (memcompares) git-svn-id: http://unity.svn.sourceforge.net/svnroot/unity/trunk@45 e7d17a6e-8845-0410-bbbc-c8efb4fdad7e
This commit is contained in:
15
src/unity.h
15
src/unity.h
@@ -140,6 +140,13 @@ void UnityAssertEqualMemory(const void* expected,
|
||||
const char* msg,
|
||||
const unsigned short lineNumber );
|
||||
|
||||
void UnityAssertEqualMemoryArray(const void* expected,
|
||||
const void* actual,
|
||||
unsigned long length,
|
||||
unsigned long num_elements,
|
||||
const char* msg,
|
||||
const unsigned short lineNumber );
|
||||
|
||||
void UnityAssertFloatsWithin(const float delta,
|
||||
const float expected,
|
||||
const float actual,
|
||||
@@ -306,6 +313,8 @@ void UnityIgnore(const char* message, const long line);
|
||||
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)
|
||||
#define TEST_ASSERT_EQUAL_FLOAT_MESSAGE(expected, actual, message) TEST_ASSERT_FLOAT_WITHIN_MESSAGE(expected / 10000.0f, expected, actual, message)
|
||||
#define TEST_ASSERT_EQUAL_FLOAT(expected, actual) TEST_ASSERT_FLOAT_WITHIN_MESSAGE((expected) / 10000.0f, expected, actual, NULL)
|
||||
|
||||
#define TEST_ASSERT_EQUAL_STRING_MESSAGE(expected, actual, message) \
|
||||
Unity.TestFile=__FILE__; \
|
||||
@@ -319,6 +328,12 @@ void UnityIgnore(const char* message, const long 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__; \
|
||||
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_IGNORE() TEST_IGNORE_MESSAGE(NULL)
|
||||
|
||||
Reference in New Issue
Block a user