public void returnLogicResult_does_it_return_right_type() { //Arrange var processObject = new ProcessLogicClass(">(a,b)"); var truthTableObject = new TruthTable(processObject); //Act var valueReturn = truthTableObject.returnLogicResult(); //Assert Assert.IsInstanceOfType(valueReturn, typeof(List <int>)); }
public void processEachLine_returnValidOrNot() { //Arrange ProcessLogicClass processObject = new ProcessLogicClass("=(>(a,b),c)"); TruthTable truthTableObject = new TruthTable(processObject); List <char[]> ValuesAllLines = truthTableObject.returnValuesEachLine(); List <int> allResults = truthTableObject.returnLogicResult(); //Act DNF DNFobject = new DNF(allResults, ValuesAllLines, new String(truthTableObject.returnLabel())); string toReturn = DNFobject.processEachLine("001", "abc"); //Assert Assert.AreEqual(toReturn, "&(&(~(a),~(b)),c)"); }
public void processAllLines_TestOutputContradiction() { //Arrange ProcessLogicClass processObject = new ProcessLogicClass("&(&(B,=(>(|(=(A,B),C),>(~(=(A,B)),>(A,>(A,B)))),~(B))),~(D))"); TruthTable truthTableObject = new TruthTable(processObject); List <char[]> ValuesAllLines = truthTableObject.returnValuesEachLine(); List <int> allResults = truthTableObject.returnLogicResult(); //Act DNF DNFobject = new DNF(allResults, ValuesAllLines, new String(truthTableObject.returnLabel())); string dnfString = DNFobject.returnDNFString(); //Assert Assert.AreEqual(dnfString, "Cannot generate a DNF with a contradiction!"); }
public void processAllLines_TestOutPutTrue() { //Arrange ProcessLogicClass processObject = new ProcessLogicClass("=(>(a,b),c)"); TruthTable truthTableObject = new TruthTable(processObject); List <char[]> ValuesAllLines = truthTableObject.returnValuesEachLine(); List <int> allResults = truthTableObject.returnLogicResult(); //Act DNF DNFobject = new DNF(allResults, ValuesAllLines, new String(truthTableObject.returnLabel())); string dnfString = DNFobject.returnDNFString(); //Assert Assert.AreEqual(dnfString, "|(|(|(&(&(~(a),~(b)),c),&(&(~(a),b),c)),&(&(a,~(b)),~(c))),&(&(a,b),c))"); }
public void returnDNFString_checkIfNull() { //Arrange ProcessLogicClass processObject = new ProcessLogicClass("=(>(a,b),c)"); TruthTable truthTableObject = new TruthTable(processObject); List <char[]> ValuesAllLines = truthTableObject.returnValuesEachLine(); List <int> allResults = truthTableObject.returnLogicResult(); DNF DNFobject = new DNF(allResults, ValuesAllLines, new String(truthTableObject.returnLabel())); //Act string dnfString = DNFobject.returnDNFString(); //Assert Assert.IsNotNull(dnfString); }
public void GenerateListForDNF_testIfSuccess() { //Arrange ProcessLogicClass processObject = new ProcessLogicClass("=(>(a,b),c)"); TruthTable truthTableObject = new TruthTable(processObject); List <char[]> ValuesAllLines = truthTableObject.returnValuesEachLine(); List <int> allResults = truthTableObject.returnLogicResult(); DNF DNFobject = new DNF(allResults, ValuesAllLines, new String(truthTableObject.returnLabel())); //Act List <string> GenerateListForDNFReturn = DNFobject.GenerateListForDNF(allResults, ValuesAllLines); //Assert Assert.IsNotNull(GenerateListForDNFReturn); }
public void GetNANDString_test_output_is_it_valid() { //Arrange ProcessLogicClass processObject = new ProcessLogicClass(">(a,b)"); TruthTable truthTableObject = new TruthTable(processObject); List <char[]> ValuesAllLines = truthTableObject.returnValuesEachLine(); List <int> allResults = truthTableObject.returnLogicResult(); DNF DNFobject = new DNF(allResults, ValuesAllLines, new String(truthTableObject.returnLabel())); //Act string result = processObject.GetNANDString(DNFobject.returnDNFString()); //Assert Assert.AreEqual(result, "%(~(%(~(~(%(~(a),~(b)))),~(~(%(~(a),b))))),~(~(%(a,b))))"); }
public void does_it_return_right_type() { //Arrange var processObject = new ProcessLogicClass(">(a,b)"); var truthTableObject = new TruthTable(processObject); List <string> list0 = new List <string>(); List <string> list1 = new List <string>(); truthTableObject.OutList0And1(truthTableObject.returnValuesEachLine(), truthTableObject.returnLogicResult(), out list0, out list1); //Act List <string> display0 = truthTableObject.FindRepetitionEnding(list0); //Assert Assert.IsInstanceOfType(display0, typeof(List <string>)); }