Open jefflongo opened 2 months ago
memo to myself: There is already greater than, less than, etc... therefore no additional actual functions are needed. A macro could cover this with back to back existing calls.
FYI, this is how I implemented it for my own uses:
#define _TEST_ASSERT_WITHIN_RANGE_MESSAGE(type, lower, upper, actual, message) \
do { \
TEST_ASSERT_GREATER_OR_EQUAL_##type##_MESSAGE(lower, actual, message); \
TEST_ASSERT_LESS_OR_EQUAL_##type##_MESSAGE(upper, actual, message); \
} while (0)
#define TEST_ASSERT_WITHIN_RANGE_INT8_MESSAGE(lower, upper, actual, message) \
_TEST_ASSERT_WITHIN_RANGE_MESSAGE(INT8, lower, upper, actual, message)
Currently there is no mechanism to assert a number is between two other numbers aside from using
TEST_ASSERT_X_WITHIN
supports only symmetric ranges. I propose an assertion likeTEST_ASSERT_X_WITHIN_RANGE(lower, upper, actual)
.