Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
15 lines (14 sloc) 677 Bytes
$: << File.join(File.expand_path(File.dirname(__FILE__)), '..', 'lib')
require 'algorithms'
if defined? Algorithms::String
describe "string algorithms" do
it "should do levenshtein distance" do
expect(Algorithms::String.levenshtein_dist("Hello", "Hel")).to eql(2)
expect(Algorithms::String.levenshtein_dist("Hello", "")).to eql(5)
expect(Algorithms::String.levenshtein_dist("", "Hello")).to eql(5)
expect(Algorithms::String.levenshtein_dist("Hello", "Hello")).to eql(0)
expect(Algorithms::String.levenshtein_dist("Hello", "ello")).to eql(1)
expect(Algorithms::String.levenshtein_dist("Hello", "Mello")).to eql(1)
end
end
end
Jump to Line
Something went wrong with that request. Please try again.