Sha256: 7e1a3b50b28d3e7ffda551c7ab796d517f73b8f9440aa55c255d63c2ed3affd2

Contents?: true

Size: 596 Bytes

Versions: 2

Compression:

Stored size: 596 Bytes

Contents

require File.join(File.dirname(__FILE__), 'preamble')

begin
  require 'rubygems' rescue nil
  require 'fastercsv'
  METHOD = [ FasterCSV, :foreach, { :col_sep => ', ' } ]
rescue LoadError
  require 'csv'
  METHOD = [ CSV, :open, 'r', ', ' ]
end

class DoubleMetaphoneTest < Test::Unit::TestCase

  def test_cases
    METHOD.shift.send(METHOD.shift, File.rel('data', 'double_metaphone.csv'), *METHOD) do |row|
      primary, secondary = Text::Metaphone.double_metaphone(row[0])

      assert_equal row[1], primary
      assert_equal row[2], secondary.nil?? primary : secondary
    end
  end

end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
text-0.1.13 test/test_double_metaphone.rb
Text-1.1.2 test/test_double_metaphone.rb