Ejemplo n.º 1
0
        public void TestLongestAnagrams()
        {
            AnagramFinder anagramFinder = new AnagramFinder(words);
            string        expected      = "stressed, desserts";
            string        actual        = anagramFinder.GetLongestAnagrams();

            Assert.Equal(expected, actual);
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            System.Console.Write("Enter input file: ");
            string filename = Console.ReadLine();

            System.Console.WriteLine();

            System.Console.Write("Enter output file: ");
            outputFile = Console.ReadLine();

            anagramFinder = new AnagramFinder(filename);
            Show(anagramFinder.GetAnagramGroups());
        }
Ejemplo n.º 3
0
        public void TestAnagram()
        {
            Dictionary <string, string> expected = new Dictionary <string, string>();

            expected.Add("art", "tar, rat");
            expected.Add("acr", "arc, car");
            expected.Add("aegln", "glean, angel");
            expected.Add("deerssst", "stressed, desserts");
            expected.Add("aestt", "state, taste");
            expected.Add("below", "elbow, below");
            expected.Add("cdeir", "cried, cider");
            expected.Add("dstuy", "dusty, study");
            expected.Add("aiprs", "pairs, paris");
            expected.Add("chin", "chin, inch");
            expected.Add("ghint", "night , thing");
            expected.Add("bdeor", "robed, bored");
            expected.Add("abgr", "grab, brag");
            expected.Add("act", "cat, act");
            expected.Add("deenrv", "nerved, denver, vender");
            expected.Add("aesv", "save, vase");
            expected.Add("eostv", "votes, stove");
            expected.Add("defir", "fried, fired");
            expected.Add("deintu", "untied, united");
            expected.Add("dgo", "dog, god");
            expected.Add("flow", "wolf, flow");
            expected.Add("aceehrt", "teacher, cheater");
            expected.Add("abekr", "break, baker");
            expected.Add("bdeilur", "rebuild, builder");
            expected.Add("cdei", "dice, iced");
            expected.Add("aenorst", "senator, treason");
            expected.Add("cehiknt", "kitchen, thicken");

            AnagramFinder anagram = new AnagramFinder(words);
            Dictionary <string, string> actual = anagram.GetAnagramGroups();

            Assert.Equal(expected, actual);
        }