@@ -136,13 +136,13 @@ public void GivenQueryString_WhenAppliedPrecisionFiltering_ThenShouldReturnGreat
136
136
/// Usually the increase in scoring should not be drastic, increase of less than 10 is acceptable.
137
137
/// </summary>
138
138
[ TestCase ( Chrome , Chrome , 157 ) ]
139
- [ TestCase ( Chrome , LastIsChrome , 147 ) ]
139
+ [ TestCase ( Chrome , LastIsChrome , 145 ) ]
140
140
[ TestCase ( "chro" , HelpCureHopeRaiseOnMindEntityChrome , 50 ) ]
141
141
[ TestCase ( "chr" , HelpCureHopeRaiseOnMindEntityChrome , 30 ) ]
142
142
[ TestCase ( Chrome , UninstallOrChangeProgramsOnYourComputer , 21 ) ]
143
143
[ TestCase ( Chrome , CandyCrushSagaFromKing , 0 ) ]
144
- [ TestCase ( "sql" , MicrosoftSqlServerManagementStudio , 110 ) ]
145
- [ TestCase ( "sql manag" , MicrosoftSqlServerManagementStudio , 121 ) ] //double spacing intended
144
+ [ TestCase ( "sql" , MicrosoftSqlServerManagementStudio , 109 ) ]
145
+ [ TestCase ( "sql manag" , MicrosoftSqlServerManagementStudio , 120 ) ] //double spacing intended
146
146
public void WhenGivenQueryString_ThenShouldReturn_TheDesiredScoring (
147
147
string queryString , string compareString , int expectedScore )
148
148
{
@@ -284,6 +284,38 @@ public void WhenGivenAQuery_Scoring_ShouldGiveMoreWeightToStartOfNewWord(
284
284
$ "CompareString2: \" { compareString2 } \" , Score: { compareString2Result . Score } { Environment . NewLine } ") ;
285
285
}
286
286
287
+ [ TestCase ( "red" , "red colour" , "metro red" ) ]
288
+ [ TestCase ( "red" , "this red colour" , "this colour red" ) ]
289
+ [ TestCase ( "red" , "this red colour" , "this colour is very red" ) ]
290
+ [ TestCase ( "red" , "this red colour" , "this colour is surprisingly super awesome red and cool" ) ]
291
+ public void WhenGivenTwoStrings_Scoring_ShouldGiveMoreWeightToTheStringCloserToIndexZero (
292
+ string queryString , string compareString1 , string compareString2 )
293
+ {
294
+ // When
295
+ var matcher = new StringMatcher { UserSettingSearchPrecision = SearchPrecisionScore . Regular } ;
296
+
297
+ // Given
298
+ var compareString1Result = matcher . FuzzyMatch ( queryString , compareString1 ) ;
299
+ var compareString2Result = matcher . FuzzyMatch ( queryString , compareString2 ) ;
300
+
301
+ Debug . WriteLine ( "" ) ;
302
+ Debug . WriteLine ( "###############################################" ) ;
303
+ Debug . WriteLine ( $ "QueryString: \" { queryString } \" { Environment . NewLine } ") ;
304
+ Debug . WriteLine (
305
+ $ "CompareString1: \" { compareString1 } \" , Score: { compareString1Result . Score } { Environment . NewLine } ") ;
306
+ Debug . WriteLine (
307
+ $ "CompareString2: \" { compareString2 } \" , Score: { compareString2Result . Score } { Environment . NewLine } ") ;
308
+ Debug . WriteLine ( "###############################################" ) ;
309
+ Debug . WriteLine ( "" ) ;
310
+
311
+ // Should
312
+ Assert . True ( compareString1Result . Score > compareString2Result . Score ,
313
+ $ "Query: \" { queryString } \" { Environment . NewLine } " +
314
+ $ "CompareString1: \" { compareString1 } \" , Score: { compareString1Result . Score } { Environment . NewLine } " +
315
+ $ "Should be greater than{ Environment . NewLine } " +
316
+ $ "CompareString2: \" { compareString2 } \" , Score: { compareString2Result . Score } { Environment . NewLine } ") ;
317
+ }
318
+
287
319
[ TestCase ( "vim" , "Vim" , "ignoreDescription" , "ignore.exe" , "Vim Diff" , "ignoreDescription" , "ignore.exe" ) ]
288
320
public void WhenMultipleResults_ExactMatchingResult_ShouldHaveGreatestScore (
289
321
string queryString , string firstName , string firstDescription , string firstExecutableName ,
0 commit comments