[Groonga-commit] groonga/groonga [master] add tests for sorting by _score without query.

Back to archive index

null+****@clear***** null+****@clear*****
2010年 7月 5日 (月) 12:17:22 JST


Kouhei Sutou	2010-07-05 03:17:22 +0000 (Mon, 05 Jul 2010)

  New Revision: 168ff7b5d65a3ca97b709de857910722440035a3

  Log:
    add tests for sorting by _score without query.

  Modified files:
    test/unit/core/test-command-select-sort.c

  Modified: test/unit/core/test-command-select-sort.c (+55 -0)
===================================================================
--- test/unit/core/test-command-select-sort.c    2010-07-05 03:16:41 +0000 (4e9deb4)
+++ test/unit/core/test-command-select-sort.c    2010-07-05 03:17:22 +0000 (0b97185)
@@ -24,6 +24,9 @@
 #include "../lib/grn-assertions.h"
 
 void test_int(void);
+void test_drilldown(void);
+void test_score_without_query(void);
+void test_score_drilldown_without_query(void);
 
 static gchar *tmp_directory;
 
@@ -184,3 +187,55 @@ test_drilldown(void)
                    "--drilldown_output_columns \"_key _nsubrecs\" "
                    "--drilldown_sortby \"_key\""));
 }
+
+void
+test_score_without_query(void)
+{
+  cut_assert_equal_string(
+      "[[[3],"
+       "[[\"_key\",\"ShortText\"]],"
+       "[\"2ch.net\"],"
+       "[\"groonga.org\"],"
+       "[\"qwik.jp/senna/FrontPageJ.html\"]]]",
+      send_command("select Sites "
+                   "--sortby \"_score\" "
+                   "--output_columns \"_key\""));
+}
+
+void
+test_score_drilldown_without_query(void)
+{
+  cut_assert_equal_string(
+      "[[[5],"
+       "[[\"site._key\",\"ShortText\"],"
+        "[\"user._key\",\"ShortText\"]],"
+       "[\"groonga.org\",\"morita\"],"
+       "[\"groonga.org\",\"gunyara-kun\"],"
+       "[\"groonga.org\",\"yu\"],"
+       "[\"2ch.net\",\"gunyara-kun\"],"
+       "[\"2ch.net\",\"yu\"]],\n"
+       "[[2],"
+        "[[\"_key\",\"ShortText\"],"
+         "[\"_nsubrecs\",\"Int32\"]],"
+        "[\"2ch.net\",2],"
+        "[\"groonga.org\",3]],\n"
+       "[[3],"
+        "[[\"_key\",\"ShortText\"],"
+         "[\"_nsubrecs\",\"Int32\"]],"
+        "[\"gunyara-kun\",2],"
+        "[\"morita\",1],"
+        "[\"yu\",2]],\n"
+       "[[4],"
+         "[[\"_key\",\"Int32\"],"
+          "[\"_nsubrecs\",\"Int32\"]],"
+        "[0,1],"
+        "[10,1],"
+        "[50,1],"
+        "[100,2]]]",
+      send_command("select Bookmarks "
+                   "--sortby \"_score\" "
+                   "--output_columns \"site._key user._key\" "
+                   "--drilldown \"site user rank\" "
+                   "--drilldown_output_columns \"_key _nsubrecs\" "
+                   "--drilldown_sortby \"_key\""));
+}




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