public void GenerateDisjunctiveForm_GivenTruthTable_ValidDisjunctiveFormIsCreated() { PrepositionTree prepositionTree = new PrepositionTree(); string logicalPreposition = "=~AB|A~B"; string expected, actual; Form1.InitializeLetters(); foreach (char c in logicalPreposition) { prepositionTree.Insert(c); } expected = prepositionTree.CreateTruthTable(); string disjunctiveFrom = prepositionTree.GetDisjunctiveForm(); PrepositionTree disjunctivePrepostionTree = new PrepositionTree(); foreach (char c in disjunctiveFrom) { disjunctivePrepostionTree.Insert(c); } actual = disjunctivePrepostionTree.CreateTruthTable(); Assert.AreEqual(expected, actual); }
public void SimplifyTruthTable_GivenTruthTable_ValidSimplifiedTableIsCreated() { PrepositionTree prepositionTree = new PrepositionTree(); string logicalPreposition = "|~>AB&A>CB"; string expected = "10000"; Form1.InitializeLetters(); foreach (char c in logicalPreposition) { prepositionTree.Insert(c); } prepositionTree.CreateTruthTable(); string actual = prepositionTree.SimplifyThurthTable(); Assert.AreEqual(expected, actual); }
public void CreateTruthTable_GivenTree_ValidTruthTableIsCreated() { PrepositionTree prepositionTree = new PrepositionTree(); string logicalPreposition = "||ABC"; string expected = "01111111"; string actual; Form1.InitializeLetters(); Form1.inOrderTraversal = ""; foreach (char c in logicalPreposition) { prepositionTree.Insert(c); } actual = prepositionTree.CreateTruthTable(); Assert.AreEqual(expected, actual); }