Skip to content

Commit

Permalink
added unit test for DRUP issue
Browse files Browse the repository at this point in the history
  • Loading branch information
rouven-walter authored and SHildebrandt committed Sep 18, 2020
1 parent 91843f2 commit 95b2d0d
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/test/java/org/logicng/explanations/drup/DRUPTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,32 @@ public void testCoreAndAssumptions2() throws ParserException {
assertThat(solver.unsatCore()).isNotNull();
}

@Test
public void testCoreAndAssumptions3() throws ParserException {
// Unit test for DRUP issue which led to java.lang.ArrayIndexOutOfBoundsException: -1
final FormulaFactory f = new FormulaFactory();
final MiniSat solver = MiniSat.miniSat(f, MiniSatConfig.builder().proofGeneration(true).cnfMethod(MiniSatConfig.CNFMethod.PG_ON_SOLVER).build());

solver.add(f.parse("X => Y"));
solver.add(f.parse("X => Z"));
solver.add(f.parse("C => E"));
solver.add(f.parse("D => ~F"));
solver.add(f.parse("B => M"));
solver.add(f.parse("D => N"));
solver.add(f.parse("G => O"));
solver.add(f.parse("A => B"));
solver.add(f.parse("T1 <=> A & K & ~B & ~C"));
solver.add(f.parse("T2 <=> A & B & C & K"));
solver.add(f.parse("T1 + T2 = 1"));
solver.sat(); // required for DRUP issue

solver.add(f.parse("Y => ~X & D"));
solver.add(f.parse("X"));

solver.sat();
assertThat(solver.unsatCore()).isNotNull();
}

@Test
public void testWithCcPropositions() throws ParserException {
final FormulaFactory f = new FormulaFactory();
Expand Down

0 comments on commit 95b2d0d

Please sign in to comment.