[Groonga-commit] ranguba/rroonga at 5898542 [bind-grn_obj_reindex] test: update schema

Back to archive index

Masafumi Yokoyama null+****@clear*****
Sun Jan 10 15:44:47 JST 2016


Masafumi Yokoyama	2016-01-10 15:44:47 +0900 (Sun, 10 Jan 2016)

  New Revision: 589854265cf75cb85a2fa859edc5ddc37d19ae6d
  https://github.com/ranguba/rroonga/commit/589854265cf75cb85a2fa859edc5ddc37d19ae6d

  Message:
    test: update schema

  Modified files:
    test/test-fix-size-column.rb

  Modified: test/test-fix-size-column.rb (+61 -11)
===================================================================
--- test/test-fix-size-column.rb    2016-01-10 15:22:16 +0900 (be7a6ce)
+++ test/test-fix-size-column.rb    2016-01-10 15:44:47 +0900 (d2a8f4a)
@@ -25,33 +25,83 @@ class FixSizeColumnTest < Test::Unit::TestCase
     Groonga::Schema.define do |schema|
       schema.create_table("Users", :type => :hash) do |table|
         table.integer32("age")
+        table.integer32("score")
       end
+
+      schema.create_table("Numbers",
+                          :type => :patricia_trie,
+                          :key_type => :integer32) do |table|
+        table.index("Users.age")
+        table.index("Users.score")
+      end
+
       schema.create_table("Ages",
                           :type => :patricia_trie,
                           :key_type => :integer32) do |table|
         table.index("Users.age")
       end
+
+      schema.create_table("Scores",
+                          :type => :patricia_trie,
+                          :key_type => :integer32) do |table|
+        table.index("Users.score")
+      end
     end
 
     users = context["Users"]
-    users.add("Alice", :age => 16)
-    users.add("Bob", :age => 29)
+    users.add("Alice", :age => 16, :score => 123)
+    users.add("Bob", :age => 29, :score => -10)
+
+    numbers = context["Numbers"]
+    numbers.delete(16)
+    numbers.delete(123)
 
     ages = context["Ages"]
     ages.delete(29)
 
-    assert_equal([
-                   16,
-                 ],
-                 ages.collect(&:_key).sort)
+    scores = context["Scores"]
+    scores.delete(-10)
+
+    assert_equal({
+                   :numbers => [
+                     -10,
+                     29,
+                   ],
+                   :ages => [
+                     16,
+                   ],
+                   :scores => [
+                     123,
+                   ],
+                 },
+                 {
+                   :numbers => numbers.collect(&:_key).sort,
+                   :ages => ages.collect(&:_key).sort,
+                   :scores => scores.collect(&:_key).sort,
+                 })
 
     context["Users.age"].reindex
 
-    assert_equal([
-                   16,
-                   29,
-                 ],
-                 ages.collect(&:_key).sort)
+    assert_equal({
+                   :numbers => [
+                     -10,
+                     16,
+                     29,
+                   ],
+                   :ages => [
+                     16,
+                     29,
+                   ],
+                   :scores => [
+                     123,
+                   ],
+                 },
+                 {
+                   :numbers => numbers.collect(&:_key).sort,
+                   :ages => ages.collect(&:_key).sort,
+                   :scores => scores.collect(&:_key).sort,
+                 })
+
   end
 
   class OperationTest < self
-------------- next part --------------
HTML����������������������������...
Download 



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