private char[] CalculateTruthTableChar() { char[] truthColumn = new char[CombinationsCount]; for (int k = 0; k < CombinationsCount; k++) { truthColumn[k] = (Proposition.Calculate(GetRow(k)) == true) ? '1' : '0'; } return(truthColumn); }
private bool[] CalculateTruthTable() { bool[] truthColumn = new bool[CombinationsCount]; for (int k = 0; k < CombinationsCount; k++) { truthColumn[k] = Proposition.Calculate(GetRow(k)); } return(truthColumn); }
public void Calculate_CallToCalculateWithDifferentTruthValues_ShouldAlwaysReturnFalse(bool truthValue) { // Arrange constant.TruthValue = truthValue; // Act bool actualTruthValue = constant.Calculate(); // Assert ActualTruthValueShouldBe(actualTruthValue); }
public void Calculate_NoTruthValueAssigned_ExpectedFalseReturned() { // Arrange Proposition proposition = new Proposition('A'); // Act bool actualResult = proposition.Calculate(); // Assert actualResult.Should().BeFalse("because TruthValue was never assigned and defaults to false"); }
public void Calculate_AssignTruthValueToProposition_ExpectedAssignedTruthValueReturned(bool truthValue) { // Arrange VALID_PROPOSITION.TruthValue = truthValue; // Act bool actualResult = VALID_PROPOSITION.Calculate(); // Assert actualResult.Should().Be(truthValue, "because the assigned truthValue should be returned"); }
public void CreateContradictionFromProposition_ValidPropositionGiven_ExpectedAllAssignmentsToResultInFalse(bool truthValue) { // Arrange Proposition randomProposition = PropositionGenerator.GetRandomProposition(); Proposition contradiction = PropositionGenerator.CreateContradictionFromProposition(randomProposition); contradiction.TruthValue = truthValue; // Act bool actualTruthValue = contradiction.Calculate(); // Assert actualTruthValue.Should().BeFalse("Because a contradiction should always evaluate to false"); }
public void CreateTautologyFromProposition_ValidPropositionGiven_ExpectedAllAssignmentsToResultInTrue(bool truthValue) { // Arrange Proposition randomProposition = PropositionGenerator.GetRandomProposition(); Proposition tautology = PropositionGenerator.CreateTautologyFromProposition(randomProposition); tautology.TruthValue = truthValue; // Act bool actualTruthValue = tautology.Calculate(); // Assert actualTruthValue.Should().BeTrue("Because a tautology should always evaluate to true"); }