Esempio n. 1
0
        public void TruthTable_CalculateTruthTable_HashCodeBeEqualAsExpected(string prefixInput, string hexaHashCode)
        {
            //Arrange
            var binaryTree = ParsingModule.Parse(prefixInput);

            //Act
            var truthTable = new TruthTable(binaryTree);

            //Assert
            Assert.Equal(truthTable.GetHexadecimalHashCode(), hexaHashCode);
        }
Esempio n. 2
0
        public void TruthTable_Nandify_NandTruthTableHashCodeBeAsExpected(string prefixInput)
        {
            //Arrange
            var nandify    = new Nandify();
            var binaryTree = ParsingModule.Parse(prefixInput);

            //Act
            var truthTable = new TruthTable(binaryTree);

            nandify.Calculate(binaryTree.Root);
            var truthTableNand = new TruthTable(Nandify.BinaryTree);

            //Assert
            Assert.Equal(truthTable.GetHexadecimalHashCode(), truthTableNand.GetHexadecimalHashCode());
        }
Esempio n. 3
0
        public void TruthTable_DNFProcessing_DNFFormulaAndHashCodeBeAsExpected(string prefixInput)
        {
            //Arrange
            var binaryTree = ParsingModule.Parse(prefixInput);

            //Act
            var truthTable = new TruthTable(binaryTree);

            truthTable.ProcessDnf();
            if (truthTable.DnfNormalComponents.Count == 0)
            {
                return;
            }
            var truthTableDnf = new TruthTable(truthTable.DnfNormalBinaryTree);

            //Assert
            Assert.Equal(truthTableDnf.GetHexadecimalHashCode(), truthTable.GetHexadecimalHashCode());
            Assert.Equal(truthTableDnf.GetHexadecimalSimplifiedHashCode(), truthTable.GetHexadecimalSimplifiedHashCode());
        }