Update contrib.
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
25 #undef G_DISABLE_ASSERT
32 #include <glib/gprintf.h>
35 #include "mrt2_glib2_test.h"
42 void g_unichar_digit_value_test()
47 i=g_unichar_digit_value(str);
50 g_printf("g_unichar_digit_value failed,str ='a' \n");
51 g_assert(FALSE && "g_unichar_digit_value failed str ='a'\n");
54 i=g_unichar_digit_value(dig);
57 g_print("g_unichar_digit_value failed,str ='7' \n");
58 g_assert(FALSE && "g_unichar_digit_value failed str ='7'\n");
63 void g_unichar_isalnum_test()
66 res=g_unichar_isalnum(str);
69 g_print("g_unichar_isalnum failed,str ='8' \n");
70 g_assert(FALSE && "g_unichar_isalnum failed\n");
75 void g_unichar_iscntrl_test()
78 res=g_unichar_iscntrl(str);
81 g_print("g_unichar_iscntrl failed,str ='\n' \n");
82 g_assert(FALSE && "g_unichar_iscntrl failed\n");
84 //g_assert(res==TRUE);
86 res=g_unichar_iscntrl(str);
89 g_print("g_unichar_iscntrl failed , str ='a'\n");
90 g_assert(FALSE && "g_unichar_iscntrl failed\n");
92 //g_assert(g_unichar_iscntrl(str)==FALSE);
97 void g_unichar_isdigit_test()
100 res=g_unichar_isdigit(str);
103 g_print("g_unichar_isdigit failed,str ='\n' \n");
104 g_assert(FALSE && "g_unichar_isdigit failed\n");
106 //g_assert(res==TRUE);
108 res=g_unichar_isdigit(str);
111 g_print("g_unichar_iscntrl failed , str ='a'\n");
112 g_assert(FALSE && "g_unichar_iscntrl failed\n");
114 //g_assert(g_unichar_iscntrl(str)==FALSE);
118 void g_unichar_islower_test()
121 res=g_unichar_islower(str);
124 g_print("g_unichar_islower failed,str ='\n' \n");
125 g_assert(FALSE && "g_unichar_islower failed\n");
127 //g_assert(res==TRUE);
129 res=g_unichar_islower(str);
132 g_print("g_unichar_islower failed , str ='a'\n");
133 g_assert(FALSE && "g_unichar_islower failed\n");
137 void g_unichar_ispunct_test()
140 res=g_unichar_ispunct(str);
143 g_print("g_unichar_ispunct failed,str ='\n' \n");
144 g_assert(FALSE && "g_unichar_ispunct failed\n");
146 //g_assert(res==TRUE);
148 res=g_unichar_ispunct(str);
151 g_print("g_unichar_ispunct failed , str ='a'\n");
152 g_assert(FALSE && "g_unichar_ispunct failed\n");
157 void g_unichar_isupper_test()
160 res=g_unichar_isupper(str);
163 g_print("g_unichar_isupper failed '\n' \n");
164 g_assert(FALSE && "g_unichar_isupper failed\n");
166 //g_assert(res==TRUE);
168 res=g_unichar_isupper(str);
171 g_print("g_unichar_isupper failed \n");
172 g_assert(FALSE && "g_unichar_isupper failed\n");
176 void g_unichar_isxdigit_test()
179 res=g_unichar_isxdigit(str);
182 g_print("g_unichar_isxdigit failed '\n' \n");
183 g_assert(FALSE && "g_unichar_isxdigit failed\n");
185 //g_assert(res==TRUE);
187 res=g_unichar_isxdigit(str);
190 g_print("g_unichar_isxdigit failed \n");
191 g_assert(FALSE && "g_unichar_isxdigit failed\n");
195 void g_unichar_xdigit_value_test()
199 i=g_unichar_xdigit_value(str);
202 g_print("g_unichar_xdigit_value failed \n");
203 g_assert(FALSE && "g_unichar_xdigit_value failed\n");
207 i=g_unichar_xdigit_value(str);
210 g_print("g_unichar_xdigit_value failed \n");
211 g_assert(FALSE && "g_unichar_xdigit_value failed\n");
215 //g_assert(res==TRUE);
217 i=g_unichar_xdigit_value(str);
220 g_print("g_unichar_xdigit_value failed \n");
221 g_assert(FALSE && "g_unichar_xdigit_value failed\n");
226 void g_unichar_isgraph_test()
229 res=g_unichar_isgraph(str);
232 g_print("g_unichar_isgraph failed '\n' \n");
233 g_assert(FALSE && "g_unichar_isgraph failed\n");
235 //g_assert(res==TRUE);
237 res=g_unichar_isgraph(str);
240 g_print("g_unichar_isgraph failed \n");
241 g_assert(FALSE && "g_unichar_isgraph failed\n");
245 void g_unichar_isspace_test()
248 res=g_unichar_isspace(str);
251 g_print("g_unichar_isspace failed '\n' \n");
252 g_assert(FALSE && "g_unichar_isspace failed\n");
254 //g_assert(res==TRUE);
256 res=g_unichar_isspace(str);
259 g_print("g_unichar_isspace failed \n");
260 g_assert(FALSE && "g_unichar_isspace failed\n");
264 void g_unichar_isprint_test()
269 res=g_unichar_isprint(str1);
270 res1=g_unichar_isprint(str2);
271 if(res!=TRUE || res1!=TRUE)
273 g_print("g_unichar_isprint failed\n");
274 g_assert(FALSE && "g_unichar_isprint failed\n");
277 res=g_unichar_isprint(str1);
280 g_print("g_unichar_isprint failed\n");
281 g_assert(FALSE && "g_unichar_isprint failed\n");
292 g_log_set_handler (NULL, G_LOG_FLAG_FATAL| G_LOG_FLAG_RECURSION | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING | G_LOG_LEVEL_MESSAGE | G_LOG_LEVEL_INFO | G_LOG_LEVEL_DEBUG, &mrtLogHandler, NULL);
295 g_unichar_digit_value_test();
296 g_unichar_isalnum_test();
297 g_unichar_iscntrl_test();
298 g_unichar_islower_test();
299 g_unichar_isupper_test();
300 g_unichar_isxdigit_test();
301 g_unichar_xdigit_value_test();
302 g_unichar_isgraph_test();
303 g_unichar_ispunct_test();
304 g_unichar_isspace_test();
305 g_unichar_isdigit_test();
306 g_unichar_isprint_test();
310 testResultXml("unichar_test");
311 #endif /* EMULATOR */