use of at.ac.tuwien.kr.alpha.api.programs.literals.Literal in project Alpha by alpha-asp.
the class LiteralBindingNonBindingVariablesTest method testPositiveComparisonLiteral_EQ_RightAssigning.
@Test
public void testPositiveComparisonLiteral_EQ_RightAssigning() {
Rule<Head> rule = parser.parse("p(X) :- q(X,Y), 5 = Y.").getRules().get(0);
Literal literal = rule.getBody().stream().filter((lit) -> lit.getPredicate() == ComparisonOperators.EQ.toPredicate()).findFirst().get();
assertEquals(false, literal.isNegated());
expectVariables(literal.getBindingVariables(), "Y");
expectVariables(literal.getNonBindingVariables());
}
use of at.ac.tuwien.kr.alpha.api.programs.literals.Literal in project Alpha by alpha-asp.
the class LiteralBindingNonBindingVariablesTest method testPositiveComparisonLiteral_NEQ_LeftAssigning.
@Test
public void testPositiveComparisonLiteral_NEQ_LeftAssigning() {
Rule<Head> rule = parser.parse("p(X) :- q(X,Y), Y != 5.").getRules().get(0);
Literal literal = rule.getBody().stream().filter((lit) -> lit.getPredicate() == ComparisonOperators.NE.toPredicate()).findFirst().get();
assertEquals(false, literal.isNegated());
expectVariables(literal.getBindingVariables());
expectVariables(literal.getNonBindingVariables(), "Y");
}
use of at.ac.tuwien.kr.alpha.api.programs.literals.Literal in project Alpha by alpha-asp.
the class LiteralBindingNonBindingVariablesTest method testPositiveComparisonLiteral_EQ_LeftAssigning.
@Test
public void testPositiveComparisonLiteral_EQ_LeftAssigning() {
Rule<Head> rule = parser.parse("p(X) :- q(X,Y), Y = 5.").getRules().get(0);
Literal literal = rule.getBody().stream().filter((lit) -> lit.getPredicate() == ComparisonOperators.EQ.toPredicate()).findFirst().get();
assertEquals(false, literal.isNegated());
expectVariables(literal.getBindingVariables(), "Y");
expectVariables(literal.getNonBindingVariables());
}
use of at.ac.tuwien.kr.alpha.api.programs.literals.Literal in project Alpha by alpha-asp.
the class LiteralBindingNonBindingVariablesTest method testNegativeComparisonLiteral_EQ_LeftAssigning.
@Test
public void testNegativeComparisonLiteral_EQ_LeftAssigning() {
Rule<Head> rule = parser.parse("p(X) :- q(X,Y), not Y = 5.").getRules().get(0);
Literal literal = rule.getNegativeBody().stream().findFirst().get();
assertEquals(true, literal.isNegated());
expectVariables(literal.getBindingVariables());
expectVariables(literal.getNonBindingVariables(), "Y");
}
use of at.ac.tuwien.kr.alpha.api.programs.literals.Literal in project Alpha by alpha-asp.
the class LiteralBindingNonBindingVariablesTest method testNegativeComparisonLiteral_NEQ_Bidirectional.
@Test
@Disabled("Literals of this kind are compiled away by VariableEqualityRemoval")
public void testNegativeComparisonLiteral_NEQ_Bidirectional() {
Literal literal = parser.parse("p(X) :- q(X,Y), not X != Y.").getRules().get(0).getNegativeBody().stream().findFirst().get();
assertEquals(true, literal.isNegated());
expectVariables(literal.getBindingVariables(), "X", "Y");
expectVariables(literal.getNonBindingVariables());
}
Aggregations