spec/support/levenshtein.rb in string_metric-0.1.3 vs spec/support/levenshtein.rb in string_metric-0.1.4

- old
+ new

@@ -32,10 +32,11 @@ expect(described_class.distance("kittenss", "kitten", max_distance: 1)).to eq 1 expect(described_class.distance("sitting", "kitten", max_distance: 2)).to eq 2 expect(described_class.distance("gambol", "gumbo", max_distance: 1)).to eq 1 expect(described_class.distance("kitten", "", max_distance: 2)).to eq 2 expect(described_class.distance("", "kitten", max_distance: 3)).to eq 3 + expect(described_class.distance("a", "reallylongwordfortest", max_distance: 5)).to eq 5 end end context "and normal distance is less than max_distance" do it "is calculated distance" do expect(described_class.distance("", "t", max_distance: 2)).to eq 1 @@ -49,10 +50,11 @@ expect(described_class.distance("sitting", "kitten", max_distance: 4)).to eq 3 expect(described_class.distance("gambol", "gumbo", max_distance: 3)).to eq 2 expect(described_class.distance("", "cat", max_distance: 4)).to eq 3 expect(described_class.distance("cat", "", max_distance: 5)).to eq 3 expect(described_class.distance("", "", max_distance: 2)).to eq 0 + expect(described_class.distance("a", "reallylongwordfortest", max_distance: 25)).to eq 20 end end context "and normal distance is same as max_distance" do it "is calculated distance" do expect(described_class.distance("test", "test", max_distance: 0)).to eq 0 @@ -64,9 +66,10 @@ expect(described_class.distance("sitting", "kitten", max_distance: 3)).to eq 3 expect(described_class.distance("gambol", "gumbo", max_distance: 2)).to eq 2 expect(described_class.distance("", "cat", max_distance: 3)).to eq 3 expect(described_class.distance("cat", "", max_distance: 3)).to eq 3 expect(described_class.distance("", "", max_distance: 0)).to eq 0 + expect(described_class.distance("a", "reallylongwordfortest", max_distance: 20)).to eq 20 end end end CSV.foreach("spec/fixtures/levenshtein.csv") do |row|