5
5
using NUnit . Framework ;
6
6
using Flow . Launcher . Infrastructure ;
7
7
using Flow . Launcher . Plugin ;
8
+ using Flow . Launcher . Plugin . SharedModels ;
8
9
9
10
namespace Flow . Launcher . Test
10
11
{
@@ -37,8 +38,8 @@ public List<int> GetPrecisionScores()
37
38
{
38
39
var listToReturn = new List < int > ( ) ;
39
40
40
- Enum . GetValues ( typeof ( StringMatcher . SearchPrecisionScore ) )
41
- . Cast < StringMatcher . SearchPrecisionScore > ( )
41
+ Enum . GetValues ( typeof ( SearchPrecisionScore ) )
42
+ . Cast < SearchPrecisionScore > ( )
42
43
. ToList ( )
43
44
. ForEach ( x => listToReturn . Add ( ( int ) x ) ) ;
44
45
@@ -145,20 +146,20 @@ public void WhenGivenQueryString_ThenShouldReturn_TheDesiredScoring(
145
146
$ "Expected score for compare string '{ compareString } ': { expectedScore } , Actual: { rawScore } ") ;
146
147
}
147
148
148
- [ TestCase ( "goo" , "Google Chrome" , StringMatcher . SearchPrecisionScore . Regular , true ) ]
149
- [ TestCase ( "chr" , "Google Chrome" , StringMatcher . SearchPrecisionScore . Low , true ) ]
150
- [ TestCase ( "chr" , "Chrome" , StringMatcher . SearchPrecisionScore . Regular , true ) ]
151
- [ TestCase ( "chr" , "Help cure hope raise on mind entity Chrome" , StringMatcher . SearchPrecisionScore . Regular , false ) ]
152
- [ TestCase ( "chr" , "Help cure hope raise on mind entity Chrome" , StringMatcher . SearchPrecisionScore . Low , true ) ]
153
- [ TestCase ( "chr" , "Candy Crush Saga from King" , StringMatcher . SearchPrecisionScore . Regular , false ) ]
154
- [ TestCase ( "chr" , "Candy Crush Saga from King" , StringMatcher . SearchPrecisionScore . None , true ) ]
155
- [ TestCase ( "ccs" , "Candy Crush Saga from King" , StringMatcher . SearchPrecisionScore . Low , true ) ]
156
- [ TestCase ( "cand" , "Candy Crush Saga from King" , StringMatcher . SearchPrecisionScore . Regular , true ) ]
157
- [ TestCase ( "cand" , "Help cure hope raise on mind entity Chrome" , StringMatcher . SearchPrecisionScore . Regular , false ) ]
149
+ [ TestCase ( "goo" , "Google Chrome" , SearchPrecisionScore . Regular , true ) ]
150
+ [ TestCase ( "chr" , "Google Chrome" , SearchPrecisionScore . Low , true ) ]
151
+ [ TestCase ( "chr" , "Chrome" , SearchPrecisionScore . Regular , true ) ]
152
+ [ TestCase ( "chr" , "Help cure hope raise on mind entity Chrome" , SearchPrecisionScore . Regular , false ) ]
153
+ [ TestCase ( "chr" , "Help cure hope raise on mind entity Chrome" , SearchPrecisionScore . Low , true ) ]
154
+ [ TestCase ( "chr" , "Candy Crush Saga from King" , SearchPrecisionScore . Regular , false ) ]
155
+ [ TestCase ( "chr" , "Candy Crush Saga from King" , SearchPrecisionScore . None , true ) ]
156
+ [ TestCase ( "ccs" , "Candy Crush Saga from King" , SearchPrecisionScore . Low , true ) ]
157
+ [ TestCase ( "cand" , "Candy Crush Saga from King" , SearchPrecisionScore . Regular , true ) ]
158
+ [ TestCase ( "cand" , "Help cure hope raise on mind entity Chrome" , SearchPrecisionScore . Regular , false ) ]
158
159
public void WhenGivenDesiredPrecision_ThenShouldReturn_AllResultsGreaterOrEqual (
159
160
string queryString ,
160
161
string compareString ,
161
- StringMatcher . SearchPrecisionScore expectedPrecisionScore ,
162
+ SearchPrecisionScore expectedPrecisionScore ,
162
163
bool expectedPrecisionResult )
163
164
{
164
165
// When
@@ -182,32 +183,32 @@ public void WhenGivenDesiredPrecision_ThenShouldReturn_AllResultsGreaterOrEqual(
182
183
$ "Precision Score: { ( int ) expectedPrecisionScore } ") ;
183
184
}
184
185
185
- [ TestCase ( "exce" , "OverLeaf-Latex: An online LaTeX editor" , StringMatcher . SearchPrecisionScore . Regular , false ) ]
186
- [ TestCase ( "term" , "Windows Terminal (Preview)" , StringMatcher . SearchPrecisionScore . Regular , true ) ]
187
- [ TestCase ( "sql s managa" , MicrosoftSqlServerManagementStudio , StringMatcher . SearchPrecisionScore . Regular , false ) ]
188
- [ TestCase ( "sql' s manag" , MicrosoftSqlServerManagementStudio , StringMatcher . SearchPrecisionScore . Regular , false ) ]
189
- [ TestCase ( "sql s manag" , MicrosoftSqlServerManagementStudio , StringMatcher . SearchPrecisionScore . Regular , true ) ]
190
- [ TestCase ( "sql manag" , MicrosoftSqlServerManagementStudio , StringMatcher . SearchPrecisionScore . Regular , true ) ]
191
- [ TestCase ( "sql" , MicrosoftSqlServerManagementStudio , StringMatcher . SearchPrecisionScore . Regular , true ) ]
192
- [ TestCase ( "sql serv" , MicrosoftSqlServerManagementStudio , StringMatcher . SearchPrecisionScore . Regular , true ) ]
193
- [ TestCase ( "servez" , MicrosoftSqlServerManagementStudio , StringMatcher . SearchPrecisionScore . Regular , false ) ]
194
- [ TestCase ( "sql servz" , MicrosoftSqlServerManagementStudio , StringMatcher . SearchPrecisionScore . Regular , false ) ]
195
- [ TestCase ( "sql serv man" , MicrosoftSqlServerManagementStudio , StringMatcher . SearchPrecisionScore . Regular , true ) ]
196
- [ TestCase ( "sql studio" , MicrosoftSqlServerManagementStudio , StringMatcher . SearchPrecisionScore . Regular , true ) ]
197
- [ TestCase ( "mic" , MicrosoftSqlServerManagementStudio , StringMatcher . SearchPrecisionScore . Regular , true ) ]
198
- [ TestCase ( "chr" , "Shutdown" , StringMatcher . SearchPrecisionScore . Regular , false ) ]
199
- [ TestCase ( "mssms" , MicrosoftSqlServerManagementStudio , StringMatcher . SearchPrecisionScore . Regular , false ) ]
200
- [ TestCase ( "chr" , "Change settings for text-to-speech and for speech recognition (if installed)." , StringMatcher . SearchPrecisionScore . Regular , false ) ]
201
- [ TestCase ( "ch r" , "Change settings for text-to-speech and for speech recognition (if installed)." , StringMatcher . SearchPrecisionScore . Regular , true ) ]
202
- [ TestCase ( "a test" , "This is a test" , StringMatcher . SearchPrecisionScore . Regular , true ) ]
203
- [ TestCase ( "test" , "This is a test" , StringMatcher . SearchPrecisionScore . Regular , true ) ]
204
- [ TestCase ( "cod" , VisualStudioCode , StringMatcher . SearchPrecisionScore . Regular , true ) ]
205
- [ TestCase ( "code" , VisualStudioCode , StringMatcher . SearchPrecisionScore . Regular , true ) ]
206
- [ TestCase ( "codes" , "Visual Studio Codes" , StringMatcher . SearchPrecisionScore . Regular , true ) ]
186
+ [ TestCase ( "exce" , "OverLeaf-Latex: An online LaTeX editor" , SearchPrecisionScore . Regular , false ) ]
187
+ [ TestCase ( "term" , "Windows Terminal (Preview)" , SearchPrecisionScore . Regular , true ) ]
188
+ [ TestCase ( "sql s managa" , MicrosoftSqlServerManagementStudio , SearchPrecisionScore . Regular , false ) ]
189
+ [ TestCase ( "sql' s manag" , MicrosoftSqlServerManagementStudio , SearchPrecisionScore . Regular , false ) ]
190
+ [ TestCase ( "sql s manag" , MicrosoftSqlServerManagementStudio , SearchPrecisionScore . Regular , true ) ]
191
+ [ TestCase ( "sql manag" , MicrosoftSqlServerManagementStudio , SearchPrecisionScore . Regular , true ) ]
192
+ [ TestCase ( "sql" , MicrosoftSqlServerManagementStudio , SearchPrecisionScore . Regular , true ) ]
193
+ [ TestCase ( "sql serv" , MicrosoftSqlServerManagementStudio , SearchPrecisionScore . Regular , true ) ]
194
+ [ TestCase ( "servez" , MicrosoftSqlServerManagementStudio , SearchPrecisionScore . Regular , false ) ]
195
+ [ TestCase ( "sql servz" , MicrosoftSqlServerManagementStudio , SearchPrecisionScore . Regular , false ) ]
196
+ [ TestCase ( "sql serv man" , MicrosoftSqlServerManagementStudio , SearchPrecisionScore . Regular , true ) ]
197
+ [ TestCase ( "sql studio" , MicrosoftSqlServerManagementStudio , SearchPrecisionScore . Regular , true ) ]
198
+ [ TestCase ( "mic" , MicrosoftSqlServerManagementStudio , SearchPrecisionScore . Regular , true ) ]
199
+ [ TestCase ( "chr" , "Shutdown" , SearchPrecisionScore . Regular , false ) ]
200
+ [ TestCase ( "mssms" , MicrosoftSqlServerManagementStudio , SearchPrecisionScore . Regular , false ) ]
201
+ [ TestCase ( "chr" , "Change settings for text-to-speech and for speech recognition (if installed)." , SearchPrecisionScore . Regular , false ) ]
202
+ [ TestCase ( "ch r" , "Change settings for text-to-speech and for speech recognition (if installed)." , SearchPrecisionScore . Regular , true ) ]
203
+ [ TestCase ( "a test" , "This is a test" , SearchPrecisionScore . Regular , true ) ]
204
+ [ TestCase ( "test" , "This is a test" , SearchPrecisionScore . Regular , true ) ]
205
+ [ TestCase ( "cod" , VisualStudioCode , SearchPrecisionScore . Regular , true ) ]
206
+ [ TestCase ( "code" , VisualStudioCode , SearchPrecisionScore . Regular , true ) ]
207
+ [ TestCase ( "codes" , "Visual Studio Codes" , SearchPrecisionScore . Regular , true ) ]
207
208
public void WhenGivenQuery_ShouldReturnResults_ContainingAllQuerySubstrings (
208
209
string queryString ,
209
210
string compareString ,
210
- StringMatcher . SearchPrecisionScore expectedPrecisionScore ,
211
+ SearchPrecisionScore expectedPrecisionScore ,
211
212
bool expectedPrecisionResult )
212
213
{
213
214
// When
@@ -238,7 +239,7 @@ public void WhenGivenAQuery_Scoring_ShouldGiveMoreWeightToStartOfNewWord(
238
239
string queryString , string compareString1 , string compareString2 )
239
240
{
240
241
// When
241
- var matcher = new StringMatcher { UserSettingSearchPrecision = StringMatcher . SearchPrecisionScore . Regular } ;
242
+ var matcher = new StringMatcher { UserSettingSearchPrecision = SearchPrecisionScore . Regular } ;
242
243
243
244
// Given
244
245
var compareString1Result = matcher . FuzzyMatch ( queryString , compareString1 ) ;
0 commit comments