예제 #1
0
파일: DawgTest.cs 프로젝트: mgravi7/LexBot
        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");
        }
예제 #2
0
파일: DawgTest.cs 프로젝트: mgravi7/LexBot
        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);
        }
예제 #3
0
파일: DawgTest.cs 프로젝트: mgravi7/LexBot
        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);
        }
예제 #4
0
파일: DawgTest.cs 프로젝트: mgravi7/LexBot
        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!
        }