Sha256: 047fe6f3c1cc53f97404ca129bc6e7bfbf150d4023653c3ac26d97dd8e95020d
Contents?: true
Size: 1.32 KB
Versions: 1
Compression:
Stored size: 1.32 KB
Contents
require "test_helper" require "text/metaphone" require 'yaml' class MetaphoneTest < Test::Unit::TestCase def test_cases YAML.load(data_file('metaphone.txt')).each do |input, expected_output| assert_equal expected_output, Text::Metaphone.metaphone(input) end end def test_cases_for_buggy_implementation YAML.load(data_file('metaphone_buggy.txt')).each do |input, expected_output| assert_equal expected_output, Text::Metaphone.metaphone(input, :buggy=>true) end end def test_junk assert_equal Text::Metaphone.metaphone('foobar'), Text::Metaphone.metaphone('%^@#$^f%^&o%^o@b#a@#r%^^&') assert_equal Text::Metaphone.metaphone('foobar', :buggy=>true), Text::Metaphone.metaphone('%^@#$^f%^&o%^o@b#a@#r%^^&', :buggy=>true) end def test_caps assert_equal Text::Metaphone.metaphone('foobar'), Text::Metaphone.metaphone('FOOBAR') assert_equal Text::Metaphone.metaphone('foobar', :buggy=>true), Text::Metaphone.metaphone('FOOBAR', :buggy=>true) end def test_string assert_equal 'F BR BS', Text::Metaphone.metaphone('foo bar baz') assert_equal 'N WT', Text::Metaphone.metaphone('gnu what') assert_equal 'F BR BS', Text::Metaphone.metaphone('foo bar baz', :buggy=>true) assert_equal 'N WT', Text::Metaphone.metaphone('gnu what', :buggy=>true) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
text-1.2.3 | test/metaphone_test.rb |