source: tests/check_user.c @ 246b98b

Last change on this file since 246b98b was e88fe7da, checked in by Veres Lajos <vlajos@…>, at 2015-08-07T21:53:25Z

typofix - https://github.com/vlajos/misspell_fixer

  • Property mode set to 100644
File size: 1.8 KB
RevLine 
[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]10START_TEST(test_user_add)
[5ebff60]11irc_t * irc = torture_irc();
12user_t *user;
13user = user_add(irc, "foo");
14fail_if(user == NULL);
15fail_if(strcmp(user->nick, "foo") != 0);
16fail_unless(user_find(irc, "foo") == user);
[ed5df81]17END_TEST
18
19START_TEST(test_user_add_exists)
[5ebff60]20irc_t * irc = torture_irc();
21user_t *user;
22user = user_add(irc, "foo");
23fail_if(user == NULL);
24user = user_add(irc, "foo");
25fail_unless(user == NULL);
[ed5df81]26END_TEST
27
28START_TEST(test_user_add_invalid)
[5ebff60]29irc_t * irc = torture_irc();
30user_t *user;
31user = user_add(irc, ":foo");
32fail_unless(user == NULL);
[ed5df81]33END_TEST
34
35START_TEST(test_user_del_invalid)
[5ebff60]36irc_t * irc = torture_irc();
37fail_unless(user_del(irc, ":foo") == 0);
[ed5df81]38END_TEST
39
40START_TEST(test_user_del)
[5ebff60]41irc_t * irc = torture_irc();
42user_t *user;
43user = user_add(irc, "foo");
44fail_unless(user_del(irc, "foo") == 1);
45fail_unless(user_find(irc, "foo") == NULL);
[ed5df81]46END_TEST
47
[e88fe7da]48START_TEST(test_user_del_nonexistent)
[5ebff60]49irc_t * irc = torture_irc();
50fail_unless(user_del(irc, "foo") == 0);
[ed5df81]51END_TEST
52
53START_TEST(test_user_rename)
[5ebff60]54irc_t * irc = torture_irc();
55user_t *user;
56user = user_add(irc, "foo");
57user_rename(irc, "foo", "bar");
58fail_unless(user_find(irc, "foo") == NULL);
59fail_if(user_find(irc, "bar") == NULL);
[ed5df81]60END_TEST
[3963fdd]61#endif
[5ebff60]62Suite *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);
[e88fe7da]73        tcase_add_test(tc_core, test_user_del_nonexistent);
[5ebff60]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}
Note: See TracBrowser for help on using the repository browser.