[Groonga-commit] ranguba/rroonga at 3af8876 [drilldowns] Add a test for :calc_target and :calc_types with Groonga::Table#group

Back to archive index

Masafumi Yokoyama null+****@clear*****
Mon Feb 9 17:51:37 JST 2015


Masafumi Yokoyama	2015-02-09 17:51:37 +0900 (Mon, 09 Feb 2015)

  New Revision: 3af8876595ec95f7da37154131d4e34c5136652f
  https://github.com/ranguba/rroonga/commit/3af8876595ec95f7da37154131d4e34c5136652f

  Message:
    Add a test for :calc_target and :calc_types with Groonga::Table#group

  Added files:
    test/test-table-drilldown.rb

  Added: test/test-table-drilldown.rb (+71 -0) 100644
===================================================================
--- /dev/null
+++ test/test-table-drilldown.rb    2015-02-09 17:51:37 +0900 (754cd10)
@@ -0,0 +1,71 @@
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2015  Masafumi Yokoyama <myokoym �� gmail.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1 as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+
+class TableDrilldownTest < Test::Unit::TestCase
+  include GroongaTestUtils
+
+  setup :setup_database
+
+  setup
+  def setup_memos
+    @tags = Groonga::PatriciaTrie.create(:name => "Tags", :key_type => "ShortText")
+
+    @memos = Groonga::Hash.create(:name => "Memos", :key_type => "ShortText")
+    @memos.define_column("tag", "Tags")
+    @memos.define_column("priority", "Int64")
+
+    @memo1 =****@memos*****("Groonga1",
+                        :tag => "Groonga",
+                        :priority => 10)
+    @memo2 =****@memos*****("Groonga2",
+                        :tag => "Groonga",
+                        :priority => 20)
+    @memo3 =****@memos*****("Groonga3",
+                        :tag => "Groonga",
+                        :priority => 40)
+    @memo4 =****@memos*****("Mroonga1",
+                        :tag => "Mroonga",
+                        :priority => 50)
+    @memo5 =****@memos*****("Mroonga2",
+                        :tag => "Mroonga",
+                        :priority => 25)
+    @memo6 =****@memos*****("Mroonga3",
+                        :tag => "Mroonga",
+                        :priority => 10)
+    @memo7 =****@memos*****("Rroonga1",
+                        :tag => "Mroonga",
+                        :priority => 25)
+    @memo8 =****@memos*****("Rroonga2",
+                        :tag => "Mroonga",
+                        :priority => -25)
+    @memo9 =****@memos*****("Rroonga3",
+                        :tag => "Mroonga",
+                        :priority => 0)
+  end
+
+  setup
+  def setup_variables
+    @result = nil
+  end
+
+  def test_max
+    @result =****@memos*****("tag",
+                           :calc_target => :priority,
+                           :calc_types => [:max])
+    assert_equal(50, @result.max)
+  end
+end
-------------- next part --------------
HTML����������������������������...
Download 



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