File: soundex_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 (20 lines) | stat: -rw-r--r-- 491 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
require_relative "./test_helper"
require "text/soundex"
require 'yaml'

class SoundexTest < Test::Unit::TestCase

  def test_cases
    YAML.load(data_file('soundex.yml')).each do |input, expected_output|
      assert_equal expected_output, Text::Soundex.soundex(input)
    end
  end

  def test_should_return_nil_for_empty_string
    assert_nil Text::Soundex.soundex("")
  end

  def test_should_return_nil_for_string_with_no_letters
    assert_nil Text::Soundex.soundex("!@#123")
  end
end