Esempio n. 1
0
        public void Detect_anagrams()
        {
            var detector = new AL.Anagram("allergy");
            var words    = new[] { "gallery", "ballerina", "regally", "clergy", "largely", "leading" };
            var results  = new[] { "gallery", "largely", "regally" };

            Assert.That(detector.Match(words), Is.EqualTo(results));
        }
Esempio n. 2
0
        public void Anagrams_are_case_insensitive()
        {
            var detector = new AL.Anagram("Orchestra");
            var words    = new[] { "cashregister", "Carthorse", "radishes" };
            var results  = new[] { "Carthorse" };

            Assert.That(detector.Match(words), Is.EqualTo(results));
        }
Esempio n. 3
0
        public void Eliminate_anagrams_with_same_checksum()
        {
            var detector = new AL.Anagram("mass");
            var words    = new[] { "last" };
            var results  = new string[0];

            Assert.That(detector.Match(words), Is.EqualTo(results));
        }
Esempio n. 4
0
        public void Eliminate_anagram_subsets()
        {
            var detector = new AL.Anagram("good");
            var words    = new[] { "dog", "goody" };
            var results  = new string[0];

            Assert.That(detector.Match(words), Is.EqualTo(results));
        }
Esempio n. 5
0
        public void Does_not_confuse_different_duplicates()
        {
            var detector = new AL.Anagram("galea");
            var words    = new[] { "eagle" };
            var results  = new string[0];

            Assert.That(detector.Match(words), Is.EqualTo(results));
        }
Esempio n. 6
0
        public void Identical_word_is_not_anagram()
        {
            var detector = new AL.Anagram("corn");
            var words    = new[] { "corn", "dark", "Corn", "rank", "CORN", "cron", "park" };
            var results  = new[] { "cron" };

            Assert.That(detector.Match(words), Is.EqualTo(results));
        }
Esempio n. 7
0
        public void Detect_multiple_anagrams()
        {
            var detector = new AL.Anagram("master");
            var words    = new[] { "stream", "pigeon", "maters" };
            var results  = new[] { "maters", "stream" };

            Assert.That(detector.Match(words), Is.EqualTo(results));
        }
Esempio n. 8
0
        public void Detect_simple_anagram()
        {
            var detector = new AL.Anagram("ant");
            var words    = new[] { "tan", "stand", "at" };
            var results  = new[] { "tan" };

            Assert.That(detector.Match(words), Is.EqualTo(results));
        }
Esempio n. 9
0
        public void No_matches()
        {
            var detector = new AL.Anagram("diaper");
            var words    = new[] { "hello", "world", "zombies", "pants" };
            var results  = new string[0];

            Assert.That(detector.Match(words), Is.EqualTo(results));
        }
Esempio n. 10
0
        static void Main(string[] args)
        {
            AL.Anagram a = new AL.Anagram("word");
            var        b = a.Match(new[] { "word", "drow", "xyz" });

            var detector = new AL.Anagram("master");
            var words    = new[] { "stream", "pigeon", "maters" };
            var results  = detector.Match(words);

            AL.Anagram bad = new AL.Anagram("  "); //Exception causing
        }
Esempio n. 11
0
 public void Fail_if_whitespace()
 {
     var detector = new AL.Anagram("  ");
 }