[Groonga-commit] groonga/groonga [master] [suggest][test] add a test for completion with prefix RK search.

Back to archive index

null+****@clear***** null+****@clear*****
2011年 8月 14日 (日) 22:18:55 JST


Kouhei Sutou	2011-08-14 13:18:55 +0000 (Sun, 14 Aug 2011)

  New Revision: 32e5e50dc0da3c900587e1f496e7a5c1fe5eadab

  Log:
    [suggest][test] add a test for completion with prefix RK search.

  Modified files:
    test/unit/story/test-rurema.c

  Modified: test/unit/story/test-rurema.c (+38 -0)
===================================================================
--- test/unit/story/test-rurema.c    2011-08-14 12:34:31 +0000 (57c95a0)
+++ test/unit/story/test-rurema.c    2011-08-14 13:18:55 +0000 (9d2a035)
@@ -21,6 +21,8 @@
 
 #include "../lib/grn-assertions.h"
 
+void data_complete_prefix_rk_search(void);
+void test_complete_prefix_rk_search(gconstpointer data);
 void test_complete_cooccurrence(void);
 void test_correct_cooccurrence(void);
 void test_suggest_cooccurrence(void);
@@ -95,6 +97,42 @@ cut_teardown(void)
 }
 
 void
+data_complete_prefix_rk_search(void)
+{
+#define ADD_DATUM(label, query)                 \
+  gcut_add_datum(label " - " query,             \
+                 "query", G_TYPE_STRING, query, \
+                 NULL)
+
+  ADD_DATUM("romaji", "tan");
+  ADD_DATUM("katakana", "タン");
+  ADD_DATUM("hiragana", "たん");
+  ADD_DATUM("hiragana + romaji", "たn");
+
+#undef ADD_DATUM
+}
+
+void
+test_complete_prefix_rk_search(gconstpointer data)
+{
+  cut_assert_equal_string(
+    "{\"complete\":"
+     "[[1],"
+      "[[\"_key\",\"ShortText\"],"
+       "[\"_score\",\"Int32\"]],"
+      "[\"短縮\",1]]}",
+    send_command(
+      cut_take_printf(
+        "suggest "
+        "--table item_rurema "
+        "--column kana "
+        "--types complete "
+        "--threshold 1 "
+        "--query '%s'",
+        gcut_data_get_string(data, "query"))));
+}
+
+void
 test_complete_coocurrence(void)
 {
   cut_assert_equal_string(




Groonga-commit メーリングリストの案内
Back to archive index