Use ck_assert_msg

This commit is contained in:
Florian Hahn 2013-08-17 23:02:36 +02:00
parent f259ab5fa7
commit a385c79cfe

View File

@ -87,13 +87,13 @@ START_TEST(test_m_set_userstatus)
uint16_t good_length = strlen(status);
uint16_t bad_length = REALLY_BIG_NUMBER;
if (m_set_statusmessage(m, (uint8_t *)status, bad_length) != -1)
ck_abort_msg("m_set_userstatus did NOT catch the following length: %d\n",
REALLY_BIG_NUMBER);
ck_assert_msg((m_set_statusmessage(m, (uint8_t *)status, bad_length) == -1),
"m_set_userstatus did NOT catch the following length: %d\n",
REALLY_BIG_NUMBER);
if ((m_set_statusmessage(m, (uint8_t *)status, good_length)) != 0)
ck_abort_msg("m_set_userstatus did NOT return 0 on the following length: %d\n"
"MAX_STATUSMESSAGE_LENGTH: %d\n", good_length, MAX_STATUSMESSAGE_LENGTH);
ck_assert_msg((m_set_statusmessage(m, (uint8_t *)status, good_length) == 0),
"m_set_userstatus did NOT return 0 on the following length: %d\n"
"MAX_STATUSMESSAGE_LENGTH: %d\n", good_length, MAX_STATUSMESSAGE_LENGTH);
}
END_TEST
@ -156,12 +156,11 @@ START_TEST(test_setname)
int good_length = strlen(good_name);
int bad_length = REALLY_BIG_NUMBER;
if (setname(m, (uint8_t *)good_name, bad_length) != -1)
ck_abort_msg("setname() did NOT error on %d as a length argument!\n",
bad_length);
ck_assert_msg((setname(m, (uint8_t *)good_name, bad_length) == -1),
"setname() did NOT error on %d as a length argument!\n", bad_length);
if (setname(m, (uint8_t *)good_name, good_length) != 0)
ck_abort_msg("setname() did NOT return 0 on good arguments!\n");
ck_assert_msg((setname(m, (uint8_t *)good_name, good_length) == 0),
"setname() did NOT return 0 on good arguments!\n");
}
END_TEST