mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-08 12:18:50 +02:00
Update test per comment
This commit is contained in:
@@ -145,8 +145,7 @@ namespace Wox.Infrastructure
|
|||||||
{
|
{
|
||||||
Success = true,
|
Success = true,
|
||||||
MatchData = indexList,
|
MatchData = indexList,
|
||||||
RawScore = Math.Max(score, pinyinScore),
|
RawScore = Math.Max(score, pinyinScore)
|
||||||
AllSubstringsContainedInCompareString = allSubstringsContainedInCompareString
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return result;
|
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>
|
/// <summary>
|
||||||
/// Matched data to highlight.
|
/// Matched data to highlight.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -182,10 +182,15 @@ namespace Wox.Test
|
|||||||
[TestCase("sql manag", MicrosoftSqlServerManagementStudio, StringMatcher.SearchPrecisionScore.Regular, true)]
|
[TestCase("sql manag", MicrosoftSqlServerManagementStudio, StringMatcher.SearchPrecisionScore.Regular, true)]
|
||||||
[TestCase("sql", MicrosoftSqlServerManagementStudio, StringMatcher.SearchPrecisionScore.Regular, true)]
|
[TestCase("sql", MicrosoftSqlServerManagementStudio, StringMatcher.SearchPrecisionScore.Regular, true)]
|
||||||
[TestCase("sql serv", 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("sql studio", MicrosoftSqlServerManagementStudio, StringMatcher.SearchPrecisionScore.Regular, true)]
|
||||||
[TestCase("mic", MicrosoftSqlServerManagementStudio, StringMatcher.SearchPrecisionScore.Regular, true)]
|
[TestCase("mic", MicrosoftSqlServerManagementStudio, StringMatcher.SearchPrecisionScore.Regular, true)]
|
||||||
[TestCase("chr", "Shutdown", StringMatcher.SearchPrecisionScore.Regular, false)]
|
[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("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("a test", "This is a test", StringMatcher.SearchPrecisionScore.Regular, true)]
|
||||||
[TestCase("test", "This is a test", StringMatcher.SearchPrecisionScore.Regular, true)]
|
[TestCase("test", "This is a test", StringMatcher.SearchPrecisionScore.Regular, true)]
|
||||||
public void WhenGivenQueryShouldReturnResultsContainingAllQuerySubstrings(
|
public void WhenGivenQueryShouldReturnResultsContainingAllQuerySubstrings(
|
||||||
@@ -214,21 +219,5 @@ namespace Wox.Test
|
|||||||
$"Raw Score: {matchResult.RawScore}{Environment.NewLine}" +
|
$"Raw Score: {matchResult.RawScore}{Environment.NewLine}" +
|
||||||
$"Precision Score: {(int)expectedPrecisionScore}");
|
$"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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user