Sha256: 544011e517f633ad8be9aedc9250afd8a9061fbe9d61c87c1f43e2bb579cf609
Contents?: true
Size: 1.08 KB
Versions: 1
Compression:
Stored size: 1.08 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/spec_helper') describe DamLev do describe ".distance" do it "should calculate a distance of zero between the same string" do DamLev.distance("DamLev", "DamLev").should == 0 end it "should calculate a distance of one when a character has been deleted between two strings" do DamLev.distance("DamLev", "Damev").should == 1 end it "should calculate a distance of one when a character has been inserted between two strings" do DamLev.distance("DamLev", "DamLiev").should == 1 end it "should calculate a distance of one when a character has been substituted between two strings" do DamLev.distance("DamLev", "Dam7ev").should == 1 end it "should calculate a distance of two when two characters have been swapped between two strings" do DamLev.distance("DamLev", "DameLv").should == 2 end it "should calculate a distance equal to the longest string if the other is empty" do DamLev.distance("DamLev", "").should == "DamLev".length end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dam_lev-1.0.0 | spec/DamLev_spec.rb |