Skip to content

Commit

Permalink
add test for some linq methods
Browse files Browse the repository at this point in the history
  • Loading branch information
vforteli committed Aug 28, 2022
1 parent 99b2a15 commit 5668a6c
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions FuzzySearchNet.Tests/Tests/FuzzySearchLevenshteinTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -356,4 +356,28 @@ public void TestLevenshteinBufferBoundaryShort3Distance(string term, string text
TestUtils.AssertMatch(results[0], expectedStartIndex, expectedMatch, expectedDistance);
});
}


[Test]
public void TestLevenshteinLinq()
{
var text = "---abcc----abc---axc--";
var term = "abc";

var results = FuzzySearch.FindLevenshtein(term, text, 2).ToList();

Assert.Multiple(() =>
{
Assert.That(results.Count, Is.EqualTo(3));
TestUtils.AssertMatch(results[0], 3, "abc", 0);
TestUtils.AssertMatch(results[1], 11, "abc", 0);
TestUtils.AssertMatch(results[2], 17, "axc", 1);
});

Assert.Multiple(() =>
{
Assert.That(FuzzySearch.FindLevenshtein(term, text, 3).Any());
TestUtils.AssertMatch(FuzzySearch.FindLevenshtein(term, text, 3).First(), 3, "abc", 0);
});
}
}

0 comments on commit 5668a6c

Please sign in to comment.