mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Fix tests for new search precision handling
This commit is contained in:
parent
627e99859d
commit
2aeceb7ea8
1 changed files with 11 additions and 2 deletions
|
|
@ -4,6 +4,7 @@ using System.Diagnostics;
|
|||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using Wox.Infrastructure;
|
||||
using Wox.Infrastructure.UserSettings;
|
||||
using Wox.Plugin;
|
||||
|
||||
namespace Wox.Test
|
||||
|
|
@ -48,6 +49,8 @@ namespace Wox.Test
|
|||
"aac"
|
||||
};
|
||||
|
||||
Alphabet.Initialize(false);
|
||||
StringMatcher.UserSettingSearchPrecision = StringMatcher.SearchPrecisionScore.Low.ToString();
|
||||
|
||||
var results = new List<Result>();
|
||||
foreach (var str in sources)
|
||||
|
|
@ -130,6 +133,9 @@ namespace Wox.Test
|
|||
|
||||
var results = new List<Result>();
|
||||
|
||||
Alphabet.Initialize(false);
|
||||
StringMatcher.UserSettingSearchPrecision = StringMatcher.SearchPrecisionScore.None.ToString();
|
||||
|
||||
foreach (var str in searchStrings)
|
||||
{
|
||||
results.Add(new Result
|
||||
|
|
@ -168,8 +174,11 @@ namespace Wox.Test
|
|||
[TestCase("ccs", "Candy Crush Saga from King", (int)StringMatcher.SearchPrecisionScore.Low, true)]
|
||||
[TestCase("cand", "Candy Crush Saga from King", (int)StringMatcher.SearchPrecisionScore.Regular, true)]
|
||||
[TestCase("cand", "Help cure hope raise on mind entity Chrome", (int)StringMatcher.SearchPrecisionScore.Regular, false)]
|
||||
public void WhenGivenDesiredPrecisionThenShouldReturnAllResultsGreaterOrEqual(string queryString, string compareString,
|
||||
int expectedPrecisionScore, bool expectedPrecisionResult)
|
||||
public void WhenGivenDesiredPrecisionThenShouldReturnAllResultsGreaterOrEqual(
|
||||
string queryString,
|
||||
string compareString,
|
||||
int expectedPrecisionScore,
|
||||
bool expectedPrecisionResult)
|
||||
{
|
||||
var expectedPrecisionString = (StringMatcher.SearchPrecisionScore)expectedPrecisionScore;
|
||||
StringMatcher.UserSettingSearchPrecision = expectedPrecisionString.ToString();
|
||||
|
|
|
|||
Loading…
Reference in a new issue