提交 15514e79 编写于 作者: M mkarlesky

added missing 'message' params in _MESSAGE macros; added TEST_ASSERT_NOT_EQUAL

git-svn-id: http://unity.svn.sourceforge.net/svnroot/unity/trunk@43 e7d17a6e-8845-0410-bbbc-c8efb4fdad7e
上级 71b4f95a
......@@ -190,13 +190,13 @@ void UnityIgnore(const char* message, const long line);
#define TEST_ASSERT_MESSAGE(condition, message) if (condition) {} else {TEST_FAIL(message);}
#define TEST_ASSERT(condition) TEST_ASSERT_MESSAGE(condition, NULL)
#define TEST_ASSERT_TRUE_MESSAGE(condition) TEST_ASSERT_MESSAGE(condition, message)
#define TEST_ASSERT_TRUE_MESSAGE(condition, message) TEST_ASSERT_MESSAGE(condition, message)
#define TEST_ASSERT_TRUE(condition) TEST_ASSERT(condition)
#define TEST_ASSERT_UNLESS_MESSAGE(condition) TEST_ASSERT_MESSAGE(!(condition), message)
#define TEST_ASSERT_UNLESS_MESSAGE(condition, message) TEST_ASSERT_MESSAGE(!(condition), message)
#define TEST_ASSERT_UNLESS(condition) TEST_ASSERT(!(condition))
#define TEST_ASSERT_FALSE_MESSAGE(condition) TEST_ASSERT_MESSAGE(!(condition), message)
#define TEST_ASSERT_FALSE_MESSAGE(condition, message) TEST_ASSERT_MESSAGE(!(condition), message)
#define TEST_ASSERT_FALSE(condition) TEST_ASSERT(!(condition))
#define TEST_ASSERT_NULL(pointer) TEST_ASSERT_MESSAGE(pointer == NULL, #pointer " was not null.")
......@@ -217,6 +217,9 @@ void UnityIgnore(const char* message, const long line);
#define TEST_ASSERT_EQUAL_MESSAGE(expected, actual, message) TEST_ASSERT_EQUAL_INT_MESSAGE((expected), (actual), (message))
#define TEST_ASSERT_EQUAL(expected, actual) TEST_ASSERT_EQUAL_INT(expected, actual)
#define TEST_ASSERT_NOT_EQUAL_MESSAGE(expected, actual, message) TEST_ASSERT_FALSE_MESSAGE(((expected) == (actual)), (message))
#define TEST_ASSERT_NOT_EQUAL(expected, actual) TEST_ASSERT_FALSE((expected) == (actual))
#define TEST_ASSERT_INT_WITHIN_MESSAGE(delta, expected, actual, message) \
Unity.TestFile=__FILE__; \
UnityAssertNumbersWithin((long)(delta), (long)(expected), (long)(actual), NULL, (unsigned short)__LINE__); \
......
......@@ -104,6 +104,21 @@ void testNotUnless(void)
TEST_ASSERT_EQUAL_INT(0U, Unity.TestFailures);
}
void testNotNotEqual(void)
{
int failed;
EXPECT_ABORT_BEGIN
TEST_ASSERT_NOT_EQUAL(10, 10);
EXPECT_ABORT_END
failed = Unity.CurrentTestFailed;
Unity.CurrentTestFailed = 0;
TEST_ASSERT_EQUAL_INT(1U, failed);
TEST_ASSERT_EQUAL_INT(0U, Unity.TestFailures);
}
void testFail(void)
{
int failed;
......@@ -290,6 +305,17 @@ void testEqualUints(void)
TEST_ASSERT_EQUAL_UINT(60872u, 60872u);
}
void testNotEqual(void)
{
TEST_ASSERT_NOT_EQUAL(0, 1);
TEST_ASSERT_NOT_EQUAL(1, 0);
TEST_ASSERT_NOT_EQUAL(100, 101);
TEST_ASSERT_NOT_EQUAL(0, -1);
TEST_ASSERT_NOT_EQUAL(65535, -65535);
TEST_ASSERT_NOT_EQUAL(75, 900);
TEST_ASSERT_NOT_EQUAL(-100, -101);
}
void testEqualHex8s(void)
{
_UU8 v0, v1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册