annotate libpurple/tests/test_yahoo_util.c @ 28086:1b5b24dc0310

Whoops, I forgot to add the test! Also change Yahoo to send lowercase tags to libpurple Yes, these probably should have been two separate commits.
author Mark Doliner <mark@kingant.net>
date Fri, 31 Jul 2009 01:06:42 +0000
parents
children 1b440a47dc04
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
28086
1b5b24dc0310 Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1 #include <string.h>
1b5b24dc0310 Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff changeset
2
1b5b24dc0310 Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff changeset
3 #include "tests.h"
1b5b24dc0310 Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff changeset
4 #include "../protocols/yahoo/libymsg.h"
1b5b24dc0310 Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff changeset
5
1b5b24dc0310 Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff changeset
6 static void setup_codes_to_html(void)
1b5b24dc0310 Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff changeset
7 {
1b5b24dc0310 Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff changeset
8 yahoo_init_colorht();
1b5b24dc0310 Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff changeset
9 }
1b5b24dc0310 Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff changeset
10
1b5b24dc0310 Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff changeset
11 static void teardown_codes_to_html(void)
1b5b24dc0310 Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff changeset
12 {
1b5b24dc0310 Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff changeset
13 yahoo_dest_colorht();
1b5b24dc0310 Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff changeset
14 }
1b5b24dc0310 Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff changeset
15
1b5b24dc0310 Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff changeset
16 START_TEST(test_codes_to_html)
1b5b24dc0310 Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff changeset
17 {
1b5b24dc0310 Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff changeset
18 assert_string_equal_free("plain", yahoo_codes_to_html("plain"));
1b5b24dc0310 Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff changeset
19 assert_string_equal_free("<b>bold", yahoo_codes_to_html("\x1B[1mbold"));
1b5b24dc0310 Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff changeset
20 assert_string_equal_free("<i>italic", yahoo_codes_to_html("\x1B[2mitalic"));
1b5b24dc0310 Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff changeset
21 assert_string_equal_free("<u>underline", yahoo_codes_to_html("\x1B[4munderline"));
1b5b24dc0310 Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff changeset
22 assert_string_equal_free("<b>bold</b> <i>italic</i> <u>underline", yahoo_codes_to_html("\x1B[1mbold\x1B[x1m \x1B[2mitalic\x1B[x2m \x1B[4munderline"));
1b5b24dc0310 Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff changeset
23 }
1b5b24dc0310 Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff changeset
24 END_TEST
1b5b24dc0310 Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff changeset
25
1b5b24dc0310 Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff changeset
26 Suite *
1b5b24dc0310 Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff changeset
27 yahoo_util_suite(void)
1b5b24dc0310 Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff changeset
28 {
1b5b24dc0310 Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff changeset
29 Suite *s = suite_create("Yahoo Utility Functions");
1b5b24dc0310 Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff changeset
30
1b5b24dc0310 Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff changeset
31 TCase *tc = tcase_create("Convert to Numeric");
1b5b24dc0310 Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff changeset
32 tcase_add_unchecked_fixture(tc, setup_codes_to_html, teardown_codes_to_html);
1b5b24dc0310 Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff changeset
33 tcase_add_test(tc, test_codes_to_html);
1b5b24dc0310 Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff changeset
34 suite_add_tcase(s, tc);
1b5b24dc0310 Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff changeset
35
1b5b24dc0310 Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff changeset
36 return s;
1b5b24dc0310 Whoops, I forgot to add the test!
Mark Doliner <mark@kingant.net>
parents:
diff changeset
37 }