From 01ca3899c2aadfc2da6eb51898d6ac39d55cccbc Mon Sep 17 00:00:00 2001 From: jsalling Date: Sat, 14 Jan 2017 12:22:00 -0600 Subject: [PATCH] Fix bug in DOUBLES_EQUAL in unity_fixture.h --- extras/fixture/src/unity_fixture.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/extras/fixture/src/unity_fixture.h b/extras/fixture/src/unity_fixture.h index 93d76ea..e992b99 100644 --- a/extras/fixture/src/unity_fixture.h +++ b/extras/fixture/src/unity_fixture.h @@ -49,6 +49,7 @@ int UnityMain(int argc, const char* argv[], void (*runAllTests)(void)); }\ void TEST_##group##_##name##_(void) +/* Call this for each test, insider the group runner */ #define RUN_TEST_CASE(group, name) \ { void TEST_##group##_##name##_run(void);\ TEST_##group##_##name##_run(); } @@ -64,6 +65,7 @@ int UnityMain(int argc, const char* argv[], void (*runAllTests)(void)); TEST_##group##_GROUP_RUNNER(); } /* CppUTest Compatibility Macros */ +/* Sets a pointer and automatically restores it to its old value after teardown */ #define UT_PTR_SET(ptr, newPointerValue) UnityPointer_Set((void**)&(ptr), (void*)(newPointerValue), __LINE__) #define TEST_ASSERT_POINTERS_EQUAL(expected, actual) TEST_ASSERT_EQUAL_PTR((expected), (actual)) #define TEST_ASSERT_BYTES_EQUAL(expected, actual) TEST_ASSERT_EQUAL_HEX8(0xff & (expected), 0xff & (actual)) @@ -71,8 +73,9 @@ int UnityMain(int argc, const char* argv[], void (*runAllTests)(void)); #define CHECK(condition) TEST_ASSERT_TRUE((condition)) #define LONGS_EQUAL(expected, actual) TEST_ASSERT_EQUAL_INT((expected), (actual)) #define STRCMP_EQUAL(expected, actual) TEST_ASSERT_EQUAL_STRING((expected), (actual)) -#define DOUBLES_EQUAL(expected, actual, delta) TEST_ASSERT_FLOAT_WITHIN(((expected), (actual), (delta)) +#define DOUBLES_EQUAL(expected, actual, delta) TEST_ASSERT_DOUBLE_WITHIN((delta), (expected), (actual)) +/* You must compile with malloc replacement, as defined in unity_fixture_malloc_overrides.h */ void UnityMalloc_MakeMallocFailAfterCount(int count); #endif /* UNITY_FIXTURE_H_ */