[Groonga-commit] droonga/fluent-plugin-droonga at 1042ce0 [master] Add test for "average" reducer

Back to archive index

YUKI Hiroshi null+****@clear*****
Mon Jan 27 12:06:42 JST 2014


YUKI Hiroshi	2014-01-27 12:06:42 +0900 (Mon, 27 Jan 2014)

  New Revision: 1042ce06fdbaadc6383c8bbad169521f17ca7924
  https://github.com/droonga/fluent-plugin-droonga/commit/1042ce06fdbaadc6383c8bbad169521f17ca7924

  Message:
    Add test for "average" reducer

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

  Modified: test/unit/plugin/collector/test_basic.rb (+44 -0)
===================================================================
--- test/unit/plugin/collector/test_basic.rb    2014-01-27 12:04:44 +0900 (8f90161)
+++ test/unit/plugin/collector/test_basic.rb    2014-01-27 12:06:42 +0900 (20caa12)
@@ -92,6 +92,50 @@ class BasicCollectorTest < Test::Unit::TestCase
 
   class ReduceTest < self
     data(
+      :int => {
+        :expected => 1.5,
+        :value => 1,
+        :source => 2,
+      },
+      :float => {
+        :expected => 1.5,
+        :value => 1.0,
+        :source => 2.0,
+      },
+    )
+    def test_average(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" => "average",
+                },
+              },
+            },
+            "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(
       :true_and_false => {
         :expected => false,
         :value => true,
-------------- next part --------------
HTML����������������������������...
Download 



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