diff options
-rw-r--r-- | auto_tests/messenger_test.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/auto_tests/messenger_test.c b/auto_tests/messenger_test.c index 67156db4..3ca89152 100644 --- a/auto_tests/messenger_test.c +++ b/auto_tests/messenger_test.c | |||
@@ -196,24 +196,20 @@ START_TEST(test_m_copy_userstatus) | |||
196 | END_TEST | 196 | END_TEST |
197 | */ | 197 | */ |
198 | 198 | ||
199 | /* this test is excluded for now, due to lack of a way | ||
200 | * to set a friend's nickname for now. | ||
201 | * ideas: | ||
202 | * if we have access to the friends list, we could | ||
203 | * just add a name manually ourselves. */ | ||
204 | /* | ||
205 | START_TEST(test_getname) | 199 | START_TEST(test_getname) |
206 | { | 200 | { |
207 | uint8_t name_buf[MAX_NAME_LENGTH]; | 201 | uint8_t name_buf[MAX_NAME_LENGTH]; |
202 | uint8_t test_name[] = {'f', 'o', 'o'}; | ||
203 | |||
204 | ck_assert(getname(m, -1, name_buf) == -1); | ||
205 | ck_assert(getname(m, REALLY_BIG_NUMBER, name_buf) == -1); | ||
208 | 206 | ||
209 | assert(getname(-1, name_buf) == -1); | 207 | memcpy(m->friendlist[0].name, &test_name[0], 3); |
210 | assert(getname(REALLY_BIG_NUMBER, name_buf) == -1); | 208 | getname(m, 0, &name_buf[0]); |
211 | 209 | ||
212 | getname(friend_id_num, name_buf); | 210 | ck_assert(strcmp((char *)&name_buf[0], "foo") == 0); |
213 | assert(name_buf[MAX_NAME_LENGTH] == '\0'); // something like this | ||
214 | } | 211 | } |
215 | END_TEST | 212 | END_TEST |
216 | */ | ||
217 | 213 | ||
218 | Suite *messenger_suite(void) | 214 | Suite *messenger_suite(void) |
219 | { | 215 | { |
@@ -227,6 +223,7 @@ Suite *messenger_suite(void) | |||
227 | TCase *delfriend = tcase_create("delfriend"); | 223 | TCase *delfriend = tcase_create("delfriend"); |
228 | //TCase *addfriend = tcase_create("addfriend"); | 224 | //TCase *addfriend = tcase_create("addfriend"); |
229 | TCase *setname = tcase_create("setname"); | 225 | TCase *setname = tcase_create("setname"); |
226 | TCase *getname = tcase_create("getname"); | ||
230 | 227 | ||
231 | tcase_add_test(userstatus_size, test_m_get_userstatus_size); | 228 | tcase_add_test(userstatus_size, test_m_get_userstatus_size); |
232 | tcase_add_test(set_userstatus, test_m_set_userstatus); | 229 | tcase_add_test(set_userstatus, test_m_set_userstatus); |
@@ -235,6 +232,7 @@ Suite *messenger_suite(void) | |||
235 | tcase_add_test(send_message, test_m_sendmesage); | 232 | tcase_add_test(send_message, test_m_sendmesage); |
236 | tcase_add_test(delfriend, test_m_delfriend); | 233 | tcase_add_test(delfriend, test_m_delfriend); |
237 | //tcase_add_test(addfriend, test_m_addfriend); | 234 | //tcase_add_test(addfriend, test_m_addfriend); |
235 | tcase_add_test(setname, test_getname); | ||
238 | tcase_add_test(setname, test_setname); | 236 | tcase_add_test(setname, test_setname); |
239 | 237 | ||
240 | suite_add_tcase(s, userstatus_size); | 238 | suite_add_tcase(s, userstatus_size); |
@@ -244,6 +242,7 @@ Suite *messenger_suite(void) | |||
244 | suite_add_tcase(s, getself_name); | 242 | suite_add_tcase(s, getself_name); |
245 | suite_add_tcase(s, delfriend); | 243 | suite_add_tcase(s, delfriend); |
246 | //suite_add_tcase(s, addfriend); | 244 | //suite_add_tcase(s, addfriend); |
245 | suite_add_tcase(s, getname); | ||
247 | suite_add_tcase(s, setname); | 246 | suite_add_tcase(s, setname); |
248 | 247 | ||
249 | return s; | 248 | return s; |