public void returnLabel_is_not_null() { //Arrange var processObject = new ProcessLogicClass(">(a,b)"); var truthTableObject = new TruthTable(processObject); //Act var valueReturn = truthTableObject.returnLabel(); //Assert Assert.IsNotNull(valueReturn); }
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))))"); }