def test_formula_attribute_setting(self): ap = NamedAtomicProposition("myAP") formula = tctl.And(ap, ap) verifier = verif.Verifier() verifier.formula = formula self.assertEqual(verifier.formula, formula)
def test_formula_attribute_override(self): ap = NamedAtomicProposition("myAP") formula = tctl.And(ap, ap) verifier = verif.Verifier() verifier.formula = ap """The log verification doesn't work. Not sure why.""" # with self.assertLogs('crestdsl.verification.verifier', level='WARNING') as cm: # verifier.formula = formula """for now, just check for exceptions""" verifier.formula = formula self.assertTrue(formula.eq(verifier.formula))
def test_deeply_nested(self): # just for fun :-) ap = tctl.AtomicProposition(None) deepnest = tctl.And(ap, ap) for _ in range(10): deepnest = tctl.And(deepnest, tctl.And(ap, tctl.Or(deepnest, ap))) self.assertCountEqual(deepnest.get_propositions(), [ap])
def test_And_return_parts_avoids_nested_duplicates(self): ap = tctl.AtomicProposition(None) ap2 = tctl.AtomicProposition(None) and_formula = tctl.And(ap, ap2) and_and_formula = tctl.And(ap, and_formula) self.assertCountEqual(and_and_formula.get_propositions(), [ap, ap2])
def test_And_return_parts(self): ap = tctl.AtomicProposition(None) ap2 = tctl.AtomicProposition(None) and_formula = tctl.And(ap, ap2) self.assertCountEqual(and_formula.get_propositions(), [ap, ap2])