Beispiel #1
0
        public void DawgCreator_SaveDawg_WithLessNodes()
        {
            // create
            uint        fakeNumNodes = numNodes + 1U;
            DawgCreator dawgCreator  = new DawgCreator(lexiconName, fakeNumNodes, numWords, numReversePartWords);

            // add nodes
            for (int idx = 0; idx < numNodes; idx++)
            {
                dawgCreator.AddNode(nodes[idx]);
            }

            // save
            try
            {
                dawgCreator.SaveDawg(lexiconFileName);
            }
            catch (InvalidOperationException excp)
            {
                StringAssert.Contains(excp.Message, fakeNumNodes.ToString());
                StringAssert.Contains(excp.Message, numNodes.ToString());
                return;
            }

            Assert.Fail("No exception was thrown");
        }
Beispiel #2
0
        public void DawgCreator_AddNodes()
        {
            // create
            DawgCreator dawgCreator = new DawgCreator(lexiconName, numNodes, numWords, numReversePartWords);

            // add nodes
            for (int idx = 0; idx < numNodes; idx++)
            {
                dawgCreator.AddNode(nodes[idx]);
            }
            Assert.AreEqual <uint>(numNodes, dawgCreator.NumAddedNodes);
        }
Beispiel #3
0
        public void DawgCreator_SaveDawg()
        {
            // create
            DawgCreator dawgCreator = new DawgCreator(lexiconName, numNodes, numWords, numReversePartWords);

            // add nodes
            for (int idx = 0; idx < numNodes; idx++)
            {
                dawgCreator.AddNode(nodes[idx]);
            }

            // save
            dawgCreator.SaveDawg(lexiconFileName);
        }
Beispiel #4
0
        public void DawgCreator_SaveDawg_ReadDawg()
        {
            // create
            DawgCreator dawgCreator = new DawgCreator(lexiconName, numNodes, numWords, numReversePartWords);

            // add nodes
            for (int idx = 0; idx < numNodes; idx++)
            {
                dawgCreator.AddNode(nodes[idx]);
            }

            // save
            dawgCreator.SaveDawg(lexiconFileName);

            // read it back:-)
            Dawg dawg = new Dawg(lexiconFileName);

            // let us hope for no exceptions!
        }
Beispiel #5
0
 public void DawgCreator_Construct()
 {
     DawgCreator dawgCreator = new DawgCreator(lexiconName, numNodes, numWords, numReversePartWords);
 }