Search in sources :

Example 46 with Disabled

use of org.junit.jupiter.api.Disabled in project Alpha by alpha-asp.

the class NaiveNoGoodStoreTest method binaryNoGoodViolatedDuringAdditionAllMbt.

@Test
@Disabled("Checks for conflict detection in add.")
public void binaryNoGoodViolatedDuringAdditionAllMbt() {
    NoGood noGood = new NoGood(fromOldLiterals(1, 2));
    assertNull(assignment.assign(1, MBT));
    assertNull(assignment.assign(2, MBT));
    ConflictCause conflictCause = store.add(11, noGood);
    assertNotNull(conflictCause);
    assertNotNull(conflictCause.getAntecedent());
}
Also used : NoGood(at.ac.tuwien.kr.alpha.core.common.NoGood) Test(org.junit.jupiter.api.Test) Disabled(org.junit.jupiter.api.Disabled)

Example 47 with Disabled

use of org.junit.jupiter.api.Disabled in project Alpha by alpha-asp.

the class GroundConflictNoGoodLearnerTest method subCurrentDLPropagationWithChoiceCauseOfConflict.

@Test
@Disabled("TrailAssignment no longer propagates at lower decision level.")
public void subCurrentDLPropagationWithChoiceCauseOfConflict() {
    GroundConflictNoGoodLearner learner = new GroundConflictNoGoodLearner(assignment, atomStore);
    NoGood n1 = new NoGood(fromOldLiterals(1, -2));
    NoGood n2 = new NoGood(fromOldLiterals(2, 3));
    store.add(10, n1);
    assignment.choose(1, ThriceTruth.TRUE);
    assignment.choose(3, ThriceTruth.TRUE);
    store.propagate();
    assertEquals(ThriceTruth.MBT, assignment.get(2).getTruth());
    assertEquals(1, assignment.get(2).getDecisionLevel());
    ConflictCause conflictCause = store.add(11, n2);
    assertNotNull(conflictCause);
    assertNotNull(conflictCause.getAntecedent());
    GroundConflictNoGoodLearner.ConflictAnalysisResult conflictAnalysisResult = learner.analyzeConflictingNoGood(conflictCause.getAntecedent());
    assertNull(conflictAnalysisResult.learnedNoGood);
    assertEquals(2, conflictAnalysisResult.backjumpLevel);
}
Also used : NoGood(at.ac.tuwien.kr.alpha.core.common.NoGood) ConflictCause(at.ac.tuwien.kr.alpha.core.solver.ConflictCause) Test(org.junit.jupiter.api.Test) Disabled(org.junit.jupiter.api.Disabled)

Example 48 with Disabled

use of org.junit.jupiter.api.Disabled in project Alpha by alpha-asp.

the class AlphaImplTest method withExternalInvocationCounted1.

@Test
@Disabled("External atom has state, which is not allowed. Caching of calls makes the number of invocations wrong.")
public void withExternalInvocationCounted1() throws Exception {
    Alpha system = new AlphaImpl();
    InputConfig cfg = InputConfig.forString("a :- &isOne[1], &isOne[1].");
    cfg.addPredicateMethod("isOne", Externals.processPredicateMethod(this.getClass().getMethod("isOne", int.class)));
    ASPCore2Program prog = system.readProgram(cfg);
    int before = invocations;
    Set<AnswerSet> actual = system.solve(prog).collect(Collectors.toSet());
    int after = invocations;
    assertEquals(2, after - before);
    Set<AnswerSet> expected = new HashSet<>(singletonList(new AnswerSetBuilder().predicate("a").build()));
    assertEquals(expected, actual);
}
Also used : ASPCore2Program(at.ac.tuwien.kr.alpha.api.programs.ASPCore2Program) AnswerSet(at.ac.tuwien.kr.alpha.api.AnswerSet) Alpha(at.ac.tuwien.kr.alpha.api.Alpha) InputConfig(at.ac.tuwien.kr.alpha.api.config.InputConfig) AnswerSetBuilder(at.ac.tuwien.kr.alpha.commons.AnswerSetBuilder) HashSet(java.util.HashSet) Test(org.junit.jupiter.api.Test) Disabled(org.junit.jupiter.api.Disabled)

Example 49 with Disabled

use of org.junit.jupiter.api.Disabled in project Alpha by alpha-asp.

the class AlphaImplTest method withExternalInvocationCounted3.

@Test
@Disabled("External atom has state, which is not allowed. Caching of calls makes the number of invocations wrong.")
public void withExternalInvocationCounted3() throws Exception {
    Alpha system = new AlphaImpl();
    InputConfig cfg = InputConfig.forString("a :- &isOne[1], not &isOne[2].");
    cfg.addPredicateMethod("isOne", Externals.processPredicateMethod(this.getClass().getMethod("isOne", int.class)));
    ASPCore2Program prog = system.readProgram(cfg);
    int before = invocations;
    Set<AnswerSet> actual = system.solve(prog).collect(Collectors.toSet());
    int after = invocations;
    assertEquals(1, after - before);
    Set<AnswerSet> expected = new HashSet<>(singletonList(new AnswerSetBuilder().predicate("a").build()));
    assertEquals(expected, actual);
}
Also used : ASPCore2Program(at.ac.tuwien.kr.alpha.api.programs.ASPCore2Program) AnswerSet(at.ac.tuwien.kr.alpha.api.AnswerSet) Alpha(at.ac.tuwien.kr.alpha.api.Alpha) InputConfig(at.ac.tuwien.kr.alpha.api.config.InputConfig) AnswerSetBuilder(at.ac.tuwien.kr.alpha.commons.AnswerSetBuilder) HashSet(java.util.HashSet) Test(org.junit.jupiter.api.Test) Disabled(org.junit.jupiter.api.Disabled)

Example 50 with Disabled

use of org.junit.jupiter.api.Disabled in project Alpha by alpha-asp.

the class AlphaImplTest method withExternalInvocationCounted2.

@Test
@Disabled("External atom has state, which is not allowed. Caching of calls makes the number of invocations wrong.")
public void withExternalInvocationCounted2() throws Exception {
    Alpha system = new AlphaImpl();
    InputConfig cfg = InputConfig.forString("a. b :- &isOne[1], &isOne[2].");
    cfg.addPredicateMethod("isOne", Externals.processPredicateMethod(this.getClass().getMethod("isOne", int.class)));
    ASPCore2Program prog = system.readProgram(cfg);
    int before = invocations;
    Set<AnswerSet> actual = system.solve(prog).collect(Collectors.toSet());
    int after = invocations;
    assertEquals(2, after - before);
    Set<AnswerSet> expected = new HashSet<>(singletonList(new AnswerSetBuilder().predicate("a").build()));
    assertEquals(expected, actual);
}
Also used : ASPCore2Program(at.ac.tuwien.kr.alpha.api.programs.ASPCore2Program) AnswerSet(at.ac.tuwien.kr.alpha.api.AnswerSet) Alpha(at.ac.tuwien.kr.alpha.api.Alpha) InputConfig(at.ac.tuwien.kr.alpha.api.config.InputConfig) AnswerSetBuilder(at.ac.tuwien.kr.alpha.commons.AnswerSetBuilder) HashSet(java.util.HashSet) Test(org.junit.jupiter.api.Test) Disabled(org.junit.jupiter.api.Disabled)

Aggregations

Disabled (org.junit.jupiter.api.Disabled)228 Test (org.junit.jupiter.api.Test)214 File (java.io.File)13 TransactionalIntegrationTest (org.hisp.dhis.TransactionalIntegrationTest)13 NoGood (at.ac.tuwien.kr.alpha.core.common.NoGood)10 ArrayList (java.util.ArrayList)10 HashMap (java.util.HashMap)9 NAR (nars.NAR)9 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)9 BaseDataTest (org.apache.ibatis.BaseDataTest)8 TestNAR (nars.test.TestNAR)7 URL (org.apache.dubbo.common.URL)7 SqlSession (org.apache.ibatis.session.SqlSession)7 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)7 AnswerSet (at.ac.tuwien.kr.alpha.api.AnswerSet)6 ASPCore2Program (at.ac.tuwien.kr.alpha.api.programs.ASPCore2Program)6 FieldValueModel (com.synopsys.integration.alert.common.rest.model.FieldValueModel)6 IntegrationPerformanceTestRunner (com.synopsys.integration.alert.performance.utility.IntegrationPerformanceTestRunner)6 List (java.util.List)6 RectDouble2D (jcog.tree.rtree.rect.RectDouble2D)6