Sha256: 0e8bd39e2c8a91da4c415a42d539cdb855b545f553451e067e07e02d95cf437e
Contents?: true
Size: 1.94 KB
Versions: 4
Compression:
Stored size: 1.94 KB
Contents
# Copyright (C) 2009 Kouhei Sutou <kou@clear-code.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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA class ExpressionTest < Test::Unit::TestCase include GroongaTestUtils setup :setup_database def test_get_value users = Groonga::Hash.create(:name => "<users>") name = users.define_column("name", "<shorttext>") morita = users.add("morita", :name => "mori daijiro") expression = Groonga::Expression.new expression.append_constant(morita) expression.append_constant("name") expression.append_operation(Groonga::Operation::OBJECT_GET_VALUE, 2) expression.compile assert_equal("mori daijiro", expression.execute) end def test_get_value_with_variable users = Groonga::Hash.create(:name => "<users>") name = users.define_column("name", "<shorttext>") morita = users.add("morita", :name => "mori daijiro") gunyara_kun = users.add("gunyara-kun", :name => "Tasuku SUENAGA") expression = Groonga::Expression.new variable = expression.define_variable variable.value = morita expression.append_object(variable) expression.append_constant("name") expression.append_operation(Groonga::Operation::OBJECT_GET_VALUE, 2) expression.compile assert_equal("mori daijiro", expression.execute) variable.value = gunyara_kun.id assert_equal("Tasuku SUENAGA", expression.execute) end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
groonga-0.0.3 | test/test-expression.rb |
groonga-0.0.4 | test/test-expression.rb |
groonga-0.0.5 | test/test-expression.rb |
groonga-0.0.6 | test/test-expression.rb |