예제 #1
0
 def test_print_nodes(self):
     a   = self.node_from_expr("a = 1")
     b   = self.node_from_expr("b = 2")
     c   = self.node_from_expr("c = 3")
     nlst= NodeList.from_list([a, b, c])
     
     nlst.print_nodes(StdioFile.stdout())
예제 #2
0
 def test_print_nodes(self):
     a   = self.node_from_expr("a = 1")
     b   = self.node_from_expr("b = 2")
     c   = self.node_from_expr("c = 3")
     nlst= NodeList.from_list([a, b, c])
     
     nlst.print_nodes(StdioFile.stdout())
예제 #3
0
 def test_dump(self):
     with StdioFile.stdout() as out:
         a = self.enc.by_name["a"].at_time[2].boolean_expression
         self.mgr.dump_davinci(a, out)
         #SKIPPED: C code randomly causes SEGFAULT.
         #self.mgr.dump_gdl    (a, out)
         self.mgr.dump_sexpr(a, out)
예제 #4
0
 def test_fairness(self):
     model = BmcModel(self.fsm)
     # K, L must be consistent with one another
     with self.assertRaises(ValueError):
         model.fairness(0, 1)
          
     self.assertIsNotNone(model.fairness(3, 0))
     self.assertEqual(Be, type(model.fairness(3, 0)))
     
     # Manual verification, this should output the following formula:
     # (NOT (AND (NOT X3) (AND (NOT X4) (NOT X5))))
     self.enc.manager.dump_sexpr(model.fairness(3, 0), StdioFile.stdout())
예제 #5
0
    def test_print_stats(self):
        # TODO: use another output file and verify the output automatically
        with StdioFile.stdout() as out:
            # constant expr always have zero clauses zero vars
            true = Be.true(self._manager)
            false = Be.false(self._manager)
            TF = true or false
            TF.to_cnf(Polarity.NOT_SET).print_stats(out, "T/F ? => ")
            TF.to_cnf(Polarity.POSITIVE).print_stats(out, "T/F + => ")
            TF.to_cnf(Polarity.NEGATIVE).print_stats(out, "T/F - => ")

            # with variables
            v = self._fsm.encoding.by_name['v'].boolean_expression
            # when polarity is not set, 2 clauses are present
            v.to_cnf(Polarity.NOT_SET).print_stats(out, "Vee ? => ")
            # when polarity is positive there is one single clause
            v.to_cnf(Polarity.POSITIVE).print_stats(out, "Vee + => ")
            # when polarity is negative there is one single clause
            v.to_cnf(Polarity.NEGATIVE).print_stats(out, "Vee - => ")
예제 #6
0
 def test_dump_dimacs(self):
     for prop in prop_database():
         expr    = utils.make_nnf_boolean_wff(prop.expr)
         problem = invarspec.generate_invar_problem(self.fsm, expr)
         invarspec.dump_dimacs(self.fsm.encoding, problem.to_cnf(), StdioFile.stdout())
예제 #7
0
 def test_dump_dimacs(self):
     for prop in prop_database():
         expr = utils.make_nnf_boolean_wff(prop.expr)
         problem = invarspec.generate_invar_problem(self.fsm, expr)
         invarspec.dump_dimacs(self.fsm.encoding, problem.to_cnf(),
                               StdioFile.stdout())
예제 #8
0
 def test_dump_dimacs(self):
     # parse the ltl property
     spec = Node.from_ptr(parse_ltl_spec("G ( y <= 7 )"))
     problem = ltlspec.generate_ltl_problem(self.fsm, spec, bound=10)
     ltlspec.dump_dimacs(self.fsm.encoding, problem.to_cnf(), 10,
                         StdioFile.stdout())
예제 #9
0
 def test_dump_dimacs(self):
     # parse the ltl property
     spec    = Node.from_ptr(parse_ltl_spec("G ( y <= 7 )"))
     problem = ltlspec.generate_ltl_problem(self.fsm, spec, bound=10)
     ltlspec.dump_dimacs(self.fsm.encoding, problem.to_cnf(), 10, StdioFile.stdout())
예제 #10
0
 def test_dump(self):
     with StdioFile.stdout() as out:
         a = self.enc.by_name["a"].at_time[2].boolean_expression
         self.mgr.dump_davinci(a, out)
         self.mgr.dump_gdl    (a, out)
         self.mgr.dump_sexpr  (a, out)