Example #1
0
        public void ChechingWordIsSoLong()
        {
            string        word       = "asfmjshguwehioqwufuwgvuwreufhwedjhgaygdjahbfuagufgqwfvyuqfvyqwfgyqw";
            List <string> dictionary = new List <string>();
            var           checker    = new SpellChecker.Checker(dictionary);

            Assert.Equal(word, checker.GetCorrectWord(word));
        }
Example #2
0
        public void WordIsCorrect()
        {
            string        word       = "sadness";
            List <string> dictionary = new List <string>();

            dictionary.Add(word);
            var checker = new SpellChecker.Checker(dictionary);

            Assert.Equal(word, checker.GetCorrectWord(word));
        }
Example #3
0
        public void WordHaveFewCorrectVariantsWhithTwoEdits()
        {
            string        word       = "sness";
            List <string> dictionary = new List <string>()
            {
                "sadness", "sjaness", "empty", "a", "awful"
            };
            var checker = new SpellChecker.Checker(dictionary);

            Assert.Equal("{sadness sjaness}", checker.GetCorrectWord(word));
        }
Example #4
0
        public void WordHaveCorrectVariantWithOneOrTwoEdits()
        {
            string        word       = "sdness";
            List <string> dictionary = new List <string>()
            {
                "sadness", "sjness", "empty", "a", "awful"
            };
            var checker = new SpellChecker.Checker(dictionary);

            Assert.Equal("sadness", checker.GetCorrectWord(word));
        }
Example #5
0
        public void WordHaveFewCorrectVariatsWithOneEdit()
        {
            string        word       = "sdness";
            List <string> dictionary = new List <string>()
            {
                "sadness", "sness", "sodness", "a", "awful"
            };
            var checker = new SpellChecker.Checker(dictionary);

            Assert.Equal("{sadness sness sodness}", checker.GetCorrectWord(word));
        }
Example #6
0
        public void InputIsCaseinsensitive()
        {
            string        word       = "MAiN";
            List <string> dictionary = new List <string>()
            {
                "main"
            };
            var checker = new SpellChecker.Checker(dictionary);

            Assert.Equal("{MAiN?}", checker.GetCorrectWord(word));
        }
Example #7
0
        public void WordIsNotCorrect()
        {
            string        word       = "sad";
            List <string> dictionary = new List <string>()
            {
                "sadness"
            };
            var    checker = new SpellChecker.Checker(dictionary);
            string result  = "{" + word + "?}";

            Assert.Equal(result, checker.GetCorrectWord(word));
        }