Mercurial > pidgin.yaz
comparison libpurple/tests/test_util.c @ 27526:7bdad85c5fed
Use assert_string_equal_free() instead of just assert_string_equal()
What a great macro!
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Fri, 10 Jul 2009 05:05:51 +0000 |
parents | 6271a72ba4f6 |
children | 8c41a23e6b44 |
comparison
equal
deleted
inserted
replaced
27525:91b8a957776a | 27526:7bdad85c5fed |
---|---|
12 START_TEST(test_util_base16_decode) | 12 START_TEST(test_util_base16_decode) |
13 { | 13 { |
14 gsize sz = 0; | 14 gsize sz = 0; |
15 guchar *out = purple_base16_decode("21646c726f77202c6f6c6c656800", &sz); | 15 guchar *out = purple_base16_decode("21646c726f77202c6f6c6c656800", &sz); |
16 fail_unless(sz == 14, NULL); | 16 fail_unless(sz == 14, NULL); |
17 assert_string_equal("!dlrow ,olleh", (const char *)out); | 17 assert_string_equal_free("!dlrow ,olleh", (char *)out); |
18 g_free(out); | |
19 } | 18 } |
20 END_TEST | 19 END_TEST |
21 | 20 |
22 START_TEST(test_util_base64_encode) | 21 START_TEST(test_util_base64_encode) |
23 { | 22 { |
28 START_TEST(test_util_base64_decode) | 27 START_TEST(test_util_base64_decode) |
29 { | 28 { |
30 gsize sz; | 29 gsize sz; |
31 guchar *out = purple_base64_decode("b3d0LXl0cm9mAA==", &sz); | 30 guchar *out = purple_base64_decode("b3d0LXl0cm9mAA==", &sz); |
32 fail_unless(sz == 10, NULL); | 31 fail_unless(sz == 10, NULL); |
33 assert_string_equal("owt-ytrof", (const char *)out); | 32 assert_string_equal_free("owt-ytrof", (char *)out); |
34 g_free(out); | |
35 } | 33 } |
36 END_TEST | 34 END_TEST |
37 | 35 |
38 START_TEST(test_util_escape_filename) | 36 START_TEST(test_util_escape_filename) |
39 { | 37 { |
92 START_TEST(test_markup_html_to_xhtml) | 90 START_TEST(test_markup_html_to_xhtml) |
93 { | 91 { |
94 gchar *xhtml = NULL; | 92 gchar *xhtml = NULL; |
95 gchar *plaintext = NULL; | 93 gchar *plaintext = NULL; |
96 purple_markup_html_to_xhtml("<a>", &xhtml, &plaintext); | 94 purple_markup_html_to_xhtml("<a>", &xhtml, &plaintext); |
97 assert_string_equal("<a href=\"\"></a>", xhtml); | 95 assert_string_equal_free("<a href=\"\"></a>", xhtml); |
98 g_free(xhtml); | 96 assert_string_equal_free("", plaintext); |
99 assert_string_equal("", plaintext); | |
100 g_free(plaintext); | |
101 } | 97 } |
102 END_TEST | 98 END_TEST |
103 | 99 |
104 START_TEST(test_mime_decode_field) | 100 START_TEST(test_mime_decode_field) |
105 { | 101 { |
106 gchar *result = purple_mime_decode_field("=?ISO-8859-1?Q?Keld_J=F8rn_Simonsen?="); | 102 gchar *result = purple_mime_decode_field("=?ISO-8859-1?Q?Keld_J=F8rn_Simonsen?="); |
107 assert_string_equal("Keld Jørn Simonsen", result); | 103 assert_string_equal_free("Keld Jørn Simonsen", result); |
108 g_free(result); | |
109 } | 104 } |
110 END_TEST | 105 END_TEST |
111 | 106 |
112 Suite * | 107 Suite * |
113 util_suite(void) | 108 util_suite(void) |