Skip to content

Commit 504c08a

Browse files
committed
Update test per comment
1 parent 592f1ca commit 504c08a

File tree

2 files changed

+6
-23
lines changed

2 files changed

+6
-23
lines changed

Wox.Infrastructure/StringMatcher.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,7 @@ public static MatchResult FuzzySearch(string query, string stringToCompare, Matc
145145
{
146146
Success = true,
147147
MatchData = indexList,
148-
RawScore = Math.Max(score, pinyinScore),
149-
AllSubstringsContainedInCompareString = allSubstringsContainedInCompareString
148+
RawScore = Math.Max(score, pinyinScore)
150149
};
151150

152151
return result;
@@ -283,11 +282,6 @@ public int RawScore
283282
}
284283
}
285284

286-
/// <summary>
287-
/// Indicates if all query's substrings are contained in the string to compare
288-
/// </summary>
289-
public bool AllSubstringsContainedInCompareString { get; set; }
290-
291285
/// <summary>
292286
/// Matched data to highlight.
293287
/// </summary>

Wox.Test/FuzzyMatcherTest.cs

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,15 @@ public void WhenGivenDesiredPrecisionThenShouldReturnAllResultsGreaterOrEqual(
182182
[TestCase("sql manag", MicrosoftSqlServerManagementStudio, StringMatcher.SearchPrecisionScore.Regular, true)]
183183
[TestCase("sql", MicrosoftSqlServerManagementStudio, StringMatcher.SearchPrecisionScore.Regular, true)]
184184
[TestCase("sql serv", MicrosoftSqlServerManagementStudio, StringMatcher.SearchPrecisionScore.Regular, true)]
185+
[TestCase("sqlserv", MicrosoftSqlServerManagementStudio, StringMatcher.SearchPrecisionScore.Regular, false)]
186+
[TestCase("sql servman", MicrosoftSqlServerManagementStudio, StringMatcher.SearchPrecisionScore.Regular, false)]
187+
[TestCase("sql serv man", MicrosoftSqlServerManagementStudio, StringMatcher.SearchPrecisionScore.Regular, true)]
185188
[TestCase("sql studio", MicrosoftSqlServerManagementStudio, StringMatcher.SearchPrecisionScore.Regular, true)]
186189
[TestCase("mic", MicrosoftSqlServerManagementStudio, StringMatcher.SearchPrecisionScore.Regular, true)]
187190
[TestCase("chr", "Shutdown", StringMatcher.SearchPrecisionScore.Regular, false)]
191+
[TestCase("mssms", MicrosoftSqlServerManagementStudio, StringMatcher.SearchPrecisionScore.Regular, false)]
188192
[TestCase("chr", "Change settings for text-to-speech and for speech recognition (if installed).", StringMatcher.SearchPrecisionScore.Regular, false)]
193+
[TestCase("ch r", "Change settings for text-to-speech and for speech recognition (if installed).", StringMatcher.SearchPrecisionScore.Regular, true)]
189194
[TestCase("a test", "This is a test", StringMatcher.SearchPrecisionScore.Regular, true)]
190195
[TestCase("test", "This is a test", StringMatcher.SearchPrecisionScore.Regular, true)]
191196
public void WhenGivenQueryShouldReturnResultsContainingAllQuerySubstrings(
@@ -214,21 +219,5 @@ public void WhenGivenQueryShouldReturnResultsContainingAllQuerySubstrings(
214219
$"Raw Score: {matchResult.RawScore}{Environment.NewLine}" +
215220
$"Precision Score: {(int)expectedPrecisionScore}");
216221
}
217-
218-
[TestCase("sql servman", MicrosoftSqlServerManagementStudio, false)]
219-
[TestCase("sql serv man", MicrosoftSqlServerManagementStudio, true)]
220-
[TestCase("sql", MicrosoftSqlServerManagementStudio, true)]
221-
[TestCase("sqlserv", MicrosoftSqlServerManagementStudio, false)]
222-
[TestCase("mssms", MicrosoftSqlServerManagementStudio, false)]
223-
[TestCase("chr", "Change settings for text-to-speech and for speech recognition (if installed).", false)]
224-
[TestCase("ch r", "Change settings for text-to-speech and for speech recognition (if installed).", true)]
225-
public void WhenGivenQueryShouldEvaluateTrueFalseIfCompareStringContainsAllSubstrings(string queryString, string compareString, bool expectedResult)
226-
{
227-
// When, Given
228-
var matchResult = StringMatcher.FuzzySearch(queryString, compareString).AllSubstringsContainedInCompareString;
229-
230-
// Should
231-
Assert.AreEqual(matchResult, expectedResult);
232-
}
233222
}
234223
}

0 commit comments

Comments
 (0)