1 /* Unit tests for utilities
2 * Copyright (C) 2010 Red Hat, Inc.
3 * Copyright (C) 2011 Google, Inc.
5 * This work is provided "as is"; redistribution and modification
6 * in whole or in part, in any medium, physical or electronic is
7 * permitted without restriction.
9 * This work 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.
13 * In no event shall the authors or contributors be liable for any
14 * direct, indirect, incidental, special, exemplary, or consequential
15 * damages (including, but not limited to, procurement of substitute
16 * goods or services; loss of use, data, or profits; or business
17 * interruption) however caused and on any theory of liability, whether
18 * in contract, strict liability, or tort (including negligence or
19 * otherwise) arising in any way out of the use of this software, even
20 * if advised of the possibility of such damage.
22 * Author: Matthias Clasen, Behdad Esfahbod
25 /* We are testing some deprecated APIs here */
26 #define GLIB_DISABLE_DEPRECATION_WARNINGS
31 test_unichar_validate (void)
33 g_assert (g_unichar_validate ('j'));
34 g_assert (g_unichar_validate (8356));
35 g_assert (g_unichar_validate (8356));
36 g_assert (g_unichar_validate (0xfdd1));
37 g_assert (g_unichar_validate (917760));
38 g_assert (!g_unichar_validate (0x110000));
42 test_unichar_character_type (void)
49 { G_UNICODE_CONTROL
, 0x000D },
50 { G_UNICODE_FORMAT
, 0x200E },
51 /* G_UNICODE_UNASSIGNED */
52 { G_UNICODE_PRIVATE_USE
, 0xE000 },
53 { G_UNICODE_SURROGATE
, 0xD800 },
54 { G_UNICODE_LOWERCASE_LETTER
, 0x0061 },
55 { G_UNICODE_MODIFIER_LETTER
, 0x02B0 },
56 { G_UNICODE_OTHER_LETTER
, 0x3400 },
57 { G_UNICODE_TITLECASE_LETTER
, 0x01C5 },
58 { G_UNICODE_UPPERCASE_LETTER
, 0xFF21 },
59 { G_UNICODE_COMBINING_MARK
, 0x0903 },
60 { G_UNICODE_ENCLOSING_MARK
, 0x20DD },
61 { G_UNICODE_NON_SPACING_MARK
, 0xA806 },
62 { G_UNICODE_DECIMAL_NUMBER
, 0xFF10 },
63 { G_UNICODE_LETTER_NUMBER
, 0x16EE },
64 { G_UNICODE_OTHER_NUMBER
, 0x17F0 },
65 { G_UNICODE_CONNECT_PUNCTUATION
, 0x005F },
66 { G_UNICODE_DASH_PUNCTUATION
, 0x058A },
67 { G_UNICODE_CLOSE_PUNCTUATION
, 0x0F3B },
68 { G_UNICODE_FINAL_PUNCTUATION
, 0x2019 },
69 { G_UNICODE_INITIAL_PUNCTUATION
, 0x2018 },
70 { G_UNICODE_OTHER_PUNCTUATION
, 0x2016 },
71 { G_UNICODE_OPEN_PUNCTUATION
, 0x0F3A },
72 { G_UNICODE_CURRENCY_SYMBOL
, 0x20A0 },
73 { G_UNICODE_MODIFIER_SYMBOL
, 0x309B },
74 { G_UNICODE_MATH_SYMBOL
, 0xFB29 },
75 { G_UNICODE_OTHER_SYMBOL
, 0x00A6 },
76 { G_UNICODE_LINE_SEPARATOR
, 0x2028 },
77 { G_UNICODE_PARAGRAPH_SEPARATOR
, 0x2029 },
78 { G_UNICODE_SPACE_SEPARATOR
, 0x202F },
81 for (i
= 0; i
< G_N_ELEMENTS (examples
); i
++)
83 g_assert_cmpint (g_unichar_type (examples
[i
].c
), ==, examples
[i
].type
);
88 test_unichar_break_type (void)
92 GUnicodeBreakType type
;
95 { G_UNICODE_BREAK_MANDATORY
, 0x2028 },
96 { G_UNICODE_BREAK_CARRIAGE_RETURN
, 0x000D },
97 { G_UNICODE_BREAK_LINE_FEED
, 0x000A },
98 { G_UNICODE_BREAK_COMBINING_MARK
, 0x0300 },
99 { G_UNICODE_BREAK_SURROGATE
, 0xD800 },
100 { G_UNICODE_BREAK_ZERO_WIDTH_SPACE
, 0x200B },
101 { G_UNICODE_BREAK_INSEPARABLE
, 0x2024 },
102 { G_UNICODE_BREAK_NON_BREAKING_GLUE
, 0x00A0 },
103 { G_UNICODE_BREAK_CONTINGENT
, 0xFFFC },
104 { G_UNICODE_BREAK_SPACE
, 0x0020 },
105 { G_UNICODE_BREAK_AFTER
, 0x05BE },
106 { G_UNICODE_BREAK_BEFORE
, 0x02C8 },
107 { G_UNICODE_BREAK_BEFORE_AND_AFTER
, 0x2014 },
108 { G_UNICODE_BREAK_HYPHEN
, 0x002D },
109 { G_UNICODE_BREAK_NON_STARTER
, 0x17D6 },
110 { G_UNICODE_BREAK_OPEN_PUNCTUATION
, 0x0028 },
111 { G_UNICODE_BREAK_CLOSE_PARANTHESIS
, 0x0029 },
112 { G_UNICODE_BREAK_CLOSE_PUNCTUATION
, 0x007D },
113 { G_UNICODE_BREAK_QUOTATION
, 0x0022 },
114 { G_UNICODE_BREAK_EXCLAMATION
, 0x0021 },
115 { G_UNICODE_BREAK_IDEOGRAPHIC
, 0x2E80 },
116 { G_UNICODE_BREAK_NUMERIC
, 0x0030 },
117 { G_UNICODE_BREAK_INFIX_SEPARATOR
, 0x002C },
118 { G_UNICODE_BREAK_SYMBOL
, 0x002F },
119 { G_UNICODE_BREAK_ALPHABETIC
, 0x0023 },
120 { G_UNICODE_BREAK_PREFIX
, 0x0024 },
121 { G_UNICODE_BREAK_POSTFIX
, 0x0025 },
122 { G_UNICODE_BREAK_COMPLEX_CONTEXT
, 0x0E01 },
123 { G_UNICODE_BREAK_AMBIGUOUS
, 0x00F7 },
124 { G_UNICODE_BREAK_UNKNOWN
, 0xE000 },
125 { G_UNICODE_BREAK_NEXT_LINE
, 0x0085 },
126 { G_UNICODE_BREAK_WORD_JOINER
, 0x2060 },
127 { G_UNICODE_BREAK_HANGUL_L_JAMO
, 0x1100 },
128 { G_UNICODE_BREAK_HANGUL_V_JAMO
, 0x1160 },
129 { G_UNICODE_BREAK_HANGUL_T_JAMO
, 0x11A8 },
130 { G_UNICODE_BREAK_HANGUL_LV_SYLLABLE
, 0xAC00 },
131 { G_UNICODE_BREAK_HANGUL_LVT_SYLLABLE
, 0xAC01 },
132 { G_UNICODE_BREAK_CONDITIONAL_JAPANESE_STARTER
, 0x3041 },
133 { G_UNICODE_BREAK_HEBREW_LETTER
, 0x05D0 },
134 { G_UNICODE_BREAK_REGIONAL_INDICATOR
, 0x1F1F6 },
135 { G_UNICODE_BREAK_EMOJI_BASE
, 0x1F466 },
136 { G_UNICODE_BREAK_EMOJI_MODIFIER
, 0x1F3FB },
137 { G_UNICODE_BREAK_ZERO_WIDTH_JOINER
, 0x200D },
140 for (i
= 0; i
< G_N_ELEMENTS (examples
); i
++)
142 g_assert_cmpint (g_unichar_break_type (examples
[i
].c
), ==, examples
[i
].type
);
147 test_unichar_script (void)
151 GUnicodeScript script
;
154 { G_UNICODE_SCRIPT_COMMON
, 0x002A },
155 { G_UNICODE_SCRIPT_INHERITED
, 0x1CED },
156 { G_UNICODE_SCRIPT_INHERITED
, 0x0670 },
157 { G_UNICODE_SCRIPT_ARABIC
, 0x060D },
158 { G_UNICODE_SCRIPT_ARMENIAN
, 0x0559 },
159 { G_UNICODE_SCRIPT_BENGALI
, 0x09CD },
160 { G_UNICODE_SCRIPT_BOPOMOFO
, 0x31B6 },
161 { G_UNICODE_SCRIPT_CHEROKEE
, 0x13A2 },
162 { G_UNICODE_SCRIPT_COPTIC
, 0x2CFD },
163 { G_UNICODE_SCRIPT_CYRILLIC
, 0x0482 },
164 { G_UNICODE_SCRIPT_DESERET
, 0x10401 },
165 { G_UNICODE_SCRIPT_DEVANAGARI
, 0x094D },
166 { G_UNICODE_SCRIPT_ETHIOPIC
, 0x1258 },
167 { G_UNICODE_SCRIPT_GEORGIAN
, 0x10FC },
168 { G_UNICODE_SCRIPT_GOTHIC
, 0x10341 },
169 { G_UNICODE_SCRIPT_GREEK
, 0x0375 },
170 { G_UNICODE_SCRIPT_GUJARATI
, 0x0A83 },
171 { G_UNICODE_SCRIPT_GURMUKHI
, 0x0A3C },
172 { G_UNICODE_SCRIPT_HAN
, 0x3005 },
173 { G_UNICODE_SCRIPT_HANGUL
, 0x1100 },
174 { G_UNICODE_SCRIPT_HEBREW
, 0x05BF },
175 { G_UNICODE_SCRIPT_HIRAGANA
, 0x309F },
176 { G_UNICODE_SCRIPT_KANNADA
, 0x0CBC },
177 { G_UNICODE_SCRIPT_KATAKANA
, 0x30FF },
178 { G_UNICODE_SCRIPT_KHMER
, 0x17DD },
179 { G_UNICODE_SCRIPT_LAO
, 0x0EDD },
180 { G_UNICODE_SCRIPT_LATIN
, 0x0061 },
181 { G_UNICODE_SCRIPT_MALAYALAM
, 0x0D3D },
182 { G_UNICODE_SCRIPT_MONGOLIAN
, 0x1843 },
183 { G_UNICODE_SCRIPT_MYANMAR
, 0x1031 },
184 { G_UNICODE_SCRIPT_OGHAM
, 0x169C },
185 { G_UNICODE_SCRIPT_OLD_ITALIC
, 0x10322 },
186 { G_UNICODE_SCRIPT_ORIYA
, 0x0B3C },
187 { G_UNICODE_SCRIPT_RUNIC
, 0x16EF },
188 { G_UNICODE_SCRIPT_SINHALA
, 0x0DBD },
189 { G_UNICODE_SCRIPT_SYRIAC
, 0x0711 },
190 { G_UNICODE_SCRIPT_TAMIL
, 0x0B82 },
191 { G_UNICODE_SCRIPT_TELUGU
, 0x0C03 },
192 { G_UNICODE_SCRIPT_THAANA
, 0x07B1 },
193 { G_UNICODE_SCRIPT_THAI
, 0x0E31 },
194 { G_UNICODE_SCRIPT_TIBETAN
, 0x0FD4 },
195 { G_UNICODE_SCRIPT_CANADIAN_ABORIGINAL
, 0x1400 },
196 { G_UNICODE_SCRIPT_CANADIAN_ABORIGINAL
, 0x1401 },
197 { G_UNICODE_SCRIPT_YI
, 0xA015 },
198 { G_UNICODE_SCRIPT_TAGALOG
, 0x1700 },
199 { G_UNICODE_SCRIPT_HANUNOO
, 0x1720 },
200 { G_UNICODE_SCRIPT_BUHID
, 0x1740 },
201 { G_UNICODE_SCRIPT_TAGBANWA
, 0x1760 },
202 { G_UNICODE_SCRIPT_BRAILLE
, 0x2800 },
203 { G_UNICODE_SCRIPT_CYPRIOT
, 0x10808 },
204 { G_UNICODE_SCRIPT_LIMBU
, 0x1932 },
205 { G_UNICODE_SCRIPT_OSMANYA
, 0x10480 },
206 { G_UNICODE_SCRIPT_SHAVIAN
, 0x10450 },
207 { G_UNICODE_SCRIPT_LINEAR_B
, 0x10000 },
208 { G_UNICODE_SCRIPT_TAI_LE
, 0x1950 },
209 { G_UNICODE_SCRIPT_UGARITIC
, 0x1039F },
210 { G_UNICODE_SCRIPT_NEW_TAI_LUE
, 0x1980 },
211 { G_UNICODE_SCRIPT_BUGINESE
, 0x1A1F },
212 { G_UNICODE_SCRIPT_GLAGOLITIC
, 0x2C00 },
213 { G_UNICODE_SCRIPT_TIFINAGH
, 0x2D6F },
214 { G_UNICODE_SCRIPT_SYLOTI_NAGRI
, 0xA800 },
215 { G_UNICODE_SCRIPT_OLD_PERSIAN
, 0x103D0 },
216 { G_UNICODE_SCRIPT_KHAROSHTHI
, 0x10A3F },
217 { G_UNICODE_SCRIPT_UNKNOWN
, 0x1111111 },
218 { G_UNICODE_SCRIPT_BALINESE
, 0x1B04 },
219 { G_UNICODE_SCRIPT_CUNEIFORM
, 0x12000 },
220 { G_UNICODE_SCRIPT_PHOENICIAN
, 0x10900 },
221 { G_UNICODE_SCRIPT_PHAGS_PA
, 0xA840 },
222 { G_UNICODE_SCRIPT_NKO
, 0x07C0 },
223 { G_UNICODE_SCRIPT_KAYAH_LI
, 0xA900 },
224 { G_UNICODE_SCRIPT_LEPCHA
, 0x1C00 },
225 { G_UNICODE_SCRIPT_REJANG
, 0xA930 },
226 { G_UNICODE_SCRIPT_SUNDANESE
, 0x1B80 },
227 { G_UNICODE_SCRIPT_SAURASHTRA
, 0xA880 },
228 { G_UNICODE_SCRIPT_CHAM
, 0xAA00 },
229 { G_UNICODE_SCRIPT_OL_CHIKI
, 0x1C50 },
230 { G_UNICODE_SCRIPT_VAI
, 0xA500 },
231 { G_UNICODE_SCRIPT_CARIAN
, 0x102A0 },
232 { G_UNICODE_SCRIPT_LYCIAN
, 0x10280 },
233 { G_UNICODE_SCRIPT_LYDIAN
, 0x1093F },
234 { G_UNICODE_SCRIPT_AVESTAN
, 0x10B00 },
235 { G_UNICODE_SCRIPT_BAMUM
, 0xA6A0 },
236 { G_UNICODE_SCRIPT_EGYPTIAN_HIEROGLYPHS
, 0x13000 },
237 { G_UNICODE_SCRIPT_IMPERIAL_ARAMAIC
, 0x10840 },
238 { G_UNICODE_SCRIPT_INSCRIPTIONAL_PAHLAVI
, 0x10B60 },
239 { G_UNICODE_SCRIPT_INSCRIPTIONAL_PARTHIAN
, 0x10B40 },
240 { G_UNICODE_SCRIPT_JAVANESE
, 0xA980 },
241 { G_UNICODE_SCRIPT_KAITHI
, 0x11082 },
242 { G_UNICODE_SCRIPT_LISU
, 0xA4D0 },
243 { G_UNICODE_SCRIPT_MEETEI_MAYEK
, 0xABE5 },
244 { G_UNICODE_SCRIPT_OLD_SOUTH_ARABIAN
, 0x10A60 },
245 { G_UNICODE_SCRIPT_OLD_TURKIC
, 0x10C00 },
246 { G_UNICODE_SCRIPT_SAMARITAN
, 0x0800 },
247 { G_UNICODE_SCRIPT_TAI_THAM
, 0x1A20 },
248 { G_UNICODE_SCRIPT_TAI_VIET
, 0xAA80 },
249 { G_UNICODE_SCRIPT_BATAK
, 0x1BC0 },
250 { G_UNICODE_SCRIPT_BRAHMI
, 0x11000 },
251 { G_UNICODE_SCRIPT_MANDAIC
, 0x0840 },
252 { G_UNICODE_SCRIPT_CHAKMA
, 0x11100 },
253 { G_UNICODE_SCRIPT_MEROITIC_CURSIVE
, 0x109A0 },
254 { G_UNICODE_SCRIPT_MEROITIC_HIEROGLYPHS
, 0x10980 },
255 { G_UNICODE_SCRIPT_MIAO
, 0x16F00 },
256 { G_UNICODE_SCRIPT_SHARADA
, 0x11180 },
257 { G_UNICODE_SCRIPT_SORA_SOMPENG
, 0x110D0 },
258 { G_UNICODE_SCRIPT_TAKRI
, 0x11680 },
259 { G_UNICODE_SCRIPT_BASSA_VAH
, 0x16AD0 },
260 { G_UNICODE_SCRIPT_CAUCASIAN_ALBANIAN
, 0x10530 },
261 { G_UNICODE_SCRIPT_DUPLOYAN
, 0x1BC00 },
262 { G_UNICODE_SCRIPT_ELBASAN
, 0x10500 },
263 { G_UNICODE_SCRIPT_GRANTHA
, 0x11301 },
264 { G_UNICODE_SCRIPT_KHOJKI
, 0x11200 },
265 { G_UNICODE_SCRIPT_KHUDAWADI
, 0x112B0 },
266 { G_UNICODE_SCRIPT_LINEAR_A
, 0x10600 },
267 { G_UNICODE_SCRIPT_MAHAJANI
, 0x11150 },
268 { G_UNICODE_SCRIPT_MANICHAEAN
, 0x10AC0 },
269 { G_UNICODE_SCRIPT_MENDE_KIKAKUI
, 0x1E800 },
270 { G_UNICODE_SCRIPT_MODI
, 0x11600 },
271 { G_UNICODE_SCRIPT_MRO
, 0x16A40 },
272 { G_UNICODE_SCRIPT_NABATAEAN
, 0x10880 },
273 { G_UNICODE_SCRIPT_OLD_NORTH_ARABIAN
, 0x10A80 },
274 { G_UNICODE_SCRIPT_OLD_PERMIC
, 0x10350 },
275 { G_UNICODE_SCRIPT_PAHAWH_HMONG
, 0x16B00 },
276 { G_UNICODE_SCRIPT_PALMYRENE
, 0x10860 },
277 { G_UNICODE_SCRIPT_PAU_CIN_HAU
, 0x11AC0 },
278 { G_UNICODE_SCRIPT_PSALTER_PAHLAVI
, 0x10B80 },
279 { G_UNICODE_SCRIPT_SIDDHAM
, 0x11580 },
280 { G_UNICODE_SCRIPT_TIRHUTA
, 0x11480 },
281 { G_UNICODE_SCRIPT_WARANG_CITI
, 0x118A0 },
282 { G_UNICODE_SCRIPT_CHEROKEE
, 0x0AB71 },
283 { G_UNICODE_SCRIPT_HATRAN
, 0x108E0 },
284 { G_UNICODE_SCRIPT_OLD_HUNGARIAN
, 0x10C80 },
285 { G_UNICODE_SCRIPT_MULTANI
, 0x11280 },
286 { G_UNICODE_SCRIPT_AHOM
, 0x11700 },
287 { G_UNICODE_SCRIPT_CUNEIFORM
, 0x12480 },
288 { G_UNICODE_SCRIPT_ANATOLIAN_HIEROGLYPHS
, 0x14400 },
289 { G_UNICODE_SCRIPT_SIGNWRITING
, 0x1D800 },
290 { G_UNICODE_SCRIPT_ADLAM
, 0x1E900 },
291 { G_UNICODE_SCRIPT_BHAIKSUKI
, 0x11C00 },
292 { G_UNICODE_SCRIPT_MARCHEN
, 0x11C70 },
293 { G_UNICODE_SCRIPT_NEWA
, 0x11400 },
294 { G_UNICODE_SCRIPT_OSAGE
, 0x104B0 },
295 { G_UNICODE_SCRIPT_TANGUT
, 0x16FE0 },
296 { G_UNICODE_SCRIPT_MASARAM_GONDI
, 0x11D00 },
297 { G_UNICODE_SCRIPT_NUSHU
, 0x1B170 },
298 { G_UNICODE_SCRIPT_SOYOMBO
, 0x11A50 },
299 { G_UNICODE_SCRIPT_ZANABAZAR_SQUARE
, 0x11A00 },
301 for (i
= 0; i
< G_N_ELEMENTS (examples
); i
++)
302 g_assert_cmpint (g_unichar_get_script (examples
[i
].c
), ==, examples
[i
].script
);
306 test_combining_class (void)
347 for (i
= 0; i
< G_N_ELEMENTS (examples
); i
++)
349 g_assert_cmpint (g_unichar_combining_class (examples
[i
].c
), ==, examples
[i
].class);
358 g_assert (g_unichar_get_mirror_char ('(', &mirror
));
359 g_assert_cmpint (mirror
, ==, ')');
360 g_assert (g_unichar_get_mirror_char (')', &mirror
));
361 g_assert_cmpint (mirror
, ==, '(');
362 g_assert (g_unichar_get_mirror_char ('{', &mirror
));
363 g_assert_cmpint (mirror
, ==, '}');
364 g_assert (g_unichar_get_mirror_char ('}', &mirror
));
365 g_assert_cmpint (mirror
, ==, '{');
366 g_assert (g_unichar_get_mirror_char (0x208D, &mirror
));
367 g_assert_cmpint (mirror
, ==, 0x208E);
368 g_assert (g_unichar_get_mirror_char (0x208E, &mirror
));
369 g_assert_cmpint (mirror
, ==, 0x208D);
370 g_assert (!g_unichar_get_mirror_char ('a', &mirror
));
376 g_assert (g_unichar_ismark (0x0903));
377 g_assert (g_unichar_ismark (0x20DD));
378 g_assert (g_unichar_ismark (0xA806));
379 g_assert (!g_unichar_ismark ('a'));
383 test_zerowidth (void)
385 g_assert (!g_unichar_iszerowidth (0x00AD));
386 g_assert (!g_unichar_iszerowidth (0x00AD));
387 g_assert (!g_unichar_iszerowidth (0x115F));
388 g_assert (g_unichar_iszerowidth (0x1160));
389 g_assert (g_unichar_iszerowidth (0x11AA));
390 g_assert (g_unichar_iszerowidth (0x11FF));
391 g_assert (!g_unichar_iszerowidth (0x1200));
392 g_assert (g_unichar_iszerowidth (0x200B));
393 g_assert (g_unichar_iszerowidth (0x591));
399 g_assert (g_unichar_istitle (0x01c5));
400 g_assert (g_unichar_istitle (0x1f88));
401 g_assert (g_unichar_istitle (0x1fcc));
402 g_assert (!g_unichar_istitle ('a'));
403 g_assert (!g_unichar_istitle ('A'));
405 g_assert_cmphex (g_unichar_totitle (0x01c6), ==, 0x01c5);
406 g_assert_cmphex (g_unichar_totitle (0x01c4), ==, 0x01c5);
407 g_assert_cmphex (g_unichar_totitle (0x01c5), ==, 0x01c5);
408 g_assert_cmphex (g_unichar_totitle (0x1f80), ==, 0x1f88);
409 g_assert_cmphex (g_unichar_totitle (0x1f88), ==, 0x1f88);
410 g_assert_cmphex (g_unichar_totitle ('a'), ==, 'A');
411 g_assert_cmphex (g_unichar_totitle ('A'), ==, 'A');
417 g_assert_cmphex (g_unichar_toupper ('a'), ==, 'A');
418 g_assert_cmphex (g_unichar_toupper ('A'), ==, 'A');
419 g_assert_cmphex (g_unichar_toupper (0x01C5), ==, 0x01C4);
420 g_assert_cmphex (g_unichar_toupper (0x01C6), ==, 0x01C4);
421 g_assert_cmphex (g_unichar_tolower ('A'), ==, 'a');
422 g_assert_cmphex (g_unichar_tolower ('a'), ==, 'a');
423 g_assert_cmphex (g_unichar_tolower (0x01C4), ==, 0x01C6);
424 g_assert_cmphex (g_unichar_tolower (0x01C5), ==, 0x01C6);
425 g_assert_cmphex (g_unichar_tolower (0x1F8A), ==, 0x1F82);
426 g_assert_cmphex (g_unichar_totitle (0x1F8A), ==, 0x1F8A);
427 g_assert_cmphex (g_unichar_toupper (0x1F8A), ==, 0x1F8A);
428 g_assert_cmphex (g_unichar_tolower (0x1FB2), ==, 0x1FB2);
429 g_assert_cmphex (g_unichar_toupper (0x1FB2), ==, 0x1FB2);
435 g_assert (g_unichar_isdefined (0x0903));
436 g_assert (g_unichar_isdefined (0x20DD));
437 g_assert (g_unichar_isdefined (0x20BA));
438 g_assert (g_unichar_isdefined (0xA806));
439 g_assert (g_unichar_isdefined ('a'));
440 g_assert (!g_unichar_isdefined (0x10C49));
441 g_assert (!g_unichar_isdefined (0x169D));
457 { 0x0000, NOT_WIDE
},
458 { 0x0483, NOT_WIDE
},
459 { 0x0641, NOT_WIDE
},
460 { 0xFFFC, NOT_WIDE
},
461 { 0x10000, NOT_WIDE
},
462 { 0xE0001, NOT_WIDE
},
463 { 0x2FFFE, NOT_WIDE
},
464 { 0x3FFFE, NOT_WIDE
},
467 { 0x0020, NOT_WIDE
},
468 { 0x0041, NOT_WIDE
},
469 { 0x27E6, NOT_WIDE
},
472 { 0x20A9, NOT_WIDE
},
473 { 0xFF61, NOT_WIDE
},
474 { 0xFF69, NOT_WIDE
},
475 { 0xFFEE, NOT_WIDE
},
478 { 0x00A1, WIDE_CJK
},
479 { 0x00BE, WIDE_CJK
},
480 { 0x02DD, WIDE_CJK
},
481 { 0x2020, WIDE_CJK
},
482 { 0xFFFD, WIDE_CJK
},
483 { 0x00A1, WIDE_CJK
},
484 { 0x1F100, WIDE_CJK
},
485 { 0xE0100, WIDE_CJK
},
486 { 0x100000, WIDE_CJK
},
487 { 0x10FFFD, WIDE_CJK
},
500 /* Default Wide blocks */
509 /* Uniode-5.2 character additions */
513 /* Uniode-6.0 character additions */
518 { 0x111111, NOT_WIDE
}
521 for (i
= 0; i
< G_N_ELEMENTS (examples
); i
++)
523 g_assert_cmpint (g_unichar_iswide (examples
[i
].c
), ==, (examples
[i
].wide
== WIDE
));
524 g_assert_cmpint (g_unichar_iswide_cjk (examples
[i
].c
), ==, (examples
[i
].wide
!= NOT_WIDE
));
534 g_assert (!g_unichar_compose (0x0041, 0x0042, &ch
) && ch
== 0);
535 g_assert (!g_unichar_compose (0x0041, 0, &ch
) && ch
== 0);
536 g_assert (!g_unichar_compose (0x0066, 0x0069, &ch
) && ch
== 0);
538 /* Tricky non-composable */
539 g_assert (!g_unichar_compose (0x0308, 0x0301, &ch
) && ch
== 0); /* !0x0344 */
540 g_assert (!g_unichar_compose (0x0F71, 0x0F72, &ch
) && ch
== 0); /* !0x0F73 */
542 /* Singletons should not compose */
543 g_assert (!g_unichar_compose (0x212B, 0, &ch
) && ch
== 0);
544 g_assert (!g_unichar_compose (0x00C5, 0, &ch
) && ch
== 0);
545 g_assert (!g_unichar_compose (0x2126, 0, &ch
) && ch
== 0);
546 g_assert (!g_unichar_compose (0x03A9, 0, &ch
) && ch
== 0);
549 g_assert (g_unichar_compose (0x0041, 0x030A, &ch
) && ch
== 0x00C5);
550 g_assert (g_unichar_compose (0x006F, 0x0302, &ch
) && ch
== 0x00F4);
551 g_assert (g_unichar_compose (0x1E63, 0x0307, &ch
) && ch
== 0x1E69);
552 g_assert (g_unichar_compose (0x0073, 0x0323, &ch
) && ch
== 0x1E63);
553 g_assert (g_unichar_compose (0x0064, 0x0307, &ch
) && ch
== 0x1E0B);
554 g_assert (g_unichar_compose (0x0064, 0x0323, &ch
) && ch
== 0x1E0D);
557 g_assert (g_unichar_compose (0xD4CC, 0x11B6, &ch
) && ch
== 0xD4DB);
558 g_assert (g_unichar_compose (0x1111, 0x1171, &ch
) && ch
== 0xD4CC);
559 g_assert (g_unichar_compose (0xCE20, 0x11B8, &ch
) && ch
== 0xCE31);
560 g_assert (g_unichar_compose (0x110E, 0x1173, &ch
) && ch
== 0xCE20);
564 test_decompose (void)
568 /* Not decomposable */
569 g_assert (!g_unichar_decompose (0x0041, &a
, &b
) && a
== 0x0041 && b
== 0);
570 g_assert (!g_unichar_decompose (0xFB01, &a
, &b
) && a
== 0xFB01 && b
== 0);
573 g_assert (g_unichar_decompose (0x212B, &a
, &b
) && a
== 0x00C5 && b
== 0);
574 g_assert (g_unichar_decompose (0x2126, &a
, &b
) && a
== 0x03A9 && b
== 0);
577 g_assert (g_unichar_decompose (0x0344, &a
, &b
) && a
== 0x0308 && b
== 0x0301);
578 g_assert (g_unichar_decompose (0x0F73, &a
, &b
) && a
== 0x0F71 && b
== 0x0F72);
581 g_assert (g_unichar_decompose (0x00C5, &a
, &b
) && a
== 0x0041 && b
== 0x030A);
582 g_assert (g_unichar_decompose (0x00F4, &a
, &b
) && a
== 0x006F && b
== 0x0302);
583 g_assert (g_unichar_decompose (0x1E69, &a
, &b
) && a
== 0x1E63 && b
== 0x0307);
584 g_assert (g_unichar_decompose (0x1E63, &a
, &b
) && a
== 0x0073 && b
== 0x0323);
585 g_assert (g_unichar_decompose (0x1E0B, &a
, &b
) && a
== 0x0064 && b
== 0x0307);
586 g_assert (g_unichar_decompose (0x1E0D, &a
, &b
) && a
== 0x0064 && b
== 0x0323);
589 g_assert (g_unichar_decompose (0xD4DB, &a
, &b
) && a
== 0xD4CC && b
== 0x11B6);
590 g_assert (g_unichar_decompose (0xD4CC, &a
, &b
) && a
== 0x1111 && b
== 0x1171);
591 g_assert (g_unichar_decompose (0xCE31, &a
, &b
) && a
== 0xCE20 && b
== 0x11B8);
592 g_assert (g_unichar_decompose (0xCE20, &a
, &b
) && a
== 0x110E && b
== 0x1173);
596 test_fully_decompose_canonical (void)
601 #define TEST_DECOMP(ch, expected_len, a, b, c, d) \
602 len = g_unichar_fully_decompose (ch, FALSE, decomp, G_N_ELEMENTS (decomp)); \
603 g_assert_cmpint (expected_len, ==, len); \
604 if (expected_len >= 1) g_assert_cmphex (decomp[0], ==, a); \
605 if (expected_len >= 2) g_assert_cmphex (decomp[1], ==, b); \
606 if (expected_len >= 3) g_assert_cmphex (decomp[2], ==, c); \
607 if (expected_len >= 4) g_assert_cmphex (decomp[3], ==, d); \
609 #define TEST0(ch) TEST_DECOMP (ch, 1, ch, 0, 0, 0)
610 #define TEST1(ch, a) TEST_DECOMP (ch, 1, a, 0, 0, 0)
611 #define TEST2(ch, a, b) TEST_DECOMP (ch, 2, a, b, 0, 0)
612 #define TEST3(ch, a, b, c) TEST_DECOMP (ch, 3, a, b, c, 0)
613 #define TEST4(ch, a, b, c, d) TEST_DECOMP (ch, 4, a, b, c, d)
615 /* Not decomposable */
620 TEST2 (0x212B, 0x0041, 0x030A);
621 TEST1 (0x2126, 0x03A9);
624 TEST2 (0x0344, 0x0308, 0x0301);
625 TEST2 (0x0F73, 0x0F71, 0x0F72);
628 TEST2 (0x00C5, 0x0041, 0x030A);
629 TEST2 (0x00F4, 0x006F, 0x0302);
630 TEST3 (0x1E69, 0x0073, 0x0323, 0x0307);
631 TEST2 (0x1E63, 0x0073, 0x0323);
632 TEST2 (0x1E0B, 0x0064, 0x0307);
633 TEST2 (0x1E0D, 0x0064, 0x0323);
636 TEST3 (0xD4DB, 0x1111, 0x1171, 0x11B6);
637 TEST2 (0xD4CC, 0x1111, 0x1171);
638 TEST3 (0xCE31, 0x110E, 0x1173, 0x11B8);
639 TEST2 (0xCE20, 0x110E, 0x1173);
645 test_canonical_decomposition (void)
650 #define TEST_DECOMP(ch, expected_len, a, b, c, d) \
651 decomp = g_unicode_canonical_decomposition (ch, &len); \
652 g_assert_cmpint (expected_len, ==, len); \
653 if (expected_len >= 1) g_assert_cmphex (decomp[0], ==, a); \
654 if (expected_len >= 2) g_assert_cmphex (decomp[1], ==, b); \
655 if (expected_len >= 3) g_assert_cmphex (decomp[2], ==, c); \
656 if (expected_len >= 4) g_assert_cmphex (decomp[3], ==, d); \
659 #define TEST0(ch) TEST_DECOMP (ch, 1, ch, 0, 0, 0)
660 #define TEST1(ch, a) TEST_DECOMP (ch, 1, a, 0, 0, 0)
661 #define TEST2(ch, a, b) TEST_DECOMP (ch, 2, a, b, 0, 0)
662 #define TEST3(ch, a, b, c) TEST_DECOMP (ch, 3, a, b, c, 0)
663 #define TEST4(ch, a, b, c, d) TEST_DECOMP (ch, 4, a, b, c, d)
665 /* Not decomposable */
670 TEST2 (0x212B, 0x0041, 0x030A);
671 TEST1 (0x2126, 0x03A9);
674 TEST2 (0x0344, 0x0308, 0x0301);
675 TEST2 (0x0F73, 0x0F71, 0x0F72);
678 TEST2 (0x00C5, 0x0041, 0x030A);
679 TEST2 (0x00F4, 0x006F, 0x0302);
680 TEST3 (0x1E69, 0x0073, 0x0323, 0x0307);
681 TEST2 (0x1E63, 0x0073, 0x0323);
682 TEST2 (0x1E0B, 0x0064, 0x0307);
683 TEST2 (0x1E0D, 0x0064, 0x0323);
686 TEST3 (0xD4DB, 0x1111, 0x1171, 0x11B6);
687 TEST2 (0xD4CC, 0x1111, 0x1171);
688 TEST3 (0xCE31, 0x110E, 0x1173, 0x11B8);
689 TEST2 (0xCE20, 0x110E, 0x1173);
695 test_decompose_tail (void)
697 gunichar ch
, a
, b
, c
, d
;
699 /* Test that whenever a char ch decomposes into a and b, b itself
700 * won't decompose any further. */
702 for (ch
= 0; ch
< 0x110000; ch
++)
703 if (g_unichar_decompose (ch
, &a
, &b
))
704 g_assert (!g_unichar_decompose (b
, &c
, &d
));
707 g_assert_cmpuint (a
, ==, ch
);
708 g_assert_cmpuint (b
, ==, 0);
713 test_fully_decompose_len (void)
717 /* Test that all canonical decompositions are at most 4 in length,
718 * and compatibility decompositions are at most 18 in length.
721 for (ch
= 0; ch
< 0x110000; ch
++) {
722 g_assert_cmpint (g_unichar_fully_decompose (ch
, FALSE
, NULL
, 0), <=, 4);
723 g_assert_cmpint (g_unichar_fully_decompose (ch
, TRUE
, NULL
, 0), <=, 18);
731 GUnicodeScript script
;
732 char four_letter_code
[5];
734 { G_UNICODE_SCRIPT_COMMON
, "Zyyy" },
735 { G_UNICODE_SCRIPT_INHERITED
, "Zinh" },
736 { G_UNICODE_SCRIPT_ARABIC
, "Arab" },
737 { G_UNICODE_SCRIPT_ARMENIAN
, "Armn" },
738 { G_UNICODE_SCRIPT_BENGALI
, "Beng" },
739 { G_UNICODE_SCRIPT_BOPOMOFO
, "Bopo" },
740 { G_UNICODE_SCRIPT_CHEROKEE
, "Cher" },
741 { G_UNICODE_SCRIPT_COPTIC
, "Copt" },
742 { G_UNICODE_SCRIPT_CYRILLIC
, "Cyrl" },
743 { G_UNICODE_SCRIPT_DESERET
, "Dsrt" },
744 { G_UNICODE_SCRIPT_DEVANAGARI
, "Deva" },
745 { G_UNICODE_SCRIPT_ETHIOPIC
, "Ethi" },
746 { G_UNICODE_SCRIPT_GEORGIAN
, "Geor" },
747 { G_UNICODE_SCRIPT_GOTHIC
, "Goth" },
748 { G_UNICODE_SCRIPT_GREEK
, "Grek" },
749 { G_UNICODE_SCRIPT_GUJARATI
, "Gujr" },
750 { G_UNICODE_SCRIPT_GURMUKHI
, "Guru" },
751 { G_UNICODE_SCRIPT_HAN
, "Hani" },
752 { G_UNICODE_SCRIPT_HANGUL
, "Hang" },
753 { G_UNICODE_SCRIPT_HEBREW
, "Hebr" },
754 { G_UNICODE_SCRIPT_HIRAGANA
, "Hira" },
755 { G_UNICODE_SCRIPT_KANNADA
, "Knda" },
756 { G_UNICODE_SCRIPT_KATAKANA
, "Kana" },
757 { G_UNICODE_SCRIPT_KHMER
, "Khmr" },
758 { G_UNICODE_SCRIPT_LAO
, "Laoo" },
759 { G_UNICODE_SCRIPT_LATIN
, "Latn" },
760 { G_UNICODE_SCRIPT_MALAYALAM
, "Mlym" },
761 { G_UNICODE_SCRIPT_MONGOLIAN
, "Mong" },
762 { G_UNICODE_SCRIPT_MYANMAR
, "Mymr" },
763 { G_UNICODE_SCRIPT_OGHAM
, "Ogam" },
764 { G_UNICODE_SCRIPT_OLD_ITALIC
, "Ital" },
765 { G_UNICODE_SCRIPT_ORIYA
, "Orya" },
766 { G_UNICODE_SCRIPT_RUNIC
, "Runr" },
767 { G_UNICODE_SCRIPT_SINHALA
, "Sinh" },
768 { G_UNICODE_SCRIPT_SYRIAC
, "Syrc" },
769 { G_UNICODE_SCRIPT_TAMIL
, "Taml" },
770 { G_UNICODE_SCRIPT_TELUGU
, "Telu" },
771 { G_UNICODE_SCRIPT_THAANA
, "Thaa" },
772 { G_UNICODE_SCRIPT_THAI
, "Thai" },
773 { G_UNICODE_SCRIPT_TIBETAN
, "Tibt" },
774 { G_UNICODE_SCRIPT_CANADIAN_ABORIGINAL
, "Cans" },
775 { G_UNICODE_SCRIPT_YI
, "Yiii" },
776 { G_UNICODE_SCRIPT_TAGALOG
, "Tglg" },
777 { G_UNICODE_SCRIPT_HANUNOO
, "Hano" },
778 { G_UNICODE_SCRIPT_BUHID
, "Buhd" },
779 { G_UNICODE_SCRIPT_TAGBANWA
, "Tagb" },
781 /* Unicode-4.0 additions */
782 { G_UNICODE_SCRIPT_BRAILLE
, "Brai" },
783 { G_UNICODE_SCRIPT_CYPRIOT
, "Cprt" },
784 { G_UNICODE_SCRIPT_LIMBU
, "Limb" },
785 { G_UNICODE_SCRIPT_OSMANYA
, "Osma" },
786 { G_UNICODE_SCRIPT_SHAVIAN
, "Shaw" },
787 { G_UNICODE_SCRIPT_LINEAR_B
, "Linb" },
788 { G_UNICODE_SCRIPT_TAI_LE
, "Tale" },
789 { G_UNICODE_SCRIPT_UGARITIC
, "Ugar" },
791 /* Unicode-4.1 additions */
792 { G_UNICODE_SCRIPT_NEW_TAI_LUE
, "Talu" },
793 { G_UNICODE_SCRIPT_BUGINESE
, "Bugi" },
794 { G_UNICODE_SCRIPT_GLAGOLITIC
, "Glag" },
795 { G_UNICODE_SCRIPT_TIFINAGH
, "Tfng" },
796 { G_UNICODE_SCRIPT_SYLOTI_NAGRI
, "Sylo" },
797 { G_UNICODE_SCRIPT_OLD_PERSIAN
, "Xpeo" },
798 { G_UNICODE_SCRIPT_KHAROSHTHI
, "Khar" },
800 /* Unicode-5.0 additions */
801 { G_UNICODE_SCRIPT_UNKNOWN
, "Zzzz" },
802 { G_UNICODE_SCRIPT_BALINESE
, "Bali" },
803 { G_UNICODE_SCRIPT_CUNEIFORM
, "Xsux" },
804 { G_UNICODE_SCRIPT_PHOENICIAN
, "Phnx" },
805 { G_UNICODE_SCRIPT_PHAGS_PA
, "Phag" },
806 { G_UNICODE_SCRIPT_NKO
, "Nkoo" },
808 /* Unicode-5.1 additions */
809 { G_UNICODE_SCRIPT_KAYAH_LI
, "Kali" },
810 { G_UNICODE_SCRIPT_LEPCHA
, "Lepc" },
811 { G_UNICODE_SCRIPT_REJANG
, "Rjng" },
812 { G_UNICODE_SCRIPT_SUNDANESE
, "Sund" },
813 { G_UNICODE_SCRIPT_SAURASHTRA
, "Saur" },
814 { G_UNICODE_SCRIPT_CHAM
, "Cham" },
815 { G_UNICODE_SCRIPT_OL_CHIKI
, "Olck" },
816 { G_UNICODE_SCRIPT_VAI
, "Vaii" },
817 { G_UNICODE_SCRIPT_CARIAN
, "Cari" },
818 { G_UNICODE_SCRIPT_LYCIAN
, "Lyci" },
819 { G_UNICODE_SCRIPT_LYDIAN
, "Lydi" },
821 /* Unicode-5.2 additions */
822 { G_UNICODE_SCRIPT_AVESTAN
, "Avst" },
823 { G_UNICODE_SCRIPT_BAMUM
, "Bamu" },
824 { G_UNICODE_SCRIPT_EGYPTIAN_HIEROGLYPHS
, "Egyp" },
825 { G_UNICODE_SCRIPT_IMPERIAL_ARAMAIC
, "Armi" },
826 { G_UNICODE_SCRIPT_INSCRIPTIONAL_PAHLAVI
, "Phli" },
827 { G_UNICODE_SCRIPT_INSCRIPTIONAL_PARTHIAN
, "Prti" },
828 { G_UNICODE_SCRIPT_JAVANESE
, "Java" },
829 { G_UNICODE_SCRIPT_KAITHI
, "Kthi" },
830 { G_UNICODE_SCRIPT_LISU
, "Lisu" },
831 { G_UNICODE_SCRIPT_MEETEI_MAYEK
, "Mtei" },
832 { G_UNICODE_SCRIPT_OLD_SOUTH_ARABIAN
, "Sarb" },
833 { G_UNICODE_SCRIPT_OLD_TURKIC
, "Orkh" },
834 { G_UNICODE_SCRIPT_SAMARITAN
, "Samr" },
835 { G_UNICODE_SCRIPT_TAI_THAM
, "Lana" },
836 { G_UNICODE_SCRIPT_TAI_VIET
, "Tavt" },
838 /* Unicode-6.0 additions */
839 { G_UNICODE_SCRIPT_BATAK
, "Batk" },
840 { G_UNICODE_SCRIPT_BRAHMI
, "Brah" },
841 { G_UNICODE_SCRIPT_MANDAIC
, "Mand" },
843 /* Unicode-6.1 additions */
844 { G_UNICODE_SCRIPT_CHAKMA
, "Cakm" },
845 { G_UNICODE_SCRIPT_MEROITIC_CURSIVE
, "Merc" },
846 { G_UNICODE_SCRIPT_MEROITIC_HIEROGLYPHS
, "Mero" },
847 { G_UNICODE_SCRIPT_MIAO
, "Plrd" },
848 { G_UNICODE_SCRIPT_SHARADA
, "Shrd" },
849 { G_UNICODE_SCRIPT_SORA_SOMPENG
, "Sora" },
850 { G_UNICODE_SCRIPT_TAKRI
, "Takr" },
852 /* Unicode 7.0 additions */
853 { G_UNICODE_SCRIPT_BASSA_VAH
, "Bass" },
854 { G_UNICODE_SCRIPT_CAUCASIAN_ALBANIAN
, "Aghb" },
855 { G_UNICODE_SCRIPT_DUPLOYAN
, "Dupl" },
856 { G_UNICODE_SCRIPT_ELBASAN
, "Elba" },
857 { G_UNICODE_SCRIPT_GRANTHA
, "Gran" },
858 { G_UNICODE_SCRIPT_KHOJKI
, "Khoj" },
859 { G_UNICODE_SCRIPT_KHUDAWADI
, "Sind" },
860 { G_UNICODE_SCRIPT_LINEAR_A
, "Lina" },
861 { G_UNICODE_SCRIPT_MAHAJANI
, "Mahj" },
862 { G_UNICODE_SCRIPT_MANICHAEAN
, "Manu" },
863 { G_UNICODE_SCRIPT_MENDE_KIKAKUI
, "Mend" },
864 { G_UNICODE_SCRIPT_MODI
, "Modi" },
865 { G_UNICODE_SCRIPT_MRO
, "Mroo" },
866 { G_UNICODE_SCRIPT_NABATAEAN
, "Nbat" },
867 { G_UNICODE_SCRIPT_OLD_NORTH_ARABIAN
, "Narb" },
868 { G_UNICODE_SCRIPT_OLD_PERMIC
, "Perm" },
869 { G_UNICODE_SCRIPT_PAHAWH_HMONG
, "Hmng" },
870 { G_UNICODE_SCRIPT_PALMYRENE
, "Palm" },
871 { G_UNICODE_SCRIPT_PAU_CIN_HAU
, "Pauc" },
872 { G_UNICODE_SCRIPT_PSALTER_PAHLAVI
, "Phlp" },
873 { G_UNICODE_SCRIPT_SIDDHAM
, "Sidd" },
874 { G_UNICODE_SCRIPT_TIRHUTA
, "Tirh" },
875 { G_UNICODE_SCRIPT_WARANG_CITI
, "Wara" },
877 /* Unicode 8.0 additions */
878 { G_UNICODE_SCRIPT_AHOM
, "Ahom" },
879 { G_UNICODE_SCRIPT_ANATOLIAN_HIEROGLYPHS
, "Hluw" },
880 { G_UNICODE_SCRIPT_HATRAN
, "Hatr" },
881 { G_UNICODE_SCRIPT_MULTANI
, "Mult" },
882 { G_UNICODE_SCRIPT_OLD_HUNGARIAN
, "Hung" },
883 { G_UNICODE_SCRIPT_SIGNWRITING
, "Sgnw" },
885 /* Unicode 9.0 additions */
886 { G_UNICODE_SCRIPT_ADLAM
, "Adlm" },
887 { G_UNICODE_SCRIPT_BHAIKSUKI
, "Bhks" },
888 { G_UNICODE_SCRIPT_MARCHEN
, "Marc" },
889 { G_UNICODE_SCRIPT_NEWA
, "Newa" },
890 { G_UNICODE_SCRIPT_OSAGE
, "Osge" },
891 { G_UNICODE_SCRIPT_TANGUT
, "Tang" },
893 /* Unicode 10.0 additions */
894 { G_UNICODE_SCRIPT_MASARAM_GONDI
, "Gonm" },
895 { G_UNICODE_SCRIPT_NUSHU
, "Nshu" },
896 { G_UNICODE_SCRIPT_SOYOMBO
, "Soyo" },
897 { G_UNICODE_SCRIPT_ZANABAZAR_SQUARE
, "Zanb" },
901 g_assert_cmphex (0, ==, g_unicode_script_to_iso15924 (G_UNICODE_SCRIPT_INVALID_CODE
));
902 g_assert_cmphex (0x5A7A7A7A, ==, g_unicode_script_to_iso15924 (1000));
903 g_assert_cmphex (0x41726162, ==, g_unicode_script_to_iso15924 (G_UNICODE_SCRIPT_ARABIC
));
905 g_assert_cmphex (G_UNICODE_SCRIPT_INVALID_CODE
, ==, g_unicode_script_from_iso15924 (0));
906 g_assert_cmphex (G_UNICODE_SCRIPT_UNKNOWN
, ==, g_unicode_script_from_iso15924 (0x12345678));
908 #define PACK(a,b,c,d) ((guint32)((((guint8)(a))<<24)|(((guint8)(b))<<16)|(((guint8)(c))<<8)|((guint8)(d))))
910 for (i
= 0; i
< G_N_ELEMENTS (data
); i
++)
912 guint32 code
= PACK (data
[i
].four_letter_code
[0],
913 data
[i
].four_letter_code
[1],
914 data
[i
].four_letter_code
[2],
915 data
[i
].four_letter_code
[3]);
917 g_assert_cmphex (g_unicode_script_to_iso15924 (data
[i
].script
), ==, code
);
918 g_assert_cmpint (g_unicode_script_from_iso15924 (code
), ==, data
[i
].script
);
928 g_test_init (&argc
, &argv
, NULL
);
930 g_test_add_func ("/unicode/validate", test_unichar_validate
);
931 g_test_add_func ("/unicode/character-type", test_unichar_character_type
);
932 g_test_add_func ("/unicode/break-type", test_unichar_break_type
);
933 g_test_add_func ("/unicode/script", test_unichar_script
);
934 g_test_add_func ("/unicode/combining-class", test_combining_class
);
935 g_test_add_func ("/unicode/mirror", test_mirror
);
936 g_test_add_func ("/unicode/mark", test_mark
);
937 g_test_add_func ("/unicode/title", test_title
);
938 g_test_add_func ("/unicode/zero-width", test_zerowidth
);
939 g_test_add_func ("/unicode/defined", test_defined
);
940 g_test_add_func ("/unicode/wide", test_wide
);
941 g_test_add_func ("/unicode/compose", test_compose
);
942 g_test_add_func ("/unicode/decompose", test_decompose
);
943 g_test_add_func ("/unicode/fully-decompose-canonical", test_fully_decompose_canonical
);
944 g_test_add_func ("/unicode/canonical-decomposition", test_canonical_decomposition
);
945 g_test_add_func ("/unicode/decompose-tail", test_decompose_tail
);
946 g_test_add_func ("/unicode/fully-decompose-len", test_fully_decompose_len
);
947 g_test_add_func ("/unicode/iso15924", test_iso15924
);
948 g_test_add_func ("/unicode/cases", test_cases
);