Skip to content

Commit 3995779

Browse files
author
David Saada
committed
Add a Unity macro to assert on platform error code difference
1 parent 4d07bcb commit 3995779

File tree

1 file changed

+9
-0
lines changed
  • features/frameworks/unity/unity

1 file changed

+9
-0
lines changed

features/frameworks/unity/unity/unity.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,15 @@ void tearDown(void);
294294
#define TEST_ASSERT_DOUBLE_IS_NOT_NAN_MESSAGE(actual, message) UNITY_TEST_ASSERT_DOUBLE_IS_NOT_NAN((actual), __LINE__, (message))
295295
#define TEST_ASSERT_DOUBLE_IS_NOT_DETERMINATE_MESSAGE(actual, message) UNITY_TEST_ASSERT_DOUBLE_IS_NOT_DETERMINATE((actual), __LINE__, (message))
296296

297+
298+
/*-------------------------------------------------------
299+
* Error code checking
300+
*-------------------------------------------------------*/
301+
// Use these to check whether error code equals what we expect.
302+
// Only display error code (without other information)
303+
#define TEST_ASSERT_EQUAL_ERROR_CODE(expected, actual) TEST_ASSERT_EQUAL(MBED_GET_ERROR_CODE(expected), MBED_GET_ERROR_CODE(actual))
304+
#define TEST_ASSERT_EQUAL_ERROR_CODE_MESSAGE(expected, actual, message) TEST_ASSERT_EQUAL_MESSAGE(MBED_GET_ERROR_CODE(expected), MBED_GET_ERROR_CODE(actual))
305+
297306
/*-------------------------------------------------------
298307
* Test skipping
299308
*-------------------------------------------------------*/

0 commit comments

Comments
 (0)