Add unit tests for checking substrings

checking if all substrings contained in compareString
This commit is contained in:
Jeremy Wu
2020-01-07 07:55:02 +11:00
parent 0093838a75
commit 24cc5dbaa0
2 changed files with 23 additions and 1 deletions

View File

@@ -247,5 +247,21 @@ namespace Wox.Test
$"Raw Score: {matchResult.RawScore}{Environment.NewLine}" +
$"Precision Level: {expectedPrecisionString}={expectedPrecisionScore}");
}
[TestCase("sql servman", MicrosoftSqlServerManagementStudio, false)]
[TestCase("sql serv man", MicrosoftSqlServerManagementStudio, true)]
[TestCase("sql", MicrosoftSqlServerManagementStudio, true)]
[TestCase("sqlserv", MicrosoftSqlServerManagementStudio, false)]
[TestCase("mssms", MicrosoftSqlServerManagementStudio, false)]
[TestCase("chr", "Change settings for text-to-speech and for speech recognition (if installed).", false)]
[TestCase("ch r", "Change settings for text-to-speech and for speech recognition (if installed).", true)]
public void WhenGivenQueryShouldEvaluateTrueFalseIfCompareStringContainsAllSubstrings(string queryString, string compareString, bool expectedResult)
{
// When, Given
var matchResult = StringMatcher.FuzzySearch(queryString, compareString).AllSubstringsContainedInCompareString;
// Should
Assert.AreEqual(matchResult, expectedResult);
}
}
}