Exemple #1
0
        public InputKeyMatch FuzzyMatch(InputKeyIndex other, int fuzzy = 0)
        {
            if (this.Match(other))
            {
                return(InputKeyMatch.FullMatch);
            }

            // We don't want a lot of shorter versions that might match.
            // This will just flood our results otherwise.
            if (this.index.Length < other.index.Length)
            {
                return(InputKeyMatch.NoMatch);
            }

            var startWithResult = FuzzyHelper.StartWith(this.index, other.index);

            if (startWithResult <= fuzzy)
            {
                return(InputKeyMatch.PartialMatch);
            }

            return(InputKeyMatch.NoMatch);
        }
        public void StartWith(int[] actual, int[] startWith, int fuzzyCount)
        {
            var result = FuzzyHelper.StartWith(startWith, actual);

            Assert.Equal(fuzzyCount, result);
        }