예제 #1
0
        public void GetRandomPropositionSymbol_CallToGetRandomPropositionSymbol_ExpectedRandomPropositionReturned()
        {
            // Arrange // Act
            Proposition randomProposition = PropositionGenerator.GetRandomPropositionSymbol();

            // Assert
            randomProposition.Should().BeOfType <Proposition>("Because a proposition with a random variable letter is generated");
        }
예제 #2
0
        public void Nandify_CallToNandifyOnConstant_ShouldReturnThePropositionItself()
        {
            // Arrange
            // Act
            Proposition nandifiedConstant = constant.Nandify();

            // Assert
            nandifiedConstant.Should().BeEquivalentTo(constant, "because false nandified is still false");
        }
예제 #3
0
        public void Copy_CopyAValidPropositionObject_ExpectedDifferentReferenceSameDataVariable()
        {
            // Arrange // Act
            Proposition copy = VALID_PROPOSITION.Copy();

            // Assert
            copy.Should().NotBeSameAs(VALID_PROPOSITION, "because it is a copy");
            copy.Data.Should().BeEquivalentTo(VALID_PROPOSITION.Data, "because it is a copy");
        }
예제 #4
0
        public void Constructor_ParsedPropositionGiven_ShouldResultInNegatedPropositionAsRoot()
        {
            // Arrange
            Proposition      randomValidProposition = PropositionGenerator.GetRandomProposition();
            SemanticTableaux semanticTableaux       = new SemanticTableaux(randomValidProposition);

            // Act
            Proposition root = semanticTableaux.Proposition;

            // Assert
            root.Should().Be(randomValidProposition, "Because the original expression is being evaluated");
        }
예제 #5
0
        public void CreateDisjunctiveNormalForm_NegatedProposition_ExpectedOriginalNegatedPropositionReturned()
        {
            // Arrange
            Proposition originalProposition = PropositionGenerator.CreateUnaryConnectiveWithRandomSymbol(Negation.SYMBOL);
            TruthTable  tt           = new TruthTable(originalProposition);
            TruthTable  simplifiedTt = tt.Simplify();

            // Act
            Proposition dnf           = tt.CreateDisjunctiveNormalForm();
            Proposition simplifiedDnf = simplifiedTt.CreateDisjunctiveNormalForm();

            // Assert
            dnf.Should().BeEquivalentTo(originalProposition, "Because the disjunctive normal of a negated proposition literal is the negated literal itself");
            simplifiedDnf.Should().BeEquivalentTo(originalProposition, "Because a negated literal can not be simplified any further and should result in the negated literal itself.");
        }
예제 #6
0
        public void CreateDisjunctiveNormalForm_IndividualPropositionGiven_ExpectedIndividualPropositionReturned()
        {
            // Arrange
            Proposition originalProposition = PropositionGenerator.GetRandomProposition();
            TruthTable  tt           = new TruthTable(originalProposition);
            TruthTable  simplifiedTt = tt.Simplify();

            // Act
            Proposition dnf           = tt.CreateDisjunctiveNormalForm();
            Proposition simplifiedDnf = simplifiedTt.CreateDisjunctiveNormalForm();

            // Assert
            dnf.Should().BeEquivalentTo(originalProposition, "Because the disjunctive normal of a proposition literal is the literal itself");
            simplifiedDnf.Should().BeEquivalentTo(originalProposition, "Because a literal can not be simplified any further and should result in the literal itself.");
        }