[evolution-data-server/openismus-work-master: 46/46] e-collator-test: Add special case tests for Chinese sorting.



commit 49a03b2c32dba43c549a0962297b71e5428d7650
Author: Tristan Van Berkom <tristanvb openismus com>
Date:   Sat Jun 8 21:06:30 2013 +0900

    e-collator-test: Add special case tests for Chinese sorting.
    
    Check that chinese words are sorted in the same buckets as
    Latin charachter names in an A-Z alphabetic index.

 tests/libedataserver/e-collator-test.c |   20 ++++++++++++++++----
 1 files changed, 16 insertions(+), 4 deletions(-)
---
diff --git a/tests/libedataserver/e-collator-test.c b/tests/libedataserver/e-collator-test.c
index 22cf9a4..cf8b38f 100644
--- a/tests/libedataserver/e-collator-test.c
+++ b/tests/libedataserver/e-collator-test.c
@@ -169,7 +169,6 @@ test_ja_JP (CollatorFixture *fixture,
   g_assert_cmpint (e_collator_get_index (fixture->collator, "ゆっくりしゃべってくれますか"), ==, 8);
 }
 
-#if 0
 static void
 test_zh_CN (CollatorFixture *fixture,
            gconstpointer    data)
@@ -180,9 +179,24 @@ test_zh_CN (CollatorFixture *fixture,
   labels = e_collator_get_index_labels (fixture->collator,
                                        &n_labels, &underflow, &inflow, &overflow);
 
+  g_assert_cmpint (n_labels, ==, 28);
+  g_assert_cmpint (underflow, ==, 0);
+  g_assert_cmpint (overflow, ==, 27);
+  g_assert_cmpint (inflow, ==, -1);
 
+  /* Chinese and Latin words end up in the 'D' bucket */
+  g_assert_cmpstr (labels[4], ==, "D");
+  g_assert_cmpint (e_collator_get_index (fixture->collator, "东"), ==, 4);
+  g_assert_cmpint (e_collator_get_index (fixture->collator, "david"), ==, 4);
+
+  g_assert_cmpstr (labels[10], ==, "J");
+  g_assert_cmpint (e_collator_get_index (fixture->collator, "今天"), ==, 10);
+  g_assert_cmpint (e_collator_get_index (fixture->collator, "Jeffry"), ==, 10);
+
+  g_assert_cmpstr (labels[26], ==, "Z");
+  g_assert_cmpint (e_collator_get_index (fixture->collator, "早上"), ==, 26);
+  g_assert_cmpint (e_collator_get_index (fixture->collator, "Zack"), ==, 26);
 }
-#endif
 
 gint
 main (gint argc,
@@ -210,11 +224,9 @@ main (gint argc,
                "/ECollator/ja_JP", CollatorFixture, "ja_JP.UTF-8",
                collator_test_setup, test_ja_JP, collator_test_teardown);
 
-#if 0
        g_test_add (
                "/ECollator/zh_CN", CollatorFixture, "zh_CN.UTF-8",
                collator_test_setup, test_zh_CN, collator_test_teardown);
-#endif
 
        return g_test_run ();
 }


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