use of at.ac.tuwien.kr.alpha.core.programs.CompiledProgram in project Alpha by alpha-asp.
the class RuleGroundingOrderTest method testPositionFromWhichAllVarsAreBound_ground.
@Test
public void testPositionFromWhichAllVarsAreBound_ground() {
String aspStr = "a :- b, not c.";
CompiledProgram internalPrg = PARSE_AND_PREPROCESS.apply(aspStr);
RuleGroundingInfo rgo0 = computeGroundingOrdersForRule(internalPrg, 0);
assertEquals(0, rgo0.getFixedGroundingOrder().getPositionFromWhichAllVarsAreBound());
}
use of at.ac.tuwien.kr.alpha.core.programs.CompiledProgram in project Alpha by alpha-asp.
the class AlphaImplTest method disableStratifiedEvalTest.
/**
* Verifies that no stratified evaluation is performed up-front when disabled in config.
*/
@Test
public void disableStratifiedEvalTest() {
// Note: This might be cleaner if the test used the debugSolve method from the interface
String progstr = "p(a). q(X) :- p(X).";
SystemConfig cfg = new SystemConfig();
cfg.setEvaluateStratifiedPart(false);
AlphaImpl system = new AlphaImpl(cfg);
ASPCore2Program input = system.readProgramString(progstr);
NormalProgram normal = system.normalizeProgram(input);
CompiledProgram preprocessed = system.performProgramPreprocessing(normal);
assertFalse(preprocessed.getFacts().contains(Atoms.newBasicAtom(Predicates.getPredicate("q", 1), Terms.newSymbolicConstant("a"))), "Preprocessed program contains fact derived from stratifiable rule, but should not!");
}
use of at.ac.tuwien.kr.alpha.core.programs.CompiledProgram in project Alpha by alpha-asp.
the class AlphaImplTest method enableStratifiedEvalTest.
/**
* Verifies that stratified evaluation is performed up-front if not otherwise configured.
*/
@Test
public void enableStratifiedEvalTest() {
// Note: This might be cleaner if the test used the debugSolve method from the interface
String progstr = "p(a). q(X) :- p(X).";
SystemConfig cfg = new SystemConfig();
AlphaImpl system = new AlphaImpl(cfg);
ASPCore2Program input = system.readProgramString(progstr);
NormalProgram normal = system.normalizeProgram(input);
CompiledProgram preprocessed = system.performProgramPreprocessing(normal);
assertTrue(preprocessed.getFacts().contains(Atoms.newBasicAtom(Predicates.getPredicate("q", 1), Terms.newSymbolicConstant("a"))), "Preprocessed program does not contain fact derived from stratifiable rule, but should!");
}
Aggregations