10 START_TEST(test_nick_strip
)
13 const char *get
[] = { "test:", "test", "test\n",
14 "thisisaveryveryveryverylongnick",
15 "thisisave:ryveryveryverylongnick",
21 const char *expected
[] = { "test", "test", "test",
22 "thisisaveryveryveryveryl",
23 "thisisaveryveryveryveryl",
30 for (i
= 0; get
[i
]; i
++) {
34 fail_unless (strcmp(copy
, expected
[i
]) == 0,
35 "(%d) nick_strip broken: %s -> %s (expected: %s)",
36 i
, get
[i
], copy
, expected
[i
]);
41 START_TEST(test_nick_ok_ok
)
43 const char *nicks
[] = { "foo", "bar123", "bla[", "blie]", "BreEZaH",
44 "\\od^~", "_123", "_123test", NULL
};
47 for (i
= 0; nicks
[i
]; i
++) {
48 fail_unless (nick_ok(nicks
[i
]) == 1,
49 "nick_ok() failed: %s", nicks
[i
]);
54 START_TEST(test_nick_ok_notok
)
56 const char *nicks
[] = { "thisisaveryveryveryveryveryveryverylongnick",
57 "\nillegalchar", "", "nick%", "123test", NULL
};
60 for (i
= 0; nicks
[i
]; i
++) {
61 fail_unless (nick_ok(nicks
[i
]) == 0,
62 "nick_ok() succeeded for invalid: %s", nicks
[i
]);
67 Suite
*nick_suite (void)
69 Suite
*s
= suite_create("Nick");
70 TCase
*tc_core
= tcase_create("Core");
71 suite_add_tcase (s
, tc_core
);
72 tcase_add_test (tc_core
, test_nick_ok_ok
);
73 tcase_add_test (tc_core
, test_nick_ok_notok
);
74 tcase_add_test (tc_core
, test_nick_strip
);