コード例 #1
0
  @Test
  public void testIsPhrase() {
    Var a = new Var("a");
    Var b = new Var("b");
    Var c = new Var("c");

    assertTrue(a.isPhrase());
    assertTrue(b.isPhrase());
    assertTrue(c.isPhrase());

    // if a and b are both phrases, then so is (a and b)
    Formula f = a.and(b);
    assertTrue(f.isPhrase());

    // if f is a phrase and c is a phrase, then so is (f and c)
    assertTrue(f.and(c).isPhrase());
    assertTrue(c.and(f).isPhrase());

    Formula g = a.or(b);
    assertFalse(g.isPhrase());

    assertFalse(g.and(c).isPhrase());
    assertFalse(c.and(g).isPhrase());
  }
コード例 #2
0
 @Test(expected = org.sat4j.specs.ContradictionException.class)
 public void testGetModels_contradiction() throws ContradictionException, TimeoutException {
   Formula f = new Var("a");
   Formula g = f.and(f.not());
   Formula instance = Formula.newInstanceforSAT(g);
 }