[Groonga-commit] droonga/fluent-plugin-droonga at 800c22c [master] Add test for "and" reducer

Back to archive index

YUKI Hiroshi null+****@clear*****
Mon Jan 27 11:44:00 JST 2014


YUKI Hiroshi	2014-01-27 11:44:00 +0900 (Mon, 27 Jan 2014)

  New Revision: 800c22c214037142bc26254a74911c40ae89a907
  https://github.com/droonga/fluent-plugin-droonga/commit/800c22c214037142bc26254a74911c40ae89a907

  Message:
    Add test for "and" reducer

  Modified files:
    test/unit/plugin/collector/test_basic.rb

  Modified: test/unit/plugin/collector/test_basic.rb (+54 -1)
===================================================================
--- test/unit/plugin/collector/test_basic.rb    2014-01-24 18:04:18 +0900 (6feed87)
+++ test/unit/plugin/collector/test_basic.rb    2014-01-27 11:44:00 +0900 (8f90161)
@@ -92,6 +92,60 @@ class BasicCollectorTest < Test::Unit::TestCase
 
   class ReduceTest < self
     data(
+      :true_and_false => {
+        :expected => false,
+        :value => true,
+        :source => false,
+      },
+      :false_and_true => {
+        :expected => false,
+        :value => false,
+        :source => true,
+      },
+      :both_true => {
+        :expected => true,
+        :value => true,
+        :source => true,
+      },
+      :both_false => {
+        :expected => false,
+        :value => false,
+        :source => false,
+      },
+    )
+    def test_and(data)
+      input_name = "input_#{Time.now.to_i}"
+      output_name = "output_#{Time.now.to_i}"
+      request = {
+        "task" => {
+          "values" => {
+            output_name => data[:value],
+          },
+          "component" => {
+            "body" => {
+              input_name => {
+                output_name => {
+                  "type" => "and",
+                },
+              },
+            },
+            "outputs" => nil,
+          },
+        },
+        "id" => nil,
+        "value" => data[:source],
+        "name" => input_name,
+        "descendants" => nil,
+      }
+      @plugin.process("collector_reduce", request)
+      assert_equal([
+                     output_name,
+                     data[:expected],
+                   ],
+                   @outputs.last)
+    end
+
+    data(
       :numeric_values => {
         :expected => 3,
         :value => 1,
@@ -324,7 +378,6 @@ class BasicCollectorTest < Test::Unit::TestCase
                    @outputs.last)
     end
 
-
     data(
       :numeric_key_records => {
         :expected => [
-------------- next part --------------
HTML����������������������������...
Download 



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