Mercurial > pidgin
annotate libpurple/tests/test_oscar_util.c @ 32261:952120a8ee02
merge of '0b7caf6b17815fe333d151369f26330d4c662bda'
and 'efec3dc757b27366c8b23ca5c0bf1d8605084798'
author | Ethan Blanton <elb@pidgin.im> |
---|---|
date | Tue, 04 Oct 2011 18:34:45 +0000 |
parents | f1874b08b3f9 |
children |
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 } |