Sha256: a2981a3dd7ae58170865765e80be9f75c9083aaac410dcb96978a55191261eb9
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 one when two characters have been swapped between two strings" do DamLev.distance("DamLev", "DameLv").should == 1 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.1 | spec/dam_lev_spec.rb |