[ed5df81] | 1 | #include <stdlib.h> |
---|
| 2 | #include <glib.h> |
---|
| 3 | #include <gmodule.h> |
---|
| 4 | #include <check.h> |
---|
| 5 | #include <string.h> |
---|
| 6 | #include "bitlbee.h" |
---|
| 7 | #include "testsuite.h" |
---|
| 8 | |
---|
[3963fdd] | 9 | #if 0 |
---|
[ed5df81] | 10 | START_TEST(test_user_add) |
---|
[5ebff60] | 11 | irc_t * irc = torture_irc(); |
---|
| 12 | user_t *user; |
---|
| 13 | user = user_add(irc, "foo"); |
---|
| 14 | fail_if(user == NULL); |
---|
| 15 | fail_if(strcmp(user->nick, "foo") != 0); |
---|
| 16 | fail_unless(user_find(irc, "foo") == user); |
---|
[ed5df81] | 17 | END_TEST |
---|
| 18 | |
---|
| 19 | START_TEST(test_user_add_exists) |
---|
[5ebff60] | 20 | irc_t * irc = torture_irc(); |
---|
| 21 | user_t *user; |
---|
| 22 | user = user_add(irc, "foo"); |
---|
| 23 | fail_if(user == NULL); |
---|
| 24 | user = user_add(irc, "foo"); |
---|
| 25 | fail_unless(user == NULL); |
---|
[ed5df81] | 26 | END_TEST |
---|
| 27 | |
---|
| 28 | START_TEST(test_user_add_invalid) |
---|
[5ebff60] | 29 | irc_t * irc = torture_irc(); |
---|
| 30 | user_t *user; |
---|
| 31 | user = user_add(irc, ":foo"); |
---|
| 32 | fail_unless(user == NULL); |
---|
[ed5df81] | 33 | END_TEST |
---|
| 34 | |
---|
| 35 | START_TEST(test_user_del_invalid) |
---|
[5ebff60] | 36 | irc_t * irc = torture_irc(); |
---|
| 37 | fail_unless(user_del(irc, ":foo") == 0); |
---|
[ed5df81] | 38 | END_TEST |
---|
| 39 | |
---|
| 40 | START_TEST(test_user_del) |
---|
[5ebff60] | 41 | irc_t * irc = torture_irc(); |
---|
| 42 | user_t *user; |
---|
| 43 | user = user_add(irc, "foo"); |
---|
| 44 | fail_unless(user_del(irc, "foo") == 1); |
---|
| 45 | fail_unless(user_find(irc, "foo") == NULL); |
---|
[ed5df81] | 46 | END_TEST |
---|
| 47 | |
---|
| 48 | START_TEST(test_user_del_nonexistant) |
---|
[5ebff60] | 49 | irc_t * irc = torture_irc(); |
---|
| 50 | fail_unless(user_del(irc, "foo") == 0); |
---|
[ed5df81] | 51 | END_TEST |
---|
| 52 | |
---|
| 53 | START_TEST(test_user_rename) |
---|
[5ebff60] | 54 | irc_t * irc = torture_irc(); |
---|
| 55 | user_t *user; |
---|
| 56 | user = user_add(irc, "foo"); |
---|
| 57 | user_rename(irc, "foo", "bar"); |
---|
| 58 | fail_unless(user_find(irc, "foo") == NULL); |
---|
| 59 | fail_if(user_find(irc, "bar") == NULL); |
---|
[ed5df81] | 60 | END_TEST |
---|
[3963fdd] | 61 | #endif |
---|
[5ebff60] | 62 | Suite *user_suite(void) |
---|
[ed5df81] | 63 | { |
---|
| 64 | Suite *s = suite_create("User"); |
---|
| 65 | TCase *tc_core = tcase_create("Core"); |
---|
[5ebff60] | 66 | |
---|
| 67 | suite_add_tcase(s, tc_core); |
---|
[3963fdd] | 68 | #if 0 |
---|
[5ebff60] | 69 | tcase_add_test(tc_core, test_user_add); |
---|
| 70 | tcase_add_test(tc_core, test_user_add_invalid); |
---|
| 71 | tcase_add_test(tc_core, test_user_add_exists); |
---|
| 72 | tcase_add_test(tc_core, test_user_del_invalid); |
---|
| 73 | tcase_add_test(tc_core, test_user_del_nonexistant); |
---|
| 74 | tcase_add_test(tc_core, test_user_del); |
---|
| 75 | tcase_add_test(tc_core, test_user_rename); |
---|
[3963fdd] | 76 | #endif |
---|
[ed5df81] | 77 | return s; |
---|
| 78 | } |
---|