2010-04-16 Sebastien Pouliot <sebastien@ximian.com>
[mono/afaerber.git] / eglib / test / unicode.c
blobc1c3402ba8ecc219b65e0829eb4a8f6cbb9b5893
1 #include "test.h"
3 /*
4 * g_unichar_type
5 */
6 RESULT
7 test_g_unichar_type ()
9 if (g_unichar_type ('A') != G_UNICODE_UPPERCASE_LETTER)
10 return FAILED ("#1");
11 if (g_unichar_type ('a') != G_UNICODE_LOWERCASE_LETTER)
12 return FAILED ("#2");
13 if (g_unichar_type ('1') != G_UNICODE_DECIMAL_NUMBER)
14 return FAILED ("#3");
15 if (g_unichar_type (0xA3) != G_UNICODE_CURRENCY_SYMBOL)
16 return FAILED ("#4");
17 return NULL;
21 * g_unichar_toupper
23 RESULT
24 test_g_unichar_toupper ()
26 if (g_unichar_toupper (0) != 0)
27 return FAILED ("#0");
28 if (g_unichar_toupper ('a') != 'A')
29 return FAILED ("#1");
30 if (g_unichar_toupper ('1') != '1')
31 return FAILED ("#2");
32 if (g_unichar_toupper (0x1C4) != 0x1C4)
33 return FAILED ("#3");
34 if (g_unichar_toupper (0x1F2) != 0x1F1)
35 return FAILED ("#4");
36 if (g_unichar_toupper (0x1F3) != 0x1F1)
37 return FAILED ("#5");
38 if (g_unichar_toupper (0xFFFF) != 0xFFFF)
39 return FAILED ("#6");
40 if (g_unichar_toupper (0x10428) != 0x10400)
41 return FAILED ("#7");
42 return NULL;
46 * g_unichar_tolower
48 RESULT
49 test_g_unichar_tolower ()
51 if (g_unichar_tolower (0) != 0)
52 return FAILED ("#0");
53 if (g_unichar_tolower ('A') != 'a')
54 return FAILED ("#1");
55 if (g_unichar_tolower ('1') != '1')
56 return FAILED ("#2");
57 if (g_unichar_tolower (0x1C5) != 0x1C6)
58 return FAILED ("#3");
59 if (g_unichar_tolower (0x1F1) != 0x1F3)
60 return FAILED ("#4");
61 if (g_unichar_tolower (0x1F2) != 0x1F3)
62 return FAILED ("#5");
63 if (g_unichar_tolower (0xFFFF) != 0xFFFF)
64 return FAILED ("#6");
65 return NULL;
69 * g_unichar_totitle
71 RESULT
72 test_g_unichar_totitle ()
74 if (g_unichar_toupper (0) != 0)
75 return FAILED ("#0");
76 if (g_unichar_totitle ('a') != 'A')
77 return FAILED ("#1");
78 if (g_unichar_totitle ('1') != '1')
79 return FAILED ("#2");
80 if (g_unichar_totitle (0x1C4) != 0x1C5)
81 return FAILED ("#3");
82 if (g_unichar_totitle (0x1F2) != 0x1F2)
83 return FAILED ("#4");
84 if (g_unichar_totitle (0x1F3) != 0x1F2)
85 return FAILED ("#5");
86 if (g_unichar_toupper (0xFFFF) != 0xFFFF)
87 return FAILED ("#6");
88 return NULL;
91 static Test unicode_tests [] = {
92 {"g_unichar_type", test_g_unichar_type},
93 {"g_unichar_toupper", test_g_unichar_toupper},
94 {"g_unichar_tolower", test_g_unichar_tolower},
95 {"g_unichar_totitle", test_g_unichar_totitle},
96 {NULL, NULL}
99 DEFINE_TEST_GROUP_INIT(unicode_tests_init, unicode_tests)