File: double_metaphone_test.rb

package info (click to toggle)
ruby-text 1.3.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 564 kB
  • sloc: ruby: 1,147; makefile: 4
file content (17 lines) | stat: -rw-r--r-- 411 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
require_relative "./test_helper"
require "text/double_metaphone"

require 'csv'

class DoubleMetaphoneTest < Test::Unit::TestCase

  def test_cases
    CSV.open(data_file_path('double_metaphone.csv'), 'r').to_a.each 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