Line | |
---|
1 | #include <stdlib.h> |
---|
2 | #include <glib.h> |
---|
3 | #include <gmodule.h> |
---|
4 | #include <check.h> |
---|
5 | #include <string.h> |
---|
6 | #include "irc.h" |
---|
7 | #include "set.h" |
---|
8 | #include "util.h" |
---|
9 | |
---|
10 | START_TEST(test_strip_linefeed) |
---|
11 | { |
---|
12 | int i; |
---|
13 | const char *get[] = { "Test", "Test\r", "Test\rX\r", NULL }; |
---|
14 | const char *expected[] = { "Test", "Test", "TestX", NULL }; |
---|
15 | |
---|
16 | for (i = 0; get[i]; i++) { |
---|
17 | char copy[20]; |
---|
18 | strcpy(copy, get[i]); |
---|
19 | strip_linefeed(copy); |
---|
20 | fail_unless (strcmp(copy, expected[i]) == 0, |
---|
21 | "(%d) strip_linefeed broken: %s -> %s (expected: %s)", |
---|
22 | i, get[i], copy, expected[i]); |
---|
23 | } |
---|
24 | } |
---|
25 | END_TEST |
---|
26 | |
---|
27 | Suite *util_suite (void) |
---|
28 | { |
---|
29 | Suite *s = suite_create("Util"); |
---|
30 | TCase *tc_core = tcase_create("Core"); |
---|
31 | suite_add_tcase (s, tc_core); |
---|
32 | tcase_add_test (tc_core, test_strip_linefeed); |
---|
33 | return s; |
---|
34 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.