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"); }
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); }
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); }
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! }