use of at.ac.tuwien.kr.alpha.api.rules.heads.Head 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.rules.heads.Head 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.rules.heads.Head 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.rules.heads.Head 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.rules.heads.Head in project Alpha by alpha-asp.
the class LiteralBindingNonBindingVariablesTest method testPositiveComparisonLiteral_NEQ_Bidirectional.
@Test
public void testPositiveComparisonLiteral_NEQ_Bidirectional() {
Rule<Head> rule = parser.parse("p(X) :- q(X,Y), X != Y.").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(), "X", "Y");
}
Aggregations