コード例 #1
0
ファイル: StringMatcher.cs プロジェクト: tlwzzy/PowerToys
 public MatchResult(bool success, SearchPrecisionScore searchPrecision, List <int> matchData, int rawScore)
 {
     Success         = success;
     SearchPrecision = searchPrecision;
     MatchData       = matchData;
     RawScore        = rawScore;
 }
コード例 #2
0
        public void WhenGivenQuery_ShouldReturnResults_ContainingAllQuerySubstrings(
            string queryString,
            string compareString,
            SearchPrecisionScore expectedPrecisionScore,
            bool expectedPrecisionResult)
        {
            // When
            var matcher = new StringMatcher {
                UserSettingSearchPrecision = expectedPrecisionScore
            };

            // Given
            var matchResult = matcher.FuzzyMatch(queryString, compareString);

            Debug.WriteLine("");
            Debug.WriteLine("###############################################");
            Debug.WriteLine($"QueryString: {queryString}     CompareString: {compareString}");
            Debug.WriteLine(
                $"RAW SCORE: {matchResult.RawScore.ToString()}, PrecisionLevelSetAt: {expectedPrecisionScore} ({(int) expectedPrecisionScore})");
            Debug.WriteLine("###############################################");
            Debug.WriteLine("");

            // Should
            Assert.AreEqual(expectedPrecisionResult, matchResult.IsSearchPrecisionScoreMet(),
                            $"Query:{queryString}{Environment.NewLine} " +
                            $"Compare:{compareString}{Environment.NewLine}" +
                            $"Raw Score: {matchResult.RawScore}{Environment.NewLine}" +
                            $"Precision Score: {(int)expectedPrecisionScore}");
        }
コード例 #3
0
ファイル: StringMatcher.cs プロジェクト: tlwzzy/PowerToys
 public MatchResult(bool success, SearchPrecisionScore searchPrecision)
 {
     Success         = success;
     SearchPrecision = searchPrecision;
 }