Navigation Menu

Skip to content

Commit

Permalink
test: Add more tests for table_list command
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Apr 24, 2014
1 parent bb4b44c commit 83734bb
Showing 1 changed file with 99 additions and 0 deletions.
99 changes: 99 additions & 0 deletions test/unit/plugins/groonga/test_table_list.rb
Expand Up @@ -81,5 +81,104 @@ def test_array_table
]
assert_equal(expected, response.last)
end

def test_patricia_trie_table
Groonga::Schema.define(:context => @context) do |schema|
schema.create_table("Books", :type => :patricia_trie)
end
response = process(:table_list, {})
expected = [
TABLES_HEADER,
[256,
"Books",
@database_path.to_s + ".0000100",
"TABLE_PAT_KEY|PERSISTENT",
"ShortText",
nil,
nil,
nil],
]
assert_equal(expected, response.last)
end

def test_double_array_trie_table
Groonga::Schema.define(:context => @context) do |schema|
schema.create_table("Books", :type => :double_array_trie)
end
response = process(:table_list, {})
expected = [
TABLES_HEADER,
[256,
"Books",
@database_path.to_s + ".0000100",
"TABLE_DAT_KEY|PERSISTENT",
"ShortText",
nil,
nil,
nil],
]
assert_equal(expected, response.last)
end

def test_with_value_type
Groonga::Schema.define(:context => @context) do |schema|
schema.create_table("BookIds", :type => :hash,
:key_type => "UInt32",
:value_type => "UInt32")
end
response = process(:table_list, {})
expected = [
TABLES_HEADER,
[256,
"BookIds",
@database_path.to_s + ".0000100",
"TABLE_HASH_KEY|PERSISTENT",
"UInt32",
"UInt32",
nil,
nil],
]
assert_equal(expected, response.last)
end

def test_with_default_tokenizer
Groonga::Schema.define(:context => @context) do |schema|
schema.create_table("Books", :type => :hash,
:default_tokenizer => "TokenBigram")
end
response = process(:table_list, {})
expected = [
TABLES_HEADER,
[256,
"Books",
@database_path.to_s + ".0000100",
"TABLE_HASH_KEY|PERSISTENT",
"ShortText",
nil,
"TokenBigram",
nil],
]
assert_equal(expected, response.last)
end

def test_with_normalizer
Groonga::Schema.define(:context => @context) do |schema|
schema.create_table("Books", :type => :hash,
:normalizer => "NormalizerAuto")
end
response = process(:table_list, {})
expected = [
TABLES_HEADER,
[256,
"Books",
@database_path.to_s + ".0000100",
"TABLE_HASH_KEY|PERSISTENT",
"ShortText",
nil,
nil,
"NormalizerAuto"],
]
assert_equal(expected, response.last)
end
end
end

0 comments on commit 83734bb

Please sign in to comment.