* If @ch is not decomposable, *@a is set to @ch and *@b
* is set to zero.
*
+ * Note that the way Unicode decomposition pairs are
+ * defined, it is guaranteed that @b would not decompose
+ * further, but @a may itself decompose. To get the full
+ * canonical decomposition for @ch, one would need to
+ * recursively call this function on @a. Or use
+ * g_unicode_canonical_decomposition().
+ *
* See <ulink url="http://unicode.org/reports/tr15/">UAX#15</ulink>
* for details.
*
TEST2 (0xCE20, 0x110E, 0x1173);
}
+static void
+test_decompose_tail (void)
+{
+ gunichar ch, a, b, c, d;
+
+ /* Test that whenever a char ch decomposes into a and b, b itself
+ * won't decompose any further. */
+
+ for (ch = 0; ch < 0x110000; ch++)
+ if (g_unichar_decompose (ch, &a, &b))
+ g_assert (!g_unichar_decompose (b, &c, &d));
+ else
+ g_assert (a == ch && b == 0);
+}
+
int
main (int argc,
char *argv[])
g_test_add_func ("/unicode/compose", test_compose);
g_test_add_func ("/unicode/decompose", test_decompose);
g_test_add_func ("/unicode/canonical-decomposition", test_canonical_decomposition);
+ g_test_add_func ("/unicode/decompose-tail", test_decompose_tail);
return g_test_run();
}