def test_aax(self): fsm = self.init_model() spec = parseArctl("A<'run = rc1'>X 'c1.c = 1'")[0] self.assertTrue(checkArctl(fsm, spec)[0]) spec = parseArctl("A<'run = rc1'>X 'c2.c = 1'")[0] self.assertFalse(checkArctl(fsm, spec)[0])
def test_atom(self): fsm = self.init_model() spec = parseArctl("'c1.c = 0'")[0] self.assertTrue(checkArctl(fsm, spec)) spec = parseArctl("'c2.c = 1'")[0] self.assertFalse(checkArctl(fsm, spec)[0])
def test_x(self): fsm = self.init_model() spec = parseArctl("E<'FALSE'>X 'TRUE'")[0] self.assertFalse(checkArctl(fsm, spec)[0]) spec = parseArctl("A<'FALSE'>X 'TRUE'")[0] self.assertFalse(checkArctl(fsm, spec)[0]) spec = parseArctl("~E<'FALSE'>X 'TRUE'")[0] self.assertTrue(checkArctl(fsm, spec)[0])
def do_check(self, arg): """ Check an ARCTL specification on the current FSM. usage: check SPEC """ if self.fsm is None: print("[ERROR] No FSM read. Use read command before.") elif arg == "": print("[ERROR] Need a specification.") else: try: spec = parseArctl(arg)[0] (res, (wit, (inp, loop))) = checkArctl(self.fsm, spec) if res: print("The specification", arg, "is true,", "witnessed by") #print_path(wit, inp, loop) else: print("The specification", arg, "is false,", "as shown by") #print_path(wit, inp, loop) except PyNuSMVError as e: print("[ERROR]", e) except ParseException as e: print("[ERROR]", e)
def do_check(self, arg): """ Check an ARCTL specification on the current FSM. usage: check SPEC """ if self.fsm is None: print("[ERROR] No FSM read. Use read command before.") elif arg == "": print("[ERROR] Need a specification.") else: try: spec = parseArctl(arg)[0] (res, wit) = checkArctl(self.fsm, spec, explain_witness, explain_countex) if res: print("The specification", arg, "is true,", "witnessed by") print(xml_representation(self.fsm, wit, spec)) else: print("The specification", arg, "is false,", "as shown by") print(xml_representation(self.fsm, wit, spec)) except PyNuSMVError as e: print("[ERROR]", e) except ParseException as e: print("[ERROR]", e)
def test_full_finite(self): fsm = self.init_finite_model() spec = parseArctl("A<'TRUE'>F (~ E<'TRUE'>X 'TRUE')")[0] (result, expl) = checkArctl(fsm, spec, explain_witness, explain_countex) self.assertTrue(result)
def test_full(self): fsm = self.init_model() spec = parseArctl("A<'run = rc1'>[" "E<'TRUE'>G 'c1.c < 3' W " "A<'TRUE'>X 'c1.c = 0' ]")[0] (result, expl) = checkArctl(fsm, spec, explain_witness, explain_countex) self.assertTrue(result)
def test_full_finite(self): fsm = self.init_finite_model() spec = parseArctl("A<'TRUE'>F (~ E<'TRUE'>X 'TRUE')")[0] (result, expl) = checkArctl(fsm, spec, explain_witness, explain_countex) self.assertTrue(result) self.assertIsNotNone(xml_representation(fsm, expl, spec)) print(xml_representation(fsm, expl, spec))
def test_full(self): fsm = self.init_model() spec = parseArctl("A<'run = rc1'>[" "E<'TRUE'>G 'c1.c < 3' W " "A<'TRUE'>X 'c1.c = 0' ]")[0] (result, expl) = checkArctl(fsm, spec, explain_witness, explain_countex) self.assertTrue(result) self.assertIsNotNone(xml_representation(fsm, expl, spec)) print(xml_representation(fsm, expl, spec))