[Groonga-commit] droonga/droonga-engine at 32c5679 [master] test: Add tests for "filter" option of "select" command

Back to archive index

YUKI Hiroshi null+****@clear*****
Mon Apr 28 16:41:53 JST 2014


YUKI Hiroshi	2014-04-28 16:41:53 +0900 (Mon, 28 Apr 2014)

  New Revision: 32c567929f8469e591316d274758a7f94545ba77
  https://github.com/droonga/droonga-engine/commit/32c567929f8469e591316d274758a7f94545ba77

  Message:
    test: Add tests for "filter" option of "select" command

  Modified files:
    test/unit/plugins/groonga/select/test_adapter_input.rb

  Modified: test/unit/plugins/groonga/select/test_adapter_input.rb (+76 -0)
===================================================================
--- test/unit/plugins/groonga/select/test_adapter_input.rb    2014-04-28 16:36:53 +0900 (eb62663)
+++ test/unit/plugins/groonga/select/test_adapter_input.rb    2014-04-28 16:41:53 +0900 (f69b34c)
@@ -113,6 +113,82 @@ class GroongaSelectAdapterInputTest < Test::Unit::TestCase
     end
   end
 
+  class FilterTest < self
+    def test_filter
+      select_request = {
+        "table"          => "EmptyTable",
+        "filter"         => "title@'FilterTest'",
+        "output_columns" => "_id",
+      }
+
+      expected_search_request = {
+        "queries" => {
+          "EmptyTable_result" => {
+            "source"   => "EmptyTable",
+            "condition"=> "title@'FilterTest'",
+            "output"   => {
+              "elements"   => [
+                "startTime",
+                "elapsedTime",
+                "count",
+                "attributes",
+                "records",
+              ],
+              "attributes" => ["_id"],
+              "offset" => 0,
+              "limit" => 10,
+            },
+          },
+        },
+      }
+      assert_equal(expected_search_request, convert(select_request))
+    end
+  end
+
+  class CombinedConditionsTest < self
+    def test_conditions
+      select_request = {
+        "table"          => "EmptyTable",
+        "match_columns"  => "_key",
+        "query"          => "QueryTest",
+        "filter"         => "title@'FilterTest'",
+        "output_columns" => "_id",
+      }
+
+      expected_search_request = {
+        "queries" => {
+          "EmptyTable_result" => {
+            "source"   => "EmptyTable",
+            "condition"=> [
+              "&&",
+              {
+                "query"  => "QueryTest",
+                "matchTo"=> ["_key"],
+                "defaultOperator"=> "&&",
+                "allowPragma"=> false,
+                "allowColumn"=> true,
+              },
+              "title@'FilterTest'",
+            ],
+            "output"   => {
+              "elements"   => [
+                "startTime",
+                "elapsedTime",
+                "count",
+                "attributes",
+                "records",
+              ],
+              "attributes" => ["_id"],
+              "offset" => 0,
+              "limit" => 10,
+            },
+          },
+        },
+      }
+      assert_equal(expected_search_request, convert(select_request))
+    end
+  end
+
   class OffsetTest < self
     def assert_offset(expected_offset, offset)
       select_request = {
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index