source: tests/check_user.c @ b4b8f1e

Last change on this file since b4b8f1e was 3963fdd, checked in by Wilmer van der Gaast <wilmer@…>, at 2010-07-29T07:19:57Z

"Fix up" unittests enough to at least compile. Never touched these during
the ui-fix works.

  • Property mode set to 100644
File size: 1.8 KB
Line 
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
9#if 0
10START_TEST(test_user_add)
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);
17END_TEST
18
19START_TEST(test_user_add_exists)
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);
26END_TEST
27
28START_TEST(test_user_add_invalid)
29        irc_t *irc = torture_irc();
30        user_t *user;
31        user = user_add(irc, ":foo");
32        fail_unless(user == NULL);
33END_TEST
34
35START_TEST(test_user_del_invalid)
36        irc_t *irc = torture_irc();
37        fail_unless(user_del(irc, ":foo") == 0);
38END_TEST
39
40START_TEST(test_user_del)
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);
46END_TEST
47
48START_TEST(test_user_del_nonexistant)
49        irc_t *irc = torture_irc();
50        fail_unless(user_del(irc, "foo") == 0);
51END_TEST
52
53START_TEST(test_user_rename)
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);
60END_TEST
61#endif
62Suite *user_suite (void)
63{
64        Suite *s = suite_create("User");
65        TCase *tc_core = tcase_create("Core");
66        suite_add_tcase (s, tc_core);
67#if 0
68        tcase_add_test (tc_core, test_user_add);
69        tcase_add_test (tc_core, test_user_add_invalid);
70        tcase_add_test (tc_core, test_user_add_exists);
71        tcase_add_test (tc_core, test_user_del_invalid);
72        tcase_add_test (tc_core, test_user_del_nonexistant);
73        tcase_add_test (tc_core, test_user_del);
74        tcase_add_test (tc_core, test_user_rename);
75#endif
76        return s;
77}
Note: See TracBrowser for help on using the repository browser.