public void InOrderTraversel_GivenTree_NodesAreReturnedInRightOrder() { PrepositionTree prepositionTree = new PrepositionTree(); string logicalPreposition = "=&~AB|A~B"; string expected = "A~&B=A|B~"; Form1.InitializeLetters(); Form1.inOrderTraversal = ""; foreach (char c in logicalPreposition) { prepositionTree.Insert(c); } prepositionTree.InOrderTraversal(); Assert.AreEqual(expected, Form1.inOrderTraversal); }
public void Insert_GivenComplexProposition_ValidTreeIsCreated() { PrepositionTree prepositionTree = new PrepositionTree(); string logicalPreposition = "|~>AB&A>CB"; string expected = "A>B~|A&C>B"; Form1.InitializeLetters(); Form1.inOrderTraversal = ""; foreach (char c in logicalPreposition) { prepositionTree.Insert(c); } prepositionTree.InOrderTraversal(); Assert.AreEqual(expected, Form1.inOrderTraversal); }
public void Insert_GivenSimpleProposition_ValidTreeIsCreated() { PrepositionTree prepositionTree = new PrepositionTree(); string logicalPreposition = "=|A~B&~A~B"; string expected = "A|B~=A~&B~"; Form1.InitializeLetters(); Form1.inOrderTraversal = ""; foreach (char c in logicalPreposition) { prepositionTree.Insert(c); } prepositionTree.InOrderTraversal(); Assert.AreEqual(expected, Form1.inOrderTraversal); }