Sha256: 65d47821c56d7aa66fcd78d5d9efe4d6f5c53f23671ad897dcc07a9889ebde15

Contents?: true

Size: 722 Bytes

Versions: 7

Compression:

Stored size: 722 Bytes

Contents

require 'test/unit'
require File.dirname(__FILE__) + "/../ext/amatch"

class TestJaro < Test::Unit::TestCase
  include Amatch

  D = 0.0005

  def setup
    @martha = Jaro.new('Martha')
    @dwayne = Jaro.new('dwayne')
    @dixon  = Jaro.new('DIXON')
    @one    = Jaro.new('one')
  end

  def test_case
    @martha.ignore_case = true
    assert_in_delta 0.944, @martha.match('MARHTA'), D
    @martha.ignore_case = false
    assert_in_delta 0.444, @martha.match('MARHTA'), D
  end

  def test_match
    assert_in_delta 0.944, @martha.match('MARHTA'), D
    assert_in_delta 0.822, @dwayne.match('DUANE'), D
    assert_in_delta 0.767, @dixon.match('DICKSONX'), D
    assert_in_delta 0.667, @one.match('orange'), D
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
patmcnally-amatch-0.2.4 tests/test_jaro.rb
amatch-0.2.8 tests/test_jaro.rb
amatch-0.2.7 tests/test_jaro.rb
amatch-0.2.6 tests/test_jaro.rb
amatch-0.2.5-x86-mswin32 tests/test_jaro.rb
amatch-0.2.5 tests/test_jaro.rb
amatch-0.2.4 tests/test_jaro.rb