annotate libpurple/tests/test_oscar_util.c @ 32391:b30d7c76db03

propagate from branch 'im.pidgin.pidgin.2.x.y' (head 83dd0d90742e9ccf6890fc21736440df73e48f24) to branch 'im.pidgin.pidgin' (head 31a6cb7c7aaed62b686fa3d4403dbed06d291abd)
author Daniel Atallah <daniel.atallah@gmail.com>
date Tue, 13 Dec 2011 15:33:12 +0000
parents f1874b08b3f9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
31204
f1874b08b3f9 Add unit tests for oscar_util_name_compare. I suspected that this
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1 #include <string.h>
f1874b08b3f9 Add unit tests for oscar_util_name_compare. I suspected that this
Mark Doliner <mark@kingant.net>
parents:
diff changeset
2
f1874b08b3f9 Add unit tests for oscar_util_name_compare. I suspected that this
Mark Doliner <mark@kingant.net>
parents:
diff changeset
3 #include "tests.h"
f1874b08b3f9 Add unit tests for oscar_util_name_compare. I suspected that this
Mark Doliner <mark@kingant.net>
parents:
diff changeset
4 #include "../protocols/oscar/oscar.h"
f1874b08b3f9 Add unit tests for oscar_util_name_compare. I suspected that this
Mark Doliner <mark@kingant.net>
parents:
diff changeset
5
f1874b08b3f9 Add unit tests for oscar_util_name_compare. I suspected that this
Mark Doliner <mark@kingant.net>
parents:
diff changeset
6 START_TEST(test_oscar_util_name_compare)
f1874b08b3f9 Add unit tests for oscar_util_name_compare. I suspected that this
Mark Doliner <mark@kingant.net>
parents:
diff changeset
7 {
f1874b08b3f9 Add unit tests for oscar_util_name_compare. I suspected that this
Mark Doliner <mark@kingant.net>
parents:
diff changeset
8 int i;
f1874b08b3f9 Add unit tests for oscar_util_name_compare. I suspected that this
Mark Doliner <mark@kingant.net>
parents:
diff changeset
9 const char *good[] = {
f1874b08b3f9 Add unit tests for oscar_util_name_compare. I suspected that this
Mark Doliner <mark@kingant.net>
parents:
diff changeset
10 "test",
f1874b08b3f9 Add unit tests for oscar_util_name_compare. I suspected that this
Mark Doliner <mark@kingant.net>
parents:
diff changeset
11 "TEST",
f1874b08b3f9 Add unit tests for oscar_util_name_compare. I suspected that this
Mark Doliner <mark@kingant.net>
parents:
diff changeset
12 "Test",
f1874b08b3f9 Add unit tests for oscar_util_name_compare. I suspected that this
Mark Doliner <mark@kingant.net>
parents:
diff changeset
13 "teSt",
f1874b08b3f9 Add unit tests for oscar_util_name_compare. I suspected that this
Mark Doliner <mark@kingant.net>
parents:
diff changeset
14 " TesT",
f1874b08b3f9 Add unit tests for oscar_util_name_compare. I suspected that this
Mark Doliner <mark@kingant.net>
parents:
diff changeset
15 "test ",
f1874b08b3f9 Add unit tests for oscar_util_name_compare. I suspected that this
Mark Doliner <mark@kingant.net>
parents:
diff changeset
16 " T E s T "
f1874b08b3f9 Add unit tests for oscar_util_name_compare. I suspected that this
Mark Doliner <mark@kingant.net>
parents:
diff changeset
17 };
f1874b08b3f9 Add unit tests for oscar_util_name_compare. I suspected that this
Mark Doliner <mark@kingant.net>
parents:
diff changeset
18 const char *bad[] = {
f1874b08b3f9 Add unit tests for oscar_util_name_compare. I suspected that this
Mark Doliner <mark@kingant.net>
parents:
diff changeset
19 "toast",
f1874b08b3f9 Add unit tests for oscar_util_name_compare. I suspected that this
Mark Doliner <mark@kingant.net>
parents:
diff changeset
20 "test@example.com",
f1874b08b3f9 Add unit tests for oscar_util_name_compare. I suspected that this
Mark Doliner <mark@kingant.net>
parents:
diff changeset
21 "test@aim.com"
f1874b08b3f9 Add unit tests for oscar_util_name_compare. I suspected that this
Mark Doliner <mark@kingant.net>
parents:
diff changeset
22 };
f1874b08b3f9 Add unit tests for oscar_util_name_compare. I suspected that this
Mark Doliner <mark@kingant.net>
parents:
diff changeset
23
f1874b08b3f9 Add unit tests for oscar_util_name_compare. I suspected that this
Mark Doliner <mark@kingant.net>
parents:
diff changeset
24 for (i = 0; i < G_N_ELEMENTS(good); i++) {
f1874b08b3f9 Add unit tests for oscar_util_name_compare. I suspected that this
Mark Doliner <mark@kingant.net>
parents:
diff changeset
25 ck_assert_int_eq(0, oscar_util_name_compare("test", good[i]));
f1874b08b3f9 Add unit tests for oscar_util_name_compare. I suspected that this
Mark Doliner <mark@kingant.net>
parents:
diff changeset
26 ck_assert_int_eq(0, oscar_util_name_compare(good[i], "test"));
f1874b08b3f9 Add unit tests for oscar_util_name_compare. I suspected that this
Mark Doliner <mark@kingant.net>
parents:
diff changeset
27 }
f1874b08b3f9 Add unit tests for oscar_util_name_compare. I suspected that this
Mark Doliner <mark@kingant.net>
parents:
diff changeset
28 for (i = 0; i < G_N_ELEMENTS(bad); i++) {
f1874b08b3f9 Add unit tests for oscar_util_name_compare. I suspected that this
Mark Doliner <mark@kingant.net>
parents:
diff changeset
29 ck_assert_int_ne(0, oscar_util_name_compare("test", bad[i]));
f1874b08b3f9 Add unit tests for oscar_util_name_compare. I suspected that this
Mark Doliner <mark@kingant.net>
parents:
diff changeset
30 ck_assert_int_ne(0, oscar_util_name_compare(bad[i], "test"));
f1874b08b3f9 Add unit tests for oscar_util_name_compare. I suspected that this
Mark Doliner <mark@kingant.net>
parents:
diff changeset
31 }
f1874b08b3f9 Add unit tests for oscar_util_name_compare. I suspected that this
Mark Doliner <mark@kingant.net>
parents:
diff changeset
32 }
f1874b08b3f9 Add unit tests for oscar_util_name_compare. I suspected that this
Mark Doliner <mark@kingant.net>
parents:
diff changeset
33 END_TEST
f1874b08b3f9 Add unit tests for oscar_util_name_compare. I suspected that this
Mark Doliner <mark@kingant.net>
parents:
diff changeset
34
f1874b08b3f9 Add unit tests for oscar_util_name_compare. I suspected that this
Mark Doliner <mark@kingant.net>
parents:
diff changeset
35 Suite *oscar_util_suite(void)
f1874b08b3f9 Add unit tests for oscar_util_name_compare. I suspected that this
Mark Doliner <mark@kingant.net>
parents:
diff changeset
36 {
f1874b08b3f9 Add unit tests for oscar_util_name_compare. I suspected that this
Mark Doliner <mark@kingant.net>
parents:
diff changeset
37 Suite *s;
f1874b08b3f9 Add unit tests for oscar_util_name_compare. I suspected that this
Mark Doliner <mark@kingant.net>
parents:
diff changeset
38 TCase *tc;
f1874b08b3f9 Add unit tests for oscar_util_name_compare. I suspected that this
Mark Doliner <mark@kingant.net>
parents:
diff changeset
39
f1874b08b3f9 Add unit tests for oscar_util_name_compare. I suspected that this
Mark Doliner <mark@kingant.net>
parents:
diff changeset
40 s = suite_create("OSCAR Utility Functions");
f1874b08b3f9 Add unit tests for oscar_util_name_compare. I suspected that this
Mark Doliner <mark@kingant.net>
parents:
diff changeset
41
f1874b08b3f9 Add unit tests for oscar_util_name_compare. I suspected that this
Mark Doliner <mark@kingant.net>
parents:
diff changeset
42 tc = tcase_create("Convert IM from network format to HTML");
f1874b08b3f9 Add unit tests for oscar_util_name_compare. I suspected that this
Mark Doliner <mark@kingant.net>
parents:
diff changeset
43 tcase_add_test(tc, test_oscar_util_name_compare);
f1874b08b3f9 Add unit tests for oscar_util_name_compare. I suspected that this
Mark Doliner <mark@kingant.net>
parents:
diff changeset
44 suite_add_tcase(s, tc);
f1874b08b3f9 Add unit tests for oscar_util_name_compare. I suspected that this
Mark Doliner <mark@kingant.net>
parents:
diff changeset
45
f1874b08b3f9 Add unit tests for oscar_util_name_compare. I suspected that this
Mark Doliner <mark@kingant.net>
parents:
diff changeset
46 return s;
f1874b08b3f9 Add unit tests for oscar_util_name_compare. I suspected that this
Mark Doliner <mark@kingant.net>
parents:
diff changeset
47 }