Skip to content

Commit a94395d

Browse files
committed
rename
1 parent 6cc7a9f commit a94395d

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

lib/dmp/patch.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ defmodule Dmp.Patch do
572572
# Imperfect match. Run a diff to get a framework of equivalent indices.
573573
diffs = Diff.main_(text1, text2, false, opts)
574574

575-
if poor_match(diffs, text1, opts) do
575+
if bad_match?(diffs, text1, opts) do
576576
# The end points match, but the content is unacceptably bad.
577577
{false, text}
578578
else
@@ -588,7 +588,7 @@ defmodule Dmp.Patch do
588588
end
589589

590590
# Returns true if the end points match, but the content is unacceptably bad.
591-
def poor_match(diffs, text1, opts) do
591+
def bad_match?(diffs, text1, opts) do
592592
text1_length = String.length(text1)
593593

594594
if text1_length > Keyword.fetch!(opts, :match_max_bits) do

test/match_test.exs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,5 @@ defmodule MatchTest do
130130
match_threshold: 0.7
131131
)
132132
end
133-
134-
test "fuzzy score" do
135-
{loc, score} = Match.bitap("abcdefghijk", "efxyhi", 1, 0.4, 100, true)
136-
assert 4 == loc
137-
assert_in_delta 0.36333, score, 0.00001
138-
end
139133
end
140134
end

test/other_test.exs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
defmodule OtherTest do
22
use ExUnit.Case
33

4-
alias Dmp.{Options, StringUtils}
4+
alias Dmp.{Match, Options, StringUtils}
55

66
doctest Dmp.Options
77
doctest Dmp.StringUtils
8+
9+
describe "bitap scores" do
10+
test "inexact match" do
11+
{loc, score} = Match.bitap("abcdefghijk", "efxyhi", 1, 0.4, 100, true)
12+
assert 4 == loc
13+
assert_in_delta 0.36333, score, 0.00001
14+
end
15+
end
816
end

0 commit comments

Comments
 (0)