mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Update test per comment
This commit is contained in:
parent
592f1cafdb
commit
504c08a0fc
2 changed files with 6 additions and 23 deletions
|
|
@ -145,8 +145,7 @@ namespace Wox.Infrastructure
|
|||
{
|
||||
Success = true,
|
||||
MatchData = indexList,
|
||||
RawScore = Math.Max(score, pinyinScore),
|
||||
AllSubstringsContainedInCompareString = allSubstringsContainedInCompareString
|
||||
RawScore = Math.Max(score, pinyinScore)
|
||||
};
|
||||
|
||||
return result;
|
||||
|
|
@ -283,11 +282,6 @@ namespace Wox.Infrastructure
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indicates if all query's substrings are contained in the string to compare
|
||||
/// </summary>
|
||||
public bool AllSubstringsContainedInCompareString { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Matched data to highlight.
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -182,10 +182,15 @@ namespace Wox.Test
|
|||
[TestCase("sql manag", MicrosoftSqlServerManagementStudio, StringMatcher.SearchPrecisionScore.Regular, true)]
|
||||
[TestCase("sql", MicrosoftSqlServerManagementStudio, StringMatcher.SearchPrecisionScore.Regular, true)]
|
||||
[TestCase("sql serv", MicrosoftSqlServerManagementStudio, StringMatcher.SearchPrecisionScore.Regular, true)]
|
||||
[TestCase("sqlserv", MicrosoftSqlServerManagementStudio, StringMatcher.SearchPrecisionScore.Regular, false)]
|
||||
[TestCase("sql servman", MicrosoftSqlServerManagementStudio, StringMatcher.SearchPrecisionScore.Regular, false)]
|
||||
[TestCase("sql serv man", MicrosoftSqlServerManagementStudio, StringMatcher.SearchPrecisionScore.Regular, true)]
|
||||
[TestCase("sql studio", MicrosoftSqlServerManagementStudio, StringMatcher.SearchPrecisionScore.Regular, true)]
|
||||
[TestCase("mic", MicrosoftSqlServerManagementStudio, StringMatcher.SearchPrecisionScore.Regular, true)]
|
||||
[TestCase("chr", "Shutdown", StringMatcher.SearchPrecisionScore.Regular, false)]
|
||||
[TestCase("mssms", MicrosoftSqlServerManagementStudio, StringMatcher.SearchPrecisionScore.Regular, false)]
|
||||
[TestCase("chr", "Change settings for text-to-speech and for speech recognition (if installed).", StringMatcher.SearchPrecisionScore.Regular, false)]
|
||||
[TestCase("ch r", "Change settings for text-to-speech and for speech recognition (if installed).", StringMatcher.SearchPrecisionScore.Regular, true)]
|
||||
[TestCase("a test", "This is a test", StringMatcher.SearchPrecisionScore.Regular, true)]
|
||||
[TestCase("test", "This is a test", StringMatcher.SearchPrecisionScore.Regular, true)]
|
||||
public void WhenGivenQueryShouldReturnResultsContainingAllQuerySubstrings(
|
||||
|
|
@ -214,21 +219,5 @@ namespace Wox.Test
|
|||
$"Raw Score: {matchResult.RawScore}{Environment.NewLine}" +
|
||||
$"Precision Score: {(int)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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue