Exemple #1
0
    def test_daggify(self):
        x = Symbol("x")
        f = And(x,x)
        for _ in xrange(10):
            f = And(f,f)

        tree_buf = cStringIO()
        dag_buf = cStringIO()
        tree_printer = SmtPrinter(tree_buf)
        dag_printer = SmtDagPrinter(dag_buf)

        dag_printer.printer(f)
        tree_printer.printer(f)

        short_f_str = dag_buf.getvalue()
        long_f_str = tree_buf.getvalue()
        self.assertTrue(len(short_f_str) < len(long_f_str))
Exemple #2
0
    def print_to_string(self, formula):
        buf = cStringIO()
        printer = SmtPrinter(buf)
        printer.printer(formula)

        return buf.getvalue()
 def __str__(self):
     buf = cStringIO()
     p = SmtPrinter(buf)
     p.printer(self.f)
     return buf.getvalue()