Example #1
0
        public void runNominalTestRemove_afterAddingWords()
        {
            // Set up before starting removing words
            IHybridTrie hybridTrie = new HybridTrie();

            hybridTrie.Insert(wordsList);
            hybridTrie.Insert("l");
            hybridTrie.Print("original");

            // Run tests after adding words
            Assert.That(hybridTrie.Remove("lourd"), Is.False);
            Assert.That(hybridTrie.Remove("lourdss"), Is.False);
            TestRemove(hybridTrie, "luxe", hybridTrie.GetNullPointerCount() - 6, hybridTrie.GetHeight() - 0);
            TestRemove(hybridTrie, "leve", hybridTrie.GetNullPointerCount() - 4, hybridTrie.GetHeight() - 0);
            TestRemove(hybridTrie, "les", hybridTrie.GetNullPointerCount() - 2, hybridTrie.GetHeight() - 0);
            TestRemove(hybridTrie, "lou", hybridTrie.GetNullPointerCount() - 0, hybridTrie.GetHeight() - 0);
            TestRemove(hybridTrie, "lourds", hybridTrie.GetNullPointerCount() - 6, hybridTrie.GetHeight() - 0);
            TestRemove(hybridTrie, "loups", hybridTrie.GetNullPointerCount() - 8, hybridTrie.GetHeight() - 0);
            TestRemove(hybridTrie, "le", hybridTrie.GetNullPointerCount() - 2, hybridTrie.GetHeight() - 0);
            TestRemove(hybridTrie, "l", hybridTrie.GetNullPointerCount() - 2, hybridTrie.GetHeight() - 1);
            TestRemove(hybridTrie, "olive", hybridTrie.GetNullPointerCount() - 10, hybridTrie.GetHeight() - 1);
            TestRemove(hybridTrie, "tapis", hybridTrie.GetNullPointerCount() - 10, hybridTrie.GetHeight() - 0);
            TestRemove(hybridTrie, "vert", hybridTrie.GetNullPointerCount() - 8, hybridTrie.GetHeight() - 1);
            TestRemove(hybridTrie, "dans", hybridTrie.GetNullPointerCount() - 6, hybridTrie.GetHeight() - 2);
            TestRemove(hybridTrie, "de", hybridTrie.GetNullPointerCount() - 5, hybridTrie.GetHeight() - 1);
        }
Example #2
0
        public void testPrint()
        {
            hybridTrie.Print("HT_printTest");
            const string expectedPrintResult = "\n"
                                               + "In order to know if the print test goes well, you should make a visual check.\n"
                                               + "First, go to '/drawables' and open the file HT_printTest.txt with a DOT Viewer.\n"
                                               + "Then, make sure that this properties are correct :\n"
                                               + "- The number of nodes is 34,\n"
                                               + "- The number of final nodes is 12,\n"
                                               + "- The number of leaves is 10,\n"
                                               + "- The number of red arcs is 24,\n"
                                               + "- The number of blue arcs is 4,\n"
                                               + "- The number of green arcs is 5,\n"
                                               + "- The number of nil pointers is 69,\n"
                                               + "- The average depth is 4.5,\n"
                                               + "- The height is 6.\n";

            Console.WriteLine(expectedPrintResult);
        }