@Test
  public void testToCNFDimacsClauses() {
    Formula a = new Var("a");
    Formula b = new Var("b");
    Formula c = new Var("c");

    Formula f = new Formula(a.not());
    assertTrue("!a".equals(f.toString()));

    List<IVecInt> clauses = f.toCNFDimacsClauses();
    assertTrue(clauses.size() == 1);
    IVecInt literals = clauses.get(0);

    // expect {-1} array
    assertTrue(literals.get(0) == -1);

    f = new Formula(b.or(a.not()).or(c));
    assertTrue("b or !a or c".equals(f.toString()));

    clauses = f.toCNFDimacsClauses();
    assertTrue(clauses.size() == 1);
    literals = clauses.get(0);

    // expect {2, -1, 3} array
    assertTrue(literals.get(0) == 2);
    assertTrue(literals.get(1) == -1);
    assertTrue(literals.get(2) == 3);
  }
  @Test
  public void testToString() {
    Formula emptyFormula = new Formula();
    assertTrue(emptyFormula.toString().equals(StringUtils.EMPTY));

    Var a = new Var("a");
    Var b = new Var("b");
    Var c = new Var("c");
    Var d = new Var("d");

    Formula f = (a.and(b)).or(c.and(d));
    assertTrue("(a and b) or (c and d)".equals(f.toString()));

    f = (a.not().or(b)).and(c);
    assertTrue("(!a or b) and c".equals(f.toString()));
  }
  @Test
  public void testNot() {
    Var a = new Var("a");

    Formula f = (a.not());
    assertTrue("!a".equals(f.toString()));
  }
  @Test
  public void testOr() {
    Var a = new Var("a");
    Var b = new Var("b");

    Formula f = (a.or(b));
    assertTrue("a or b".equals(f.toString()));
  }
  @Test
  public void testAnd() {
    Var a = new Var("a");
    Var b = new Var("b");

    Formula f = (a.and(b));
    assertTrue("a and b".equals(f.toString()));
  }