public void Should_evaluate_empty_clause_to_true() { // Arrange Clause clause = new Clause(new List <SignedLiteral>() { }); // Act bool clauseEvaluation = clause.Evaluate(); // Assert Assert.IsTrue(clauseEvaluation); }
public void Should_evaluate_clause_with_mixed_valued_literals_to_true() { // Arrange SignedLiteral a = new SignedLiteral("A", false, false); SignedLiteral b = new SignedLiteral("B", false, true); SignedLiteral c = new SignedLiteral("C", false, false); Clause clause = new Clause(new List <SignedLiteral>() { a, b, c }); // Act bool clauseEvaluation = clause.Evaluate(); // Assert Assert.IsTrue(clauseEvaluation); }
public void Should_evaluate_clauses_with_negated_values_correctly() { // Arrange SignedLiteral a = new SignedLiteral("A", true, false); // evaluates to true SignedLiteral b = new SignedLiteral("B", false, false); // evaluates to false SignedLiteral c = new SignedLiteral("C", false, true); // evaluates to true SignedLiteral d = new SignedLiteral("D", true, true); // evaluates to false Clause clause1 = new Clause(new List <SignedLiteral>() { a, b, c }); Clause clause2 = new Clause(new List <SignedLiteral>() { a, c }); Clause clause3 = new Clause(new List <SignedLiteral>() { a, b }); Clause clause4 = new Clause(new List <SignedLiteral>() { b, d }); // Act bool clauseEvaluation1 = clause1.Evaluate(); bool clauseEvaluation2 = clause2.Evaluate(); bool clauseEvaluation3 = clause3.Evaluate(); bool clauseEvaluation4 = clause4.Evaluate(); // Assert Assert.IsTrue(clauseEvaluation1); Assert.IsTrue(clauseEvaluation2); Assert.IsTrue(clauseEvaluation3); Assert.IsFalse(clauseEvaluation4); }