use of at.ac.tuwien.kr.alpha.api.config.InputConfig in project Alpha by alpha-asp.
the class AlphaImplTest method noInput.
@Test
public void noInput() throws Exception {
Alpha system = new AlphaImpl();
InputConfig cfg = InputConfig.forString("node(1). a :- &bestNode(X), node(X).");
cfg.addPredicateMethod("bestNode", Externals.processPredicateMethod(this.getClass().getMethod("bestNode")));
ASPCore2Program prog = system.readProgram(cfg);
Set<AnswerSet> expected = AnswerSetsParser.parse("{ node(1), a }");
Set<AnswerSet> actual = system.solve(prog).collect(Collectors.toSet());
assertEquals(expected, actual);
}
use of at.ac.tuwien.kr.alpha.api.config.InputConfig in project Alpha by alpha-asp.
the class AlphaImplTest method smallGraphNoNeighbors.
@Test
@Disabled("Test program is not safe (external lacking output variables). This should throw some exception.")
public void smallGraphNoNeighbors() throws Exception {
Alpha system = new AlphaImpl();
InputConfig cfg = InputConfig.forString("noNeighbors(2) :- not &neighbors[2].");
cfg.addPredicateMethod("neighbors", Externals.processPredicateMethod(this.getClass().getMethod("neighbors", int.class)));
ASPCore2Program prog = system.readProgram(cfg);
Set<AnswerSet> expected = AnswerSetsParser.parse("{ noNeighbors(2) }");
Set<AnswerSet> actual = system.solve(prog).collect(Collectors.toSet());
assertEquals(expected, actual);
}
Aggregations