@@ -131,16 +131,17 @@ public void GivenQueryString_WhenAppliedPrecisionFiltering_ThenShouldReturnGreat
131
131
132
132
[ TestCase ( Chrome , Chrome , 157 ) ]
133
133
[ TestCase ( Chrome , LastIsChrome , 147 ) ]
134
- [ TestCase ( Chrome , HelpCureHopeRaiseOnMindEntityChrome , 90 ) ]
134
+ [ TestCase ( "chro" , HelpCureHopeRaiseOnMindEntityChrome , 50 ) ]
135
+ [ TestCase ( "chr" , HelpCureHopeRaiseOnMindEntityChrome , 30 ) ]
135
136
[ TestCase ( Chrome , UninstallOrChangeProgramsOnYourComputer , 21 ) ]
136
137
[ TestCase ( Chrome , CandyCrushSagaFromKing , 0 ) ]
137
- [ TestCase ( "sql" , MicrosoftSqlServerManagementStudio , 90 ) ]
138
+ [ TestCase ( "sql" , MicrosoftSqlServerManagementStudio , 110 ) ]
138
139
[ TestCase ( "sql manag" , MicrosoftSqlServerManagementStudio , 121 ) ] //double spacing intended
139
140
public void WhenGivenQueryString_ThenShouldReturn_TheDesiredScoring (
140
141
string queryString , string compareString , int expectedScore )
141
142
{
142
143
// When, Given
143
- var matcher = new StringMatcher ( ) ;
144
+ var matcher = new StringMatcher { UserSettingSearchPrecision = SearchPrecisionScore . Regular } ;
144
145
var rawScore = matcher . FuzzyMatch ( queryString , compareString ) . RawScore ;
145
146
146
147
// Should
@@ -151,13 +152,22 @@ public void WhenGivenQueryString_ThenShouldReturn_TheDesiredScoring(
151
152
[ TestCase ( "goo" , "Google Chrome" , SearchPrecisionScore . Regular , true ) ]
152
153
[ TestCase ( "chr" , "Google Chrome" , SearchPrecisionScore . Low , true ) ]
153
154
[ TestCase ( "chr" , "Chrome" , SearchPrecisionScore . Regular , true ) ]
155
+ [ TestCase ( "chr" , "Help cure hope raise on mind entity Chrome" , SearchPrecisionScore . Regular , false ) ]
154
156
[ TestCase ( "chr" , "Help cure hope raise on mind entity Chrome" , SearchPrecisionScore . Low , true ) ]
155
157
[ TestCase ( "chr" , "Candy Crush Saga from King" , SearchPrecisionScore . Regular , false ) ]
156
158
[ TestCase ( "chr" , "Candy Crush Saga from King" , SearchPrecisionScore . None , true ) ]
157
- [ TestCase ( "ccs" , "Candy Crush Saga from King" , SearchPrecisionScore . Regular , true ) ]
159
+ [ TestCase ( "ccs" , "Candy Crush Saga from King" , SearchPrecisionScore . Low , true ) ]
158
160
[ TestCase ( "cand" , "Candy Crush Saga from King" , SearchPrecisionScore . Regular , true ) ]
159
- [ TestCase ( "cand" , "Help cure hope raise on mind entity Chrome" , SearchPrecisionScore . Regular ,
160
- false ) ]
161
+ [ TestCase ( "cand" , "Help cure hope raise on mind entity Chrome" , SearchPrecisionScore . Regular , false ) ]
162
+ [ TestCase ( "vsc" , VisualStudioCode , SearchPrecisionScore . Regular , true ) ]
163
+ [ TestCase ( "vs" , VisualStudioCode , SearchPrecisionScore . Regular , true ) ]
164
+ [ TestCase ( "vc" , VisualStudioCode , SearchPrecisionScore . Regular , true ) ]
165
+ [ TestCase ( "vts" , VisualStudioCode , SearchPrecisionScore . Regular , false ) ]
166
+ [ TestCase ( "vcs" , VisualStudioCode , SearchPrecisionScore . Regular , false ) ]
167
+ [ TestCase ( "wt" , "Windows Terminal From Microsoft Store" , SearchPrecisionScore . Regular , false ) ]
168
+ [ TestCase ( "vsp" , "Visual Studio 2019 Preview" , SearchPrecisionScore . Regular , true ) ]
169
+ [ TestCase ( "vsp" , "2019 Visual Studio Preview" , SearchPrecisionScore . Regular , true ) ]
170
+ [ TestCase ( "2019p" , "Visual Studio 2019 Preview" , SearchPrecisionScore . Regular , true ) ]
161
171
public void WhenGivenDesiredPrecision_ThenShouldReturn_AllResultsGreaterOrEqual (
162
172
string queryString ,
163
173
string compareString ,
@@ -180,18 +190,16 @@ public void WhenGivenDesiredPrecision_ThenShouldReturn_AllResultsGreaterOrEqual(
180
190
181
191
// Should
182
192
Assert . AreEqual ( expectedPrecisionResult , matchResult . IsSearchPrecisionScoreMet ( ) ,
183
- $ "Query:{ queryString } { Environment . NewLine } " +
184
- $ "Compare:{ compareString } { Environment . NewLine } " +
193
+ $ "Query: { queryString } { Environment . NewLine } " +
194
+ $ "Compare: { compareString } { Environment . NewLine } " +
185
195
$ "Raw Score: { matchResult . RawScore } { Environment . NewLine } " +
186
196
$ "Precision Score: { ( int ) expectedPrecisionScore } ") ;
187
197
}
188
198
189
199
[ TestCase ( "exce" , "OverLeaf-Latex: An online LaTeX editor" , SearchPrecisionScore . Regular , false ) ]
190
200
[ TestCase ( "term" , "Windows Terminal (Preview)" , SearchPrecisionScore . Regular , true ) ]
191
- [ TestCase ( "sql s managa" , MicrosoftSqlServerManagementStudio , SearchPrecisionScore . Regular ,
192
- false ) ]
193
- [ TestCase ( "sql' s manag" , MicrosoftSqlServerManagementStudio , SearchPrecisionScore . Regular ,
194
- false ) ]
201
+ [ TestCase ( "sql s managa" , MicrosoftSqlServerManagementStudio , SearchPrecisionScore . Regular , false ) ]
202
+ [ TestCase ( "sql' s manag" , MicrosoftSqlServerManagementStudio , SearchPrecisionScore . Regular , false ) ]
195
203
[ TestCase ( "sql s manag" , MicrosoftSqlServerManagementStudio , SearchPrecisionScore . Regular , true ) ]
196
204
[ TestCase ( "sql manag" , MicrosoftSqlServerManagementStudio , SearchPrecisionScore . Regular , true ) ]
197
205
[ TestCase ( "sql" , MicrosoftSqlServerManagementStudio , SearchPrecisionScore . Regular , true ) ]
@@ -204,18 +212,13 @@ public void WhenGivenDesiredPrecision_ThenShouldReturn_AllResultsGreaterOrEqual(
204
212
[ TestCase ( "mssms" , MicrosoftSqlServerManagementStudio , SearchPrecisionScore . Regular , true ) ]
205
213
[ TestCase ( "msms" , MicrosoftSqlServerManagementStudio , SearchPrecisionScore . Regular , true ) ]
206
214
[ TestCase ( "chr" , "Shutdown" , SearchPrecisionScore . Regular , false ) ]
207
- [ TestCase ( "chr" , "Change settings for text-to-speech and for speech recognition (if installed)." ,
208
- SearchPrecisionScore . Regular , false ) ]
209
- [ TestCase ( "ch r" , "Change settings for text-to-speech and for speech recognition (if installed)." ,
210
- SearchPrecisionScore . Regular , true ) ]
215
+ [ TestCase ( "chr" , "Change settings for text-to-speech and for speech recognition (if installed)." , SearchPrecisionScore . Regular , false ) ]
216
+ [ TestCase ( "ch r" , "Change settings for text-to-speech and for speech recognition (if installed)." , SearchPrecisionScore . Regular , true ) ]
211
217
[ TestCase ( "a test" , "This is a test" , SearchPrecisionScore . Regular , true ) ]
212
218
[ TestCase ( "test" , "This is a test" , SearchPrecisionScore . Regular , true ) ]
213
219
[ TestCase ( "cod" , VisualStudioCode , SearchPrecisionScore . Regular , true ) ]
214
220
[ TestCase ( "code" , VisualStudioCode , SearchPrecisionScore . Regular , true ) ]
215
221
[ TestCase ( "codes" , "Visual Studio Codes" , SearchPrecisionScore . Regular , true ) ]
216
- [ TestCase ( "vsc" , VisualStudioCode , SearchPrecisionScore . Regular , true ) ]
217
- [ TestCase ( "vs" , VisualStudioCode , SearchPrecisionScore . Regular , true ) ]
218
- [ TestCase ( "vc" , VisualStudioCode , SearchPrecisionScore . Regular , true ) ]
219
222
public void WhenGivenQuery_ShouldReturnResults_ContainingAllQuerySubstrings (
220
223
string queryString ,
221
224
string compareString ,
@@ -300,15 +303,19 @@ public void WhenMultipleResults_ExactMatchingResult_ShouldHaveGreatestScore(
300
303
$ "Should be greater than{ Environment . NewLine } " +
301
304
$ "Name of second: \" { secondName } \" , Final Score: { secondScore } { Environment . NewLine } ") ;
302
305
}
303
-
304
- [ TestCase ( "vsc" , "Visual Studio Code" , 100 ) ]
305
- [ TestCase ( "jbr" , "JetBrain Rider" , 100 ) ]
306
- [ TestCase ( "jr" , "JetBrain Rider" , 90 ) ]
307
- [ TestCase ( "vs" , "Visual Studio" , 100 ) ]
308
- [ TestCase ( "vs" , "Visual Studio Preview" , 100 ) ]
309
- [ TestCase ( "vsp" , "Visual Studio Preview" , 100 ) ]
310
- [ TestCase ( "vsp" , "Visual Studio" , 0 ) ]
311
- [ TestCase ( "pc" , "Postman Canary" , 100 ) ]
306
+
307
+ [ TestCase ( "vsc" , "Visual Studio Code" , 100 ) ]
308
+ [ TestCase ( "jbr" , "JetBrain Rider" , 100 ) ]
309
+ [ TestCase ( "jr" , "JetBrain Rider" , 66 ) ]
310
+ [ TestCase ( "vs" , "Visual Studio" , 100 ) ]
311
+ [ TestCase ( "vs" , "Visual Studio Preview" , 66 ) ]
312
+ [ TestCase ( "vsp" , "Visual Studio Preview" , 100 ) ]
313
+ [ TestCase ( "pc" , "postman canary" , 100 ) ]
314
+ [ TestCase ( "psc" , "Postman super canary" , 100 ) ]
315
+ [ TestCase ( "psc" , "Postman super Canary" , 100 ) ]
316
+ [ TestCase ( "vsp" , "Visual Studio" , 0 ) ]
317
+ [ TestCase ( "vps" , "Visual Studio" , 0 ) ]
318
+ [ TestCase ( Chrome , HelpCureHopeRaiseOnMindEntityChrome , 75 ) ]
312
319
public void WhenGivenAnAcronymQuery_ShouldReturnAcronymScore ( string queryString , string compareString ,
313
320
int desiredScore )
314
321
{
0 commit comments