mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-08 04:07:40 +02:00
Fix tests for new search precision handling
This commit is contained in:
@@ -4,6 +4,7 @@ using System.Diagnostics;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using Wox.Infrastructure;
|
using Wox.Infrastructure;
|
||||||
|
using Wox.Infrastructure.UserSettings;
|
||||||
using Wox.Plugin;
|
using Wox.Plugin;
|
||||||
|
|
||||||
namespace Wox.Test
|
namespace Wox.Test
|
||||||
@@ -48,6 +49,8 @@ namespace Wox.Test
|
|||||||
"aac"
|
"aac"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Alphabet.Initialize(false);
|
||||||
|
StringMatcher.UserSettingSearchPrecision = StringMatcher.SearchPrecisionScore.Low.ToString();
|
||||||
|
|
||||||
var results = new List<Result>();
|
var results = new List<Result>();
|
||||||
foreach (var str in sources)
|
foreach (var str in sources)
|
||||||
@@ -130,6 +133,9 @@ namespace Wox.Test
|
|||||||
|
|
||||||
var results = new List<Result>();
|
var results = new List<Result>();
|
||||||
|
|
||||||
|
Alphabet.Initialize(false);
|
||||||
|
StringMatcher.UserSettingSearchPrecision = StringMatcher.SearchPrecisionScore.None.ToString();
|
||||||
|
|
||||||
foreach (var str in searchStrings)
|
foreach (var str in searchStrings)
|
||||||
{
|
{
|
||||||
results.Add(new Result
|
results.Add(new Result
|
||||||
@@ -168,8 +174,11 @@ namespace Wox.Test
|
|||||||
[TestCase("ccs", "Candy Crush Saga from King", (int)StringMatcher.SearchPrecisionScore.Low, true)]
|
[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", "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)]
|
[TestCase("cand", "Help cure hope raise on mind entity Chrome", (int)StringMatcher.SearchPrecisionScore.Regular, false)]
|
||||||
public void WhenGivenDesiredPrecisionThenShouldReturnAllResultsGreaterOrEqual(string queryString, string compareString,
|
public void WhenGivenDesiredPrecisionThenShouldReturnAllResultsGreaterOrEqual(
|
||||||
int expectedPrecisionScore, bool expectedPrecisionResult)
|
string queryString,
|
||||||
|
string compareString,
|
||||||
|
int expectedPrecisionScore,
|
||||||
|
bool expectedPrecisionResult)
|
||||||
{
|
{
|
||||||
var expectedPrecisionString = (StringMatcher.SearchPrecisionScore)expectedPrecisionScore;
|
var expectedPrecisionString = (StringMatcher.SearchPrecisionScore)expectedPrecisionScore;
|
||||||
StringMatcher.UserSettingSearchPrecision = expectedPrecisionString.ToString();
|
StringMatcher.UserSettingSearchPrecision = expectedPrecisionString.ToString();
|
||||||
|
|||||||
Reference in New Issue
Block a user