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 simplifiedTableString_is_not_null()
        {
            //Arrange
            var processObject    = new ProcessLogicClass(">(a,b)");
            var truthTableObject = new TruthTable(processObject);

            //Act
            var testString = truthTableObject.simplifiedTableString(truthTableObject.returnValuesEachLine());

            //Assert
            Assert.IsNotNull(testString);
        }
        public void getList0and1_is_it_valid()
        {
            //Arrange
            var processObject    = new ProcessLogicClass(">(a,b)");
            var truthTableObject = new TruthTable(processObject);

            //Act
            var simplifiedtableString = truthTableObject.getList0and1();

            //Assert
            Assert.AreEqual(simplifiedtableString, "0  ⋆              1\n⋆  1              1\n");
        }
        public void returnHexHashCode_isItValid()
        {
            //Arrange
            var processObject    = new ProcessLogicClass(">(a,b)");
            var truthTableObject = new TruthTable(processObject);

            //Act
            var tableString = truthTableObject.printTable();
            var hashCode    = truthTableObject.returnHexHashCode();

            //Assert
            Assert.AreEqual(hashCode, "B");
        }
        public void returnHexHashCode_is_not_null()
        {
            //Arrange
            var processObject    = new ProcessLogicClass(">(a,b)");
            var truthTableObject = new TruthTable(processObject);

            //Act
            var tableString = truthTableObject.printTable();
            var hashCode    = truthTableObject.returnHexHashCode();

            //Assert
            Assert.IsNotNull(hashCode);
        }
        public void getLeftAndRight_test_output_is_it_valid()
        {
            //Arrange
            string left, right;
            var    processObject = new ProcessLogicClass(">(a,b)");

            //Act
            processObject.getLeftAndRight(processObject.getRawString(), out left, out right);

            //Assert
            Assert.AreEqual(left, "a");
            Assert.AreEqual(right, "b");
        }
        public void getLeftAndRight_test_output_is_it_null()
        {
            //Arrange
            string left, right;
            var    processObject = new ProcessLogicClass(">(a,b)");

            //Act
            processObject.getLeftAndRight(processObject.getRawString(), out left, out right);

            //Assert
            Assert.IsNotNull(left);
            Assert.IsNotNull(right);
        }
예제 #8
0
        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)");
        }
예제 #9
0
        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!");
        }
예제 #10
0
        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))");
        }
예제 #11
0
        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);
        }
예제 #12
0
        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>));
        }