[glib] Add some more unicode property tests



commit 8eb755e78e56036b93a7b11d3d6fe4237ab708be
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Jun 23 00:20:11 2010 -0400

    Add some more unicode property tests

 glib/tests/utf8-misc.c |   32 +++++++++++++++++++++++++++++++-
 1 files changed, 31 insertions(+), 1 deletions(-)
---
diff --git a/glib/tests/utf8-misc.c b/glib/tests/utf8-misc.c
index df19853..78a7bfb 100644
--- a/glib/tests/utf8-misc.c
+++ b/glib/tests/utf8-misc.c
@@ -350,11 +350,39 @@ test_combining_class (void)
   };
   for (i = 0; i < G_N_ELEMENTS (examples); i++)
     {
-      g_print ("%d: %#x\n", i, examples[i].c);
       g_assert (g_unichar_combining_class (examples[i].c) == examples[i].class);
     }
 }
 
+static void
+test_mirror (void)
+{
+  gunichar mirror;
+
+  g_assert (g_unichar_get_mirror_char ('(', &mirror));
+  g_assert_cmpint (mirror, ==, ')');
+  g_assert (g_unichar_get_mirror_char (')', &mirror));
+  g_assert_cmpint (mirror, ==, '(');
+  g_assert (g_unichar_get_mirror_char ('{', &mirror));
+  g_assert_cmpint (mirror, ==, '}');
+  g_assert (g_unichar_get_mirror_char ('}', &mirror));
+  g_assert_cmpint (mirror, ==, '{');
+  g_assert (g_unichar_get_mirror_char (0x208D, &mirror));
+  g_assert_cmpint (mirror, ==, 0x208E);
+  g_assert (g_unichar_get_mirror_char (0x208E, &mirror));
+  g_assert_cmpint (mirror, ==, 0x208D);
+  g_assert (!g_unichar_get_mirror_char ('a', &mirror));
+}
+
+static void
+test_mark (void)
+{
+  g_assert (g_unichar_ismark (0x0903));
+  g_assert (g_unichar_ismark (0x20DD));
+  g_assert (g_unichar_ismark (0xA806));
+  g_assert (!g_unichar_ismark ('a'));
+}
+
 int
 main (int   argc,
       char *argv[])
@@ -369,6 +397,8 @@ main (int   argc,
   g_test_add_func ("/unicode/break-type", test_unichar_break_type);
   g_test_add_func ("/unicode/script", test_unichar_script);
   g_test_add_func ("/unicode/combining-class", test_combining_class);
+  g_test_add_func ("/unicode/mirror", test_mirror);
+  g_test_add_func ("/unicode/mark", test_mark);
 
   return g_test_run();
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]