YUKI Hiroshi
null+****@clear*****
Thu Apr 24 12:21:24 JST 2014
YUKI Hiroshi 2014-04-24 12:21:24 +0900 (Thu, 24 Apr 2014) New Revision: 83734bb0671e4fef64aae84a3267318facb7507e https://github.com/droonga/droonga-engine/commit/83734bb0671e4fef64aae84a3267318facb7507e Message: test: Add more tests for table_list command Modified files: test/unit/plugins/groonga/test_table_list.rb Modified: test/unit/plugins/groonga/test_table_list.rb (+99 -0) =================================================================== --- test/unit/plugins/groonga/test_table_list.rb 2014-04-24 12:08:01 +0900 (fd012d0) +++ test/unit/plugins/groonga/test_table_list.rb 2014-04-24 12:21:24 +0900 (8a0f2c9) @@ -81,5 +81,104 @@ class TableListTest < GroongaHandlerTest ] 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 -------------- next part -------------- HTML����������������������������...Download