annotate libpurple/tests/test_util.c @ 32797:aacfb71133cc

Fix a possible MSN remote crash Incoming messages with certain characters or character encodings can cause clients to crash. The fix is for the contents of all incoming plaintext messages are converted to UTF-8 and validated before used. This was reported to us by Fabian Yamaguchi and this patch was written by Elliott Sales de Andrade (maybe with small, insignificant changes by me)
author Mark Doliner <mark@kingant.net>
date Mon, 07 May 2012 03:18:08 +0000
parents f452f20502a4
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15888
6577b292e7b4 Fix compiler warnings and errors in tests resulting from using DEBUG_CFLAGS
Stu Tomlinson <stu@nosnilmot.com>
parents: 15822
diff changeset
1 #include <string.h>
6577b292e7b4 Fix compiler warnings and errors in tests resulting from using DEBUG_CFLAGS
Stu Tomlinson <stu@nosnilmot.com>
parents: 15822
diff changeset
2
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3 #include "tests.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4 #include "../util.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6 START_TEST(test_util_base16_encode)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7 {
26219
ba1799f21383 Cast away a few compile warnings in our "make check" tests, and add
Mark Doliner <mark@kingant.net>
parents: 22199
diff changeset
8 assert_string_equal_free("68656c6c6f2c20776f726c642100", purple_base16_encode((const unsigned char *)"hello, world!", 14));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10 END_TEST
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
11
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
12 START_TEST(test_util_base16_decode)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
13 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
14 gsize sz = 0;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
15 guchar *out = purple_base16_decode("21646c726f77202c6f6c6c656800", &sz);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
16 fail_unless(sz == 14, NULL);
27450
7bdad85c5fed Use assert_string_equal_free() instead of just assert_string_equal()
Mark Doliner <mark@kingant.net>
parents: 27248
diff changeset
17 assert_string_equal_free("!dlrow ,olleh", (char *)out);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
18 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
19 END_TEST
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
20
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
21 START_TEST(test_util_base64_encode)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
22 {
26219
ba1799f21383 Cast away a few compile warnings in our "make check" tests, and add
Mark Doliner <mark@kingant.net>
parents: 22199
diff changeset
23 assert_string_equal_free("Zm9ydHktdHdvAA==", purple_base64_encode((const unsigned char *)"forty-two", 10));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
24 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
25 END_TEST
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
26
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
27 START_TEST(test_util_base64_decode)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
28 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
29 gsize sz;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
30 guchar *out = purple_base64_decode("b3d0LXl0cm9mAA==", &sz);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
31 fail_unless(sz == 10, NULL);
27450
7bdad85c5fed Use assert_string_equal_free() instead of just assert_string_equal()
Mark Doliner <mark@kingant.net>
parents: 27248
diff changeset
32 assert_string_equal_free("owt-ytrof", (char *)out);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
33 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
34 END_TEST
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
35
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
36 START_TEST(test_util_escape_filename)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
37 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
38 assert_string_equal("foo", purple_escape_filename("foo"));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
39 assert_string_equal("@oo", purple_escape_filename("@oo"));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
40 assert_string_equal("#oo", purple_escape_filename("#oo"));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
41 assert_string_equal("-oo", purple_escape_filename("-oo"));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
42 assert_string_equal("_oo", purple_escape_filename("_oo"));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
43 assert_string_equal(".oo", purple_escape_filename(".oo"));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
44 assert_string_equal("%25oo", purple_escape_filename("%oo"));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
45 assert_string_equal("%21oo", purple_escape_filename("!oo"));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
46 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
47 END_TEST
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
48
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
49 START_TEST(test_util_unescape_filename)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
50 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
51 assert_string_equal("bar", purple_unescape_filename("bar"));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
52 assert_string_equal("@ar", purple_unescape_filename("@ar"));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
53 assert_string_equal("!ar", purple_unescape_filename("!ar"));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
54 assert_string_equal("!ar", purple_unescape_filename("%21ar"));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
55 assert_string_equal("%ar", purple_unescape_filename("%25ar"));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
56 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
57 END_TEST
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
58
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
59
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
60 START_TEST(test_util_text_strip_mnemonic)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
61 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
62 assert_string_equal_free("", purple_text_strip_mnemonic(""));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
63 assert_string_equal_free("foo", purple_text_strip_mnemonic("foo"));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15373
diff changeset
64 assert_string_equal_free("foo", purple_text_strip_mnemonic("_foo"));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
65
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
66 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
67 END_TEST
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
68
30186
d93865ec84d9 Expand our test for purple_email_is_valid(). I stumbled across a large list
Mark Doliner <mark@kingant.net>
parents: 29854
diff changeset
69 /*
30189
72d9caae4406 Oh, let's put our original test cases in the two arrays, to make things
Mark Doliner <mark@kingant.net>
parents: 30186
diff changeset
70 * Many of the valid and invalid email addresses lised below are from
30186
d93865ec84d9 Expand our test for purple_email_is_valid(). I stumbled across a large list
Mark Doliner <mark@kingant.net>
parents: 29854
diff changeset
71 * http://fightingforalostcause.net/misc/2006/compare-email-regex.php
d93865ec84d9 Expand our test for purple_email_is_valid(). I stumbled across a large list
Mark Doliner <mark@kingant.net>
parents: 29854
diff changeset
72 */
d93865ec84d9 Expand our test for purple_email_is_valid(). I stumbled across a large list
Mark Doliner <mark@kingant.net>
parents: 29854
diff changeset
73 const char *valid_emails[] = {
30189
72d9caae4406 Oh, let's put our original test cases in the two arrays, to make things
Mark Doliner <mark@kingant.net>
parents: 30186
diff changeset
74 "purple-devel@lists.sf.net",
30186
d93865ec84d9 Expand our test for purple_email_is_valid(). I stumbled across a large list
Mark Doliner <mark@kingant.net>
parents: 29854
diff changeset
75 "l3tt3rsAndNumb3rs@domain.com",
d93865ec84d9 Expand our test for purple_email_is_valid(). I stumbled across a large list
Mark Doliner <mark@kingant.net>
parents: 29854
diff changeset
76 "has-dash@domain.com",
d93865ec84d9 Expand our test for purple_email_is_valid(). I stumbled across a large list
Mark Doliner <mark@kingant.net>
parents: 29854
diff changeset
77 "hasApostrophe.o'leary@domain.org",
d93865ec84d9 Expand our test for purple_email_is_valid(). I stumbled across a large list
Mark Doliner <mark@kingant.net>
parents: 29854
diff changeset
78 "uncommonTLD@domain.museum",
d93865ec84d9 Expand our test for purple_email_is_valid(). I stumbled across a large list
Mark Doliner <mark@kingant.net>
parents: 29854
diff changeset
79 "uncommonTLD@domain.travel",
d93865ec84d9 Expand our test for purple_email_is_valid(). I stumbled across a large list
Mark Doliner <mark@kingant.net>
parents: 29854
diff changeset
80 "uncommonTLD@domain.mobi",
d93865ec84d9 Expand our test for purple_email_is_valid(). I stumbled across a large list
Mark Doliner <mark@kingant.net>
parents: 29854
diff changeset
81 "countryCodeTLD@domain.uk",
d93865ec84d9 Expand our test for purple_email_is_valid(). I stumbled across a large list
Mark Doliner <mark@kingant.net>
parents: 29854
diff changeset
82 "countryCodeTLD@domain.rw",
d93865ec84d9 Expand our test for purple_email_is_valid(). I stumbled across a large list
Mark Doliner <mark@kingant.net>
parents: 29854
diff changeset
83 "lettersInDomain@911.com",
d93865ec84d9 Expand our test for purple_email_is_valid(). I stumbled across a large list
Mark Doliner <mark@kingant.net>
parents: 29854
diff changeset
84 "underscore_inLocal@domain.net",
d93865ec84d9 Expand our test for purple_email_is_valid(). I stumbled across a large list
Mark Doliner <mark@kingant.net>
parents: 29854
diff changeset
85 "IPInsteadOfDomain@127.0.0.1",
d93865ec84d9 Expand our test for purple_email_is_valid(). I stumbled across a large list
Mark Doliner <mark@kingant.net>
parents: 29854
diff changeset
86 /* "IPAndPort@127.0.0.1:25", */
d93865ec84d9 Expand our test for purple_email_is_valid(). I stumbled across a large list
Mark Doliner <mark@kingant.net>
parents: 29854
diff changeset
87 "subdomain@sub.domain.com",
d93865ec84d9 Expand our test for purple_email_is_valid(). I stumbled across a large list
Mark Doliner <mark@kingant.net>
parents: 29854
diff changeset
88 "local@dash-inDomain.com",
d93865ec84d9 Expand our test for purple_email_is_valid(). I stumbled across a large list
Mark Doliner <mark@kingant.net>
parents: 29854
diff changeset
89 "dot.inLocal@foo.com",
d93865ec84d9 Expand our test for purple_email_is_valid(). I stumbled across a large list
Mark Doliner <mark@kingant.net>
parents: 29854
diff changeset
90 "a@singleLetterLocal.org",
d93865ec84d9 Expand our test for purple_email_is_valid(). I stumbled across a large list
Mark Doliner <mark@kingant.net>
parents: 29854
diff changeset
91 "singleLetterDomain@x.org",
d93865ec84d9 Expand our test for purple_email_is_valid(). I stumbled across a large list
Mark Doliner <mark@kingant.net>
parents: 29854
diff changeset
92 "&*=?^+{}'~@validCharsInLocal.net",
31264
169ebed69ef0 Add two valid email addresses to this list
Mark Doliner <mark@kingant.net>
parents: 31029
diff changeset
93 "foor@bar.newTLD",
169ebed69ef0 Add two valid email addresses to this list
Mark Doliner <mark@kingant.net>
parents: 31029
diff changeset
94 "HenryTheGreatWhiteCricket@live.ca",
169ebed69ef0 Add two valid email addresses to this list
Mark Doliner <mark@kingant.net>
parents: 31029
diff changeset
95 "HenryThe__WhiteCricket@hotmail.com"
30186
d93865ec84d9 Expand our test for purple_email_is_valid(). I stumbled across a large list
Mark Doliner <mark@kingant.net>
parents: 29854
diff changeset
96 };
d93865ec84d9 Expand our test for purple_email_is_valid(). I stumbled across a large list
Mark Doliner <mark@kingant.net>
parents: 29854
diff changeset
97
d93865ec84d9 Expand our test for purple_email_is_valid(). I stumbled across a large list
Mark Doliner <mark@kingant.net>
parents: 29854
diff changeset
98 const char *invalid_emails[] = {
30189
72d9caae4406 Oh, let's put our original test cases in the two arrays, to make things
Mark Doliner <mark@kingant.net>
parents: 30186
diff changeset
99 "purple-devel@@lists.sf.net",
72d9caae4406 Oh, let's put our original test cases in the two arrays, to make things
Mark Doliner <mark@kingant.net>
parents: 30186
diff changeset
100 "purple@devel@lists.sf.net",
72d9caae4406 Oh, let's put our original test cases in the two arrays, to make things
Mark Doliner <mark@kingant.net>
parents: 30186
diff changeset
101 "purple-devel@list..sf.net",
72d9caae4406 Oh, let's put our original test cases in the two arrays, to make things
Mark Doliner <mark@kingant.net>
parents: 30186
diff changeset
102 "purple-devel",
72d9caae4406 Oh, let's put our original test cases in the two arrays, to make things
Mark Doliner <mark@kingant.net>
parents: 30186
diff changeset
103 "purple-devel@",
72d9caae4406 Oh, let's put our original test cases in the two arrays, to make things
Mark Doliner <mark@kingant.net>
parents: 30186
diff changeset
104 "@lists.sf.net",
72d9caae4406 Oh, let's put our original test cases in the two arrays, to make things
Mark Doliner <mark@kingant.net>
parents: 30186
diff changeset
105 "totally bogus",
30186
d93865ec84d9 Expand our test for purple_email_is_valid(). I stumbled across a large list
Mark Doliner <mark@kingant.net>
parents: 29854
diff changeset
106 "missingDomain@.com",
d93865ec84d9 Expand our test for purple_email_is_valid(). I stumbled across a large list
Mark Doliner <mark@kingant.net>
parents: 29854
diff changeset
107 "@missingLocal.org",
d93865ec84d9 Expand our test for purple_email_is_valid(). I stumbled across a large list
Mark Doliner <mark@kingant.net>
parents: 29854
diff changeset
108 "missingatSign.net",
d93865ec84d9 Expand our test for purple_email_is_valid(). I stumbled across a large list
Mark Doliner <mark@kingant.net>
parents: 29854
diff changeset
109 "missingDot@com",
d93865ec84d9 Expand our test for purple_email_is_valid(). I stumbled across a large list
Mark Doliner <mark@kingant.net>
parents: 29854
diff changeset
110 "two@@signs.com",
d93865ec84d9 Expand our test for purple_email_is_valid(). I stumbled across a large list
Mark Doliner <mark@kingant.net>
parents: 29854
diff changeset
111 "colonButNoPort@127.0.0.1:",
d93865ec84d9 Expand our test for purple_email_is_valid(). I stumbled across a large list
Mark Doliner <mark@kingant.net>
parents: 29854
diff changeset
112 ""
d93865ec84d9 Expand our test for purple_email_is_valid(). I stumbled across a large list
Mark Doliner <mark@kingant.net>
parents: 29854
diff changeset
113 /* "someone-else@127.0.0.1.26", */
30191
b8782b02330d Catch some more invalid email addresses, thanks to Mark for additional
Stu Tomlinson <stu@nosnilmot.com>
parents: 30189
diff changeset
114 ".localStartsWithDot@domain.com",
b8782b02330d Catch some more invalid email addresses, thanks to Mark for additional
Stu Tomlinson <stu@nosnilmot.com>
parents: 30189
diff changeset
115 /* "localEndsWithDot.@domain.com", */ /* I don't think this is invalid -- Stu */
b8782b02330d Catch some more invalid email addresses, thanks to Mark for additional
Stu Tomlinson <stu@nosnilmot.com>
parents: 30189
diff changeset
116 /* "two..consecutiveDots@domain.com", */ /* I don't think this is invalid -- Stu */
b8782b02330d Catch some more invalid email addresses, thanks to Mark for additional
Stu Tomlinson <stu@nosnilmot.com>
parents: 30189
diff changeset
117 "domainStartsWithDash@-domain.com",
30186
d93865ec84d9 Expand our test for purple_email_is_valid(). I stumbled across a large list
Mark Doliner <mark@kingant.net>
parents: 29854
diff changeset
118 "domainEndsWithDash@domain-.com",
d93865ec84d9 Expand our test for purple_email_is_valid(). I stumbled across a large list
Mark Doliner <mark@kingant.net>
parents: 29854
diff changeset
119 /* "numbersInTLD@domain.c0m", */
30191
b8782b02330d Catch some more invalid email addresses, thanks to Mark for additional
Stu Tomlinson <stu@nosnilmot.com>
parents: 30189
diff changeset
120 /* "missingTLD@domain.", */ /* This certainly isn't invalid -- Stu */
30186
d93865ec84d9 Expand our test for purple_email_is_valid(). I stumbled across a large list
Mark Doliner <mark@kingant.net>
parents: 29854
diff changeset
121 "! \"#$%(),/;<>[]`|@invalidCharsInLocal.org",
d93865ec84d9 Expand our test for purple_email_is_valid(). I stumbled across a large list
Mark Doliner <mark@kingant.net>
parents: 29854
diff changeset
122 "invalidCharsInDomain@! \"#$%(),/;<>_[]`|.org",
d93865ec84d9 Expand our test for purple_email_is_valid(). I stumbled across a large list
Mark Doliner <mark@kingant.net>
parents: 29854
diff changeset
123 /* "local@SecondLevelDomainNamesAreInvalidIfTheyAreLongerThan64Charactersss.org" */
d93865ec84d9 Expand our test for purple_email_is_valid(). I stumbled across a large list
Mark Doliner <mark@kingant.net>
parents: 29854
diff changeset
124 };
d93865ec84d9 Expand our test for purple_email_is_valid(). I stumbled across a large list
Mark Doliner <mark@kingant.net>
parents: 29854
diff changeset
125
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
126 START_TEST(test_util_email_is_valid)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
127 {
30186
d93865ec84d9 Expand our test for purple_email_is_valid(). I stumbled across a large list
Mark Doliner <mark@kingant.net>
parents: 29854
diff changeset
128 size_t i;
d93865ec84d9 Expand our test for purple_email_is_valid(). I stumbled across a large list
Mark Doliner <mark@kingant.net>
parents: 29854
diff changeset
129
d93865ec84d9 Expand our test for purple_email_is_valid(). I stumbled across a large list
Mark Doliner <mark@kingant.net>
parents: 29854
diff changeset
130 for (i = 0; i < G_N_ELEMENTS(valid_emails); i++)
d93865ec84d9 Expand our test for purple_email_is_valid(). I stumbled across a large list
Mark Doliner <mark@kingant.net>
parents: 29854
diff changeset
131 fail_unless(purple_email_is_valid(valid_emails[i]), "Email address was: %s", valid_emails[i]);
d93865ec84d9 Expand our test for purple_email_is_valid(). I stumbled across a large list
Mark Doliner <mark@kingant.net>
parents: 29854
diff changeset
132
d93865ec84d9 Expand our test for purple_email_is_valid(). I stumbled across a large list
Mark Doliner <mark@kingant.net>
parents: 29854
diff changeset
133 for (i = 0; i < G_N_ELEMENTS(invalid_emails); i++)
d93865ec84d9 Expand our test for purple_email_is_valid(). I stumbled across a large list
Mark Doliner <mark@kingant.net>
parents: 29854
diff changeset
134 fail_if(purple_email_is_valid(invalid_emails[i]), "Email address was: %s", invalid_emails[i]);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
135 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
136 END_TEST
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
137
27469
8c41a23e6b44 Add purple_ipv6_address_is_valid; guess what it does?
Paul Aurich <paul@darkrain42.org>
parents: 27450
diff changeset
138 START_TEST(test_util_ipv6_is_valid)
8c41a23e6b44 Add purple_ipv6_address_is_valid; guess what it does?
Paul Aurich <paul@darkrain42.org>
parents: 27450
diff changeset
139 {
8c41a23e6b44 Add purple_ipv6_address_is_valid; guess what it does?
Paul Aurich <paul@darkrain42.org>
parents: 27450
diff changeset
140 fail_unless(purple_ipv6_address_is_valid("2001:0db8:85a3:0000:0000:8a2e:0370:7334"));
8c41a23e6b44 Add purple_ipv6_address_is_valid; guess what it does?
Paul Aurich <paul@darkrain42.org>
parents: 27450
diff changeset
141 fail_unless(purple_ipv6_address_is_valid("2001:db8:85a3:0:0:8a2e:370:7334"));
8c41a23e6b44 Add purple_ipv6_address_is_valid; guess what it does?
Paul Aurich <paul@darkrain42.org>
parents: 27450
diff changeset
142 fail_unless(purple_ipv6_address_is_valid("2001:db8:85a3::8a2e:370:7334"));
8c41a23e6b44 Add purple_ipv6_address_is_valid; guess what it does?
Paul Aurich <paul@darkrain42.org>
parents: 27450
diff changeset
143 fail_unless(purple_ipv6_address_is_valid("2001:0db8:0:0::1428:57ab"));
8c41a23e6b44 Add purple_ipv6_address_is_valid; guess what it does?
Paul Aurich <paul@darkrain42.org>
parents: 27450
diff changeset
144 fail_unless(purple_ipv6_address_is_valid("::1"));
8c41a23e6b44 Add purple_ipv6_address_is_valid; guess what it does?
Paul Aurich <paul@darkrain42.org>
parents: 27450
diff changeset
145 fail_unless(purple_ipv6_address_is_valid("1::"));
8c41a23e6b44 Add purple_ipv6_address_is_valid; guess what it does?
Paul Aurich <paul@darkrain42.org>
parents: 27450
diff changeset
146 fail_unless(purple_ipv6_address_is_valid("1::1"));
8c41a23e6b44 Add purple_ipv6_address_is_valid; guess what it does?
Paul Aurich <paul@darkrain42.org>
parents: 27450
diff changeset
147 fail_unless(purple_ipv6_address_is_valid("::"));
8c41a23e6b44 Add purple_ipv6_address_is_valid; guess what it does?
Paul Aurich <paul@darkrain42.org>
parents: 27450
diff changeset
148 fail_if(purple_ipv6_address_is_valid(""));
8c41a23e6b44 Add purple_ipv6_address_is_valid; guess what it does?
Paul Aurich <paul@darkrain42.org>
parents: 27450
diff changeset
149 fail_if(purple_ipv6_address_is_valid(":"));
8c41a23e6b44 Add purple_ipv6_address_is_valid; guess what it does?
Paul Aurich <paul@darkrain42.org>
parents: 27450
diff changeset
150 fail_if(purple_ipv6_address_is_valid("1.2.3.4"));
8c41a23e6b44 Add purple_ipv6_address_is_valid; guess what it does?
Paul Aurich <paul@darkrain42.org>
parents: 27450
diff changeset
151 fail_if(purple_ipv6_address_is_valid("2001::FFD3::57ab"));
8c41a23e6b44 Add purple_ipv6_address_is_valid; guess what it does?
Paul Aurich <paul@darkrain42.org>
parents: 27450
diff changeset
152 fail_if(purple_ipv6_address_is_valid("200000000::1"));
8c41a23e6b44 Add purple_ipv6_address_is_valid; guess what it does?
Paul Aurich <paul@darkrain42.org>
parents: 27450
diff changeset
153 fail_if(purple_ipv6_address_is_valid("QWERTY::1"));
8c41a23e6b44 Add purple_ipv6_address_is_valid; guess what it does?
Paul Aurich <paul@darkrain42.org>
parents: 27450
diff changeset
154 }
8c41a23e6b44 Add purple_ipv6_address_is_valid; guess what it does?
Paul Aurich <paul@darkrain42.org>
parents: 27450
diff changeset
155 END_TEST
8c41a23e6b44 Add purple_ipv6_address_is_valid; guess what it does?
Paul Aurich <paul@darkrain42.org>
parents: 27450
diff changeset
156
16004
b4593c886933 fix our string-to-time function, and add a couple tests for it
Nathan Walp <nwalp@pidgin.im>
parents: 15888
diff changeset
157 START_TEST(test_util_str_to_time)
b4593c886933 fix our string-to-time function, and add a couple tests for it
Nathan Walp <nwalp@pidgin.im>
parents: 15888
diff changeset
158 {
21612
18fb032a602a Fix the bug in purple_str_to_time() that was causing 'make check' to fail.
Stu Tomlinson <stu@nosnilmot.com>
parents: 21152
diff changeset
159 fail_unless(377182200 == purple_str_to_time("19811214T12:50:00", TRUE, NULL, NULL, NULL));
16004
b4593c886933 fix our string-to-time function, and add a couple tests for it
Nathan Walp <nwalp@pidgin.im>
parents: 15888
diff changeset
160 fail_unless(1175919261 == purple_str_to_time("20070407T04:14:21", TRUE, NULL, NULL, NULL));
31029
e5101d9cbaaa Add two new tests to purple_str_to_time(). The second currently fails, but is the format used for our log files\!
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30191
diff changeset
161 fail_unless(1282941722 == purple_str_to_time("2010-08-27.204202", TRUE, NULL, NULL, NULL));
e5101d9cbaaa Add two new tests to purple_str_to_time(). The second currently fails, but is the format used for our log files\!
Daniel Atallah <daniel.atallah@gmail.com>
parents: 30191
diff changeset
162 fail_unless(1282941722 == purple_str_to_time("2010-08-27.134202-0700PDT", FALSE, NULL, NULL, NULL));
16004
b4593c886933 fix our string-to-time function, and add a couple tests for it
Nathan Walp <nwalp@pidgin.im>
parents: 15888
diff changeset
163 }
b4593c886933 fix our string-to-time function, and add a couple tests for it
Nathan Walp <nwalp@pidgin.im>
parents: 15888
diff changeset
164 END_TEST
b4593c886933 fix our string-to-time function, and add a couple tests for it
Nathan Walp <nwalp@pidgin.im>
parents: 15888
diff changeset
165
21152
1dd6704cd187 Add a test for the html markup parsing to try to prevent a repeat of 2.2.2
Stu Tomlinson <stu@nosnilmot.com>
parents: 16004
diff changeset
166 START_TEST(test_markup_html_to_xhtml)
1dd6704cd187 Add a test for the html markup parsing to try to prevent a repeat of 2.2.2
Stu Tomlinson <stu@nosnilmot.com>
parents: 16004
diff changeset
167 {
1dd6704cd187 Add a test for the html markup parsing to try to prevent a repeat of 2.2.2
Stu Tomlinson <stu@nosnilmot.com>
parents: 16004
diff changeset
168 gchar *xhtml = NULL;
1dd6704cd187 Add a test for the html markup parsing to try to prevent a repeat of 2.2.2
Stu Tomlinson <stu@nosnilmot.com>
parents: 16004
diff changeset
169 gchar *plaintext = NULL;
1dd6704cd187 Add a test for the html markup parsing to try to prevent a repeat of 2.2.2
Stu Tomlinson <stu@nosnilmot.com>
parents: 16004
diff changeset
170 purple_markup_html_to_xhtml("<a>", &xhtml, &plaintext);
27450
7bdad85c5fed Use assert_string_equal_free() instead of just assert_string_equal()
Mark Doliner <mark@kingant.net>
parents: 27248
diff changeset
171 assert_string_equal_free("<a href=\"\"></a>", xhtml);
7bdad85c5fed Use assert_string_equal_free() instead of just assert_string_equal()
Mark Doliner <mark@kingant.net>
parents: 27248
diff changeset
172 assert_string_equal_free("", plaintext);
28906
68bc7c617fa0 Fix a corner case where purple_markup_html_to_xhtml generated malformed XHTML.
Paul Aurich <paul@darkrain42.org>
parents: 27469
diff changeset
173
68bc7c617fa0 Fix a corner case where purple_markup_html_to_xhtml generated malformed XHTML.
Paul Aurich <paul@darkrain42.org>
parents: 27469
diff changeset
174
68bc7c617fa0 Fix a corner case where purple_markup_html_to_xhtml generated malformed XHTML.
Paul Aurich <paul@darkrain42.org>
parents: 27469
diff changeset
175 purple_markup_html_to_xhtml("<FONT>x</FONT>", &xhtml, &plaintext);
68bc7c617fa0 Fix a corner case where purple_markup_html_to_xhtml generated malformed XHTML.
Paul Aurich <paul@darkrain42.org>
parents: 27469
diff changeset
176 assert_string_equal_free("x", xhtml);
68bc7c617fa0 Fix a corner case where purple_markup_html_to_xhtml generated malformed XHTML.
Paul Aurich <paul@darkrain42.org>
parents: 27469
diff changeset
177 assert_string_equal_free("x", plaintext);
21152
1dd6704cd187 Add a test for the html markup parsing to try to prevent a repeat of 2.2.2
Stu Tomlinson <stu@nosnilmot.com>
parents: 16004
diff changeset
178 }
1dd6704cd187 Add a test for the html markup parsing to try to prevent a repeat of 2.2.2
Stu Tomlinson <stu@nosnilmot.com>
parents: 16004
diff changeset
179 END_TEST
1dd6704cd187 Add a test for the html markup parsing to try to prevent a repeat of 2.2.2
Stu Tomlinson <stu@nosnilmot.com>
parents: 16004
diff changeset
180
29852
5bac51b394e6 util: Better validation of the allowed character values in XML 1.0
Paul Aurich <paul@darkrain42.org>
parents: 28906
diff changeset
181 START_TEST(test_utf8_strip_unprintables)
5bac51b394e6 util: Better validation of the allowed character values in XML 1.0
Paul Aurich <paul@darkrain42.org>
parents: 28906
diff changeset
182 {
5bac51b394e6 util: Better validation of the allowed character values in XML 1.0
Paul Aurich <paul@darkrain42.org>
parents: 28906
diff changeset
183 fail_unless(NULL == purple_utf8_strip_unprintables(NULL));
5bac51b394e6 util: Better validation of the allowed character values in XML 1.0
Paul Aurich <paul@darkrain42.org>
parents: 28906
diff changeset
184 /* invalid UTF-8 */
5bac51b394e6 util: Better validation of the allowed character values in XML 1.0
Paul Aurich <paul@darkrain42.org>
parents: 28906
diff changeset
185 #if 0
5bac51b394e6 util: Better validation of the allowed character values in XML 1.0
Paul Aurich <paul@darkrain42.org>
parents: 28906
diff changeset
186 /* disabled because make check fails on an assertion */
5bac51b394e6 util: Better validation of the allowed character values in XML 1.0
Paul Aurich <paul@darkrain42.org>
parents: 28906
diff changeset
187 fail_unless(NULL == purple_utf8_strip_unprintables("abc\x80\x7f"));
5bac51b394e6 util: Better validation of the allowed character values in XML 1.0
Paul Aurich <paul@darkrain42.org>
parents: 28906
diff changeset
188 #endif
5bac51b394e6 util: Better validation of the allowed character values in XML 1.0
Paul Aurich <paul@darkrain42.org>
parents: 28906
diff changeset
189 /* \t, \n, \r, space */
5bac51b394e6 util: Better validation of the allowed character values in XML 1.0
Paul Aurich <paul@darkrain42.org>
parents: 28906
diff changeset
190 assert_string_equal_free("ab \tcd\nef\r ", purple_utf8_strip_unprintables("ab \tcd\nef\r "));
29854
702ea988070c util tests: Add a test for all the lower-ASCII control characters excluding the
Paul Aurich <paul@darkrain42.org>
parents: 29852
diff changeset
191 /* ASCII control characters (stripped) */
702ea988070c util tests: Add a test for all the lower-ASCII control characters excluding the
Paul Aurich <paul@darkrain42.org>
parents: 29852
diff changeset
192 assert_string_equal_free(" aaaa ", purple_utf8_strip_unprintables(
702ea988070c util tests: Add a test for all the lower-ASCII control characters excluding the
Paul Aurich <paul@darkrain42.org>
parents: 29852
diff changeset
193 "\x01\x02\x03\x04\x05\x06\x07\x08\x0B\x0C\x0E\x0F\x10 aaaa "
702ea988070c util tests: Add a test for all the lower-ASCII control characters excluding the
Paul Aurich <paul@darkrain42.org>
parents: 29852
diff changeset
194 "\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F"));
29852
5bac51b394e6 util: Better validation of the allowed character values in XML 1.0
Paul Aurich <paul@darkrain42.org>
parents: 28906
diff changeset
195 /* Basic ASCII */
5bac51b394e6 util: Better validation of the allowed character values in XML 1.0
Paul Aurich <paul@darkrain42.org>
parents: 28906
diff changeset
196 assert_string_equal_free("Foobar", purple_utf8_strip_unprintables("Foobar"));
5bac51b394e6 util: Better validation of the allowed character values in XML 1.0
Paul Aurich <paul@darkrain42.org>
parents: 28906
diff changeset
197 /* 0xE000 - 0xFFFD (UTF-8 encoded) */
5bac51b394e6 util: Better validation of the allowed character values in XML 1.0
Paul Aurich <paul@darkrain42.org>
parents: 28906
diff changeset
198 /* U+F1F7 */
5bac51b394e6 util: Better validation of the allowed character values in XML 1.0
Paul Aurich <paul@darkrain42.org>
parents: 28906
diff changeset
199 assert_string_equal_free("aaaa\xef\x87\xb7", purple_utf8_strip_unprintables("aaaa\xef\x87\xb7"));
5bac51b394e6 util: Better validation of the allowed character values in XML 1.0
Paul Aurich <paul@darkrain42.org>
parents: 28906
diff changeset
200 #if 0
5bac51b394e6 util: Better validation of the allowed character values in XML 1.0
Paul Aurich <paul@darkrain42.org>
parents: 28906
diff changeset
201 /* disabled because make check fails on an assertion */
5bac51b394e6 util: Better validation of the allowed character values in XML 1.0
Paul Aurich <paul@darkrain42.org>
parents: 28906
diff changeset
202 /* U+DB80 (Private Use High Surrogate, First) -- should be stripped */
5bac51b394e6 util: Better validation of the allowed character values in XML 1.0
Paul Aurich <paul@darkrain42.org>
parents: 28906
diff changeset
203 assert_string_equal_free("aaaa", purple_utf8_strip_unprintables("aaaa\xed\xa0\x80"));
5bac51b394e6 util: Better validation of the allowed character values in XML 1.0
Paul Aurich <paul@darkrain42.org>
parents: 28906
diff changeset
204 /* U+FFFE (should be stripped) */
5bac51b394e6 util: Better validation of the allowed character values in XML 1.0
Paul Aurich <paul@darkrain42.org>
parents: 28906
diff changeset
205 assert_string_equal_free("aaaa", purple_utf8_strip_unprintables("aaaa\xef\xbf\xbe"));
5bac51b394e6 util: Better validation of the allowed character values in XML 1.0
Paul Aurich <paul@darkrain42.org>
parents: 28906
diff changeset
206 #endif
5bac51b394e6 util: Better validation of the allowed character values in XML 1.0
Paul Aurich <paul@darkrain42.org>
parents: 28906
diff changeset
207 /* U+FEFF (should not be stripped) */
5bac51b394e6 util: Better validation of the allowed character values in XML 1.0
Paul Aurich <paul@darkrain42.org>
parents: 28906
diff changeset
208 assert_string_equal_free("aaaa\xef\xbb\xbf", purple_utf8_strip_unprintables("aaaa\xef\xbb\xbf"));
5bac51b394e6 util: Better validation of the allowed character values in XML 1.0
Paul Aurich <paul@darkrain42.org>
parents: 28906
diff changeset
209 }
5bac51b394e6 util: Better validation of the allowed character values in XML 1.0
Paul Aurich <paul@darkrain42.org>
parents: 28906
diff changeset
210 END_TEST
5bac51b394e6 util: Better validation of the allowed character values in XML 1.0
Paul Aurich <paul@darkrain42.org>
parents: 28906
diff changeset
211
27248
6271a72ba4f6 * Use our assert_string_equal() macro instead of fail_unless(strcmp(), NULL)
Mark Doliner <mark@kingant.net>
parents: 26219
diff changeset
212 START_TEST(test_mime_decode_field)
6271a72ba4f6 * Use our assert_string_equal() macro instead of fail_unless(strcmp(), NULL)
Mark Doliner <mark@kingant.net>
parents: 26219
diff changeset
213 {
6271a72ba4f6 * Use our assert_string_equal() macro instead of fail_unless(strcmp(), NULL)
Mark Doliner <mark@kingant.net>
parents: 26219
diff changeset
214 gchar *result = purple_mime_decode_field("=?ISO-8859-1?Q?Keld_J=F8rn_Simonsen?=");
27450
7bdad85c5fed Use assert_string_equal_free() instead of just assert_string_equal()
Mark Doliner <mark@kingant.net>
parents: 27248
diff changeset
215 assert_string_equal_free("Keld Jørn Simonsen", result);
27248
6271a72ba4f6 * Use our assert_string_equal() macro instead of fail_unless(strcmp(), NULL)
Mark Doliner <mark@kingant.net>
parents: 26219
diff changeset
216 }
6271a72ba4f6 * Use our assert_string_equal() macro instead of fail_unless(strcmp(), NULL)
Mark Doliner <mark@kingant.net>
parents: 26219
diff changeset
217 END_TEST
6271a72ba4f6 * Use our assert_string_equal() macro instead of fail_unless(strcmp(), NULL)
Mark Doliner <mark@kingant.net>
parents: 26219
diff changeset
218
31797
f452f20502a4 A unit test check from the EFF
Mark Doliner <mark@kingant.net>
parents: 31264
diff changeset
219 START_TEST(test_strdup_withhtml)
f452f20502a4 A unit test check from the EFF
Mark Doliner <mark@kingant.net>
parents: 31264
diff changeset
220 {
f452f20502a4 A unit test check from the EFF
Mark Doliner <mark@kingant.net>
parents: 31264
diff changeset
221 gchar *result = purple_strdup_withhtml("hi\r\nthere\n");
f452f20502a4 A unit test check from the EFF
Mark Doliner <mark@kingant.net>
parents: 31264
diff changeset
222 assert_string_equal_free("hi<BR>there<BR>", result);
f452f20502a4 A unit test check from the EFF
Mark Doliner <mark@kingant.net>
parents: 31264
diff changeset
223 }
f452f20502a4 A unit test check from the EFF
Mark Doliner <mark@kingant.net>
parents: 31264
diff changeset
224 END_TEST
f452f20502a4 A unit test check from the EFF
Mark Doliner <mark@kingant.net>
parents: 31264
diff changeset
225
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
226 Suite *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
227 util_suite(void)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
228 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
229 Suite *s = suite_create("Utility Functions");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
230
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
231 TCase *tc = tcase_create("Base16");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
232 tcase_add_test(tc, test_util_base16_encode);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
233 tcase_add_test(tc, test_util_base16_decode);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
234 suite_add_tcase(s, tc);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
235
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
236 tc = tcase_create("Base64");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
237 tcase_add_test(tc, test_util_base64_encode);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
238 tcase_add_test(tc, test_util_base64_decode);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
239 suite_add_tcase(s, tc);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
240
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
241 tc = tcase_create("Filenames");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
242 tcase_add_test(tc, test_util_escape_filename);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
243 tcase_add_test(tc, test_util_unescape_filename);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
244 suite_add_tcase(s, tc);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
245
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
246 tc = tcase_create("Strip Mnemonic");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
247 tcase_add_test(tc, test_util_text_strip_mnemonic);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
248 suite_add_tcase(s, tc);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
249
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
250 tc = tcase_create("Email");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
251 tcase_add_test(tc, test_util_email_is_valid);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
252 suite_add_tcase(s, tc);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
253
27469
8c41a23e6b44 Add purple_ipv6_address_is_valid; guess what it does?
Paul Aurich <paul@darkrain42.org>
parents: 27450
diff changeset
254 tc = tcase_create("IPv6");
8c41a23e6b44 Add purple_ipv6_address_is_valid; guess what it does?
Paul Aurich <paul@darkrain42.org>
parents: 27450
diff changeset
255 tcase_add_test(tc, test_util_ipv6_is_valid);
8c41a23e6b44 Add purple_ipv6_address_is_valid; guess what it does?
Paul Aurich <paul@darkrain42.org>
parents: 27450
diff changeset
256 suite_add_tcase(s, tc);
8c41a23e6b44 Add purple_ipv6_address_is_valid; guess what it does?
Paul Aurich <paul@darkrain42.org>
parents: 27450
diff changeset
257
16004
b4593c886933 fix our string-to-time function, and add a couple tests for it
Nathan Walp <nwalp@pidgin.im>
parents: 15888
diff changeset
258 tc = tcase_create("Time");
b4593c886933 fix our string-to-time function, and add a couple tests for it
Nathan Walp <nwalp@pidgin.im>
parents: 15888
diff changeset
259 tcase_add_test(tc, test_util_str_to_time);
b4593c886933 fix our string-to-time function, and add a couple tests for it
Nathan Walp <nwalp@pidgin.im>
parents: 15888
diff changeset
260 suite_add_tcase(s, tc);
b4593c886933 fix our string-to-time function, and add a couple tests for it
Nathan Walp <nwalp@pidgin.im>
parents: 15888
diff changeset
261
21152
1dd6704cd187 Add a test for the html markup parsing to try to prevent a repeat of 2.2.2
Stu Tomlinson <stu@nosnilmot.com>
parents: 16004
diff changeset
262 tc = tcase_create("Markup");
1dd6704cd187 Add a test for the html markup parsing to try to prevent a repeat of 2.2.2
Stu Tomlinson <stu@nosnilmot.com>
parents: 16004
diff changeset
263 tcase_add_test(tc, test_markup_html_to_xhtml);
1dd6704cd187 Add a test for the html markup parsing to try to prevent a repeat of 2.2.2
Stu Tomlinson <stu@nosnilmot.com>
parents: 16004
diff changeset
264 suite_add_tcase(s, tc);
1dd6704cd187 Add a test for the html markup parsing to try to prevent a repeat of 2.2.2
Stu Tomlinson <stu@nosnilmot.com>
parents: 16004
diff changeset
265
29852
5bac51b394e6 util: Better validation of the allowed character values in XML 1.0
Paul Aurich <paul@darkrain42.org>
parents: 28906
diff changeset
266 tc = tcase_create("Stripping Unparseables");
5bac51b394e6 util: Better validation of the allowed character values in XML 1.0
Paul Aurich <paul@darkrain42.org>
parents: 28906
diff changeset
267 tcase_add_test(tc, test_utf8_strip_unprintables);
5bac51b394e6 util: Better validation of the allowed character values in XML 1.0
Paul Aurich <paul@darkrain42.org>
parents: 28906
diff changeset
268 suite_add_tcase(s, tc);
5bac51b394e6 util: Better validation of the allowed character values in XML 1.0
Paul Aurich <paul@darkrain42.org>
parents: 28906
diff changeset
269
27248
6271a72ba4f6 * Use our assert_string_equal() macro instead of fail_unless(strcmp(), NULL)
Mark Doliner <mark@kingant.net>
parents: 26219
diff changeset
270 tc = tcase_create("MIME");
6271a72ba4f6 * Use our assert_string_equal() macro instead of fail_unless(strcmp(), NULL)
Mark Doliner <mark@kingant.net>
parents: 26219
diff changeset
271 tcase_add_test(tc, test_mime_decode_field);
6271a72ba4f6 * Use our assert_string_equal() macro instead of fail_unless(strcmp(), NULL)
Mark Doliner <mark@kingant.net>
parents: 26219
diff changeset
272 suite_add_tcase(s, tc);
6271a72ba4f6 * Use our assert_string_equal() macro instead of fail_unless(strcmp(), NULL)
Mark Doliner <mark@kingant.net>
parents: 26219
diff changeset
273
31797
f452f20502a4 A unit test check from the EFF
Mark Doliner <mark@kingant.net>
parents: 31264
diff changeset
274 tc = tcase_create("strdup_withhtml");
f452f20502a4 A unit test check from the EFF
Mark Doliner <mark@kingant.net>
parents: 31264
diff changeset
275 tcase_add_test(tc, test_strdup_withhtml);
f452f20502a4 A unit test check from the EFF
Mark Doliner <mark@kingant.net>
parents: 31264
diff changeset
276 suite_add_tcase(s, tc);
f452f20502a4 A unit test check from the EFF
Mark Doliner <mark@kingant.net>
parents: 31264
diff changeset
277
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
278 return s;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
279 }