Sha256: 4d86419be2d85f78ea1a217cf3a6af9989fb4c3e3041365145e867bd4ef6e17f

Contents?: true

Size: 1.77 KB

Versions: 3

Compression:

Stored size: 1.77 KB

Contents

# -*- coding: utf-8 -*-
#
# Copyright (C) 2012  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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA

class NormalizerTest < Test::Unit::TestCase
  include GroongaTestUtils

  setup :setup_database

  def test_normalize
    assert_equal("abc", Groonga::Normalizer.normalize("AbC"))
  end

  def test_normalize_with_space
    assert_equal("abcdefgh", Groonga::Normalizer.normalize("AbC Def gh"))
  end

  def test_normalize_with_space_explicitly
    assert_equal("abcdefgh",
                 Groonga::Normalizer.normalize("AbC Def gh",
                                               :remove_blank => true))
  end

  def test_normalize_group_text
    assert_equal("キロメートルキロメートルキロメートルキロメートル",
                 Groonga::Normalizer.normalize("㌖㌖㌖㌖"));
  end

  def test_normalize_keep_space
    # full width space => half width space
    assert_equal("abc def gh",
                 Groonga::Normalizer.normalize("AbC Def gh",
                                               :remove_blank => false))
  end

  def test_normalize_tilda
    assert_equal("~~~", Groonga::Normalizer.normalize("~~〜"))
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rroonga-5.0.0-x64-mingw32 test/test-normalizer.rb
rroonga-5.0.0-x86-mingw32 test/test-normalizer.rb
rroonga-5.0.0 test/test-normalizer.rb