comparison libpurple/tests/test_yahoo_util.c @ 28347:c69c79921f93

Check in some more tests, most of which are not compiled yet. I think they don't pass yet. I'm planning on working on it in the future
author Mark Doliner <mark@kingant.net>
date Tue, 18 Aug 2009 23:03:47 +0000
parents 1e02e65ce301
children 617e7a90b69c
comparison
equal deleted inserted replaced
28346:6b66226f6e03 28347:c69c79921f93
23 yahoo_codes_to_html("plain <peanut>")); 23 yahoo_codes_to_html("plain <peanut>"));
24 assert_string_equal_free("plain &lt;peanut", 24 assert_string_equal_free("plain &lt;peanut",
25 yahoo_codes_to_html("plain <peanut")); 25 yahoo_codes_to_html("plain <peanut"));
26 assert_string_equal_free("plain&gt; peanut", 26 assert_string_equal_free("plain&gt; peanut",
27 yahoo_codes_to_html("plain> peanut")); 27 yahoo_codes_to_html("plain> peanut"));
28 assert_string_equal_free("<font face='inva&gt;lid'>test</font>",
29 yahoo_codes_to_html("<font face='inva>lid'>test"));
30 assert_string_equal_free("&lt;font face=&apos;inva&gt;lid",
31 yahoo_codes_to_html("<font face='inva>lid"));
28 32
29 /* bold/italic/underline */ 33 /* bold/italic/underline */
30 assert_string_equal_free("<b>bold</b>", 34 assert_string_equal_free("<b>bold</b>",
31 yahoo_codes_to_html("\x1B[1mbold")); 35 yahoo_codes_to_html("\x1B[1mbold"));
32 assert_string_equal_free("<i>italic</i>", 36 assert_string_equal_free("<i>italic</i>",
94 yahoo_codes_to_html("\x1B[35m<font size='15'>test")); 98 yahoo_codes_to_html("\x1B[35m<font size='15'>test"));
95 #endif /* !USE_CSS_FORMATTING */ 99 #endif /* !USE_CSS_FORMATTING */
96 } 100 }
97 END_TEST 101 END_TEST
98 102
103 #if 0
104 START_TEST(test_html_to_codes)
105 {
106 assert_string_equal_free("plain",
107 yahoo_html_to_codes("plain"));
108 assert_string_equal_free("plain <peanut>",
109 yahoo_html_to_codes("plain &lt;peanut&gt;"));
110 assert_string_equal_free("plain <peanut",
111 yahoo_html_to_codes("plain &lt;peanut"));
112 assert_string_equal_free("plain> peanut",
113 yahoo_html_to_codes("plain&gt; peanut"));
114 assert_string_equal_free("plain >",
115 yahoo_html_to_codes("plain &gt;"));
116 assert_string_equal_free("plain > ",
117 yahoo_html_to_codes("plain &gt; "));
118 assert_string_equal_free("plain <",
119 yahoo_html_to_codes("plain &lt;"));
120 assert_string_equal_free("plain < ",
121 yahoo_html_to_codes("plain &lt; "));
122 assert_string_equal_free("plain &lt",
123 yahoo_html_to_codes("plain &lt"));
124 assert_string_equal_free("plain &",
125 yahoo_html_to_codes("plain &amp;"));
126
127 /* bold/italic/underline */
128 // MARK: This isn't correct. Should not have the closing bold escape code
129 assert_string_equal_free("\x1B[1mbold\x1B[x1m",
130 yahoo_html_to_codes("<b>bold</b>"));
131 assert_string_equal_free("\x1B[2mitalic\x1B[x2m",
132 yahoo_html_to_codes("<i>italic</i>"));
133 assert_string_equal_free("\x1B[4munderline\x1B[x4m",
134 yahoo_html_to_codes("<u>underline</u>"));
135 assert_string_equal_free("no markup",
136 yahoo_html_to_codes("no</u> markup"));
137 assert_string_equal_free("\x1B[1mbold\x1B[x1m \x1B[2mitalic\x1B[x2m \x1B[4munderline\x1B[x4m",
138 yahoo_html_to_codes("<b>bold</b> <i>italic</i> <u>underline</u>"));
139 assert_string_equal_free("\x1B[1mbold \x1B[2mbolditalic\x1B[x1m italic\x1B[x1m",
140 yahoo_html_to_codes("<b>bold <i>bolditalic</i></b><i> italic</i>"));
141 assert_string_equal_free("\x1B[1mbold \x1B[2mbolditalic\x1B[x1m \x1B[4mitalicunderline",
142 yahoo_html_to_codes("<b>bold <i>bolditalic</i></b><i> <u>italicunderline</u></i>"));
143 }
144 END_TEST
145 #endif
146
99 Suite * 147 Suite *
100 yahoo_util_suite(void) 148 yahoo_util_suite(void)
101 { 149 {
102 Suite *s = suite_create("Yahoo Utility Functions"); 150 Suite *s;
151 TCase *tc;
103 152
104 TCase *tc = tcase_create("Convert to Numeric"); 153 s = suite_create("Yahoo Utility Functions");
154
155 tc = tcase_create("Convert IM from network format to HTML");
105 tcase_add_unchecked_fixture(tc, setup_codes_to_html, teardown_codes_to_html); 156 tcase_add_unchecked_fixture(tc, setup_codes_to_html, teardown_codes_to_html);
106 tcase_add_test(tc, test_codes_to_html); 157 tcase_add_test(tc, test_codes_to_html);
107 suite_add_tcase(s, tc); 158 suite_add_tcase(s, tc);
108 159
160 #if 0
161 tc = tcase_create("Convert IM from HTML to network format");
162 tcase_add_test(tc, test_html_to_codes);
163 suite_add_tcase(s, tc);
164 #endif
165
109 return s; 166 return s;
110 } 167 }