public void CamelCaseReturnsFullMatches() { var func = StringMatch.GetShowStringDelegates("MFB"); Assert.AreEqual(7.25, func("MyFooBar.txt").MatchPriority); Assert.AreEqual(7.2, func("MyFlipBlob2.jpg").MatchPriority); }
public void RegexMultiMoreMatchedIsBetter() { var func = StringMatch.GetShowStringDelegates("test this"); Assert.IsTrue(func("TestThis.txt").MatchPriority > func("Test.txt").MatchPriority); Assert.IsTrue(func("TestThis.txt").MatchPriority > func("TestThisToo.txt").MatchPriority); }
public void CamelCaseReturnsFullMatches() { var func = StringMatch.GetShowStringDelegates("MFB"); Assert.AreEqual(4, func("MyFooBar.txt").MatchFraction); Assert.AreEqual(4, func("MyFlipBlob.jpg").MatchFraction); }
public void EmptyPatternReturnsAllResults() { var func = StringMatch.GetShowStringDelegates(""); Assert.AreEqual(1, func("Test.txt").MatchPriority); Assert.AreEqual(1, func("AbC.cs").MatchPriority); Assert.AreEqual(1, func("image.JPG").MatchPriority); }
public void CamelCaseReturnsPartialMatches() { var func = StringMatch.GetShowStringDelegates("MFB"); Assert.AreEqual(4.15, func("ThisIsMyFooBar99.txt").MatchPriority); Assert.AreEqual(7.15, func("MyFlipBlobIsCool.jpg").MatchPriority); Assert.AreEqual(5.125, func("MySillyFlipFrogBlobs.jpg").MatchPriority); }
public void CamelCaseReturnsPartialMatches() { var func = StringMatch.GetShowStringDelegates("MFB"); Assert.AreEqual(1, func("ThisIsMyFooBar.txt").MatchFraction); Assert.AreEqual(4, func("MyFlipBlobAreCool.jpg").MatchFraction); Assert.AreEqual(2, func("MySillyFlipFrogBlob.jpg").MatchFraction); }
public void RegexMultiPartMatches() { var func = StringMatch.GetShowStringDelegates("test"); var match = func("thisisatest mytest xtest"); Assert.AreEqual(4, match); Assert.AreEqual("x", match.Parts[0]); Assert.AreEqual("test", match.Parts[1]); }
public void RegexMultiPartMatches() { var func = StringMatch.GetShowStringDelegates("test"); var match = func("thisisatest mytest xtest"); Assert.AreEqual(3, match.Parts.Count); Assert.AreEqual("thisisa", match.Parts[0].Text); Assert.AreEqual("test", match.Parts[1].Text); Assert.AreEqual(" mytest xtest", match.Parts[2].Text); }
public void RegexPartsAddUp() { var func = StringMatch.GetShowStringDelegates("test"); var filename = "TestThis"; var match = func(filename); Assert.AreEqual(2, match.Parts.Count); Assert.AreEqual(filename.Length, match.Parts[0].Text.Length + match.Parts[1].Text.Length); }
public void RegexMultiStringPartsAddUp() { var func = StringMatch.GetShowStringDelegates("test this"); var filename = "thisisatest mytest xtest"; var match = func(filename); Assert.AreEqual(4, match.Parts.Count); Assert.AreEqual(filename.Length, match.Parts[0].Text.Length + match.Parts[1].Text.Length + match.Parts[2].Text.Length + match.Parts[3].Text.Length); }
public void CamelCaseReturnsPositivePriority() { var func = StringMatch.GetShowStringDelegates("FB"); Assert.IsTrue(func("ThisIsMyFooBar.txt").MatchPriority > 0); }
public void RegexCountMatchOnce() { var func = StringMatch.GetShowStringDelegates("foo"); Assert.IsTrue(func("FooBar.txt").MatchPriority == func("FooFoo.txt").MatchPriority); }