def test_check_violated_spec(self): # Initialize the model ret = cmd.Cmd_SecureCommandExecute( "read_model -i " "tests/pynusmv_tools/tlace/admin.smv") self.assertEqual(ret, 0, "cannot read the model") ret = cmd.Cmd_SecureCommandExecute("go") self.assertEqual(ret, 0, "cannot build the model") propDb = glob.prop_database() master = propDb.master fsm = propDb.master.bddFsm self.assertTrue(propDb.get_size() >= 1, "propDb has no properties") prop = propDb.get_prop_at_index(0) spec = prop.exprcore res = check(fsm, spec) self.assertFalse(res[0], "spec should be violated") self.assertIsNotNone(res[1], "TLACE should be given")
def test_check_satisfied_spec(self): # Initialize the model ret = cmd.Cmd_SecureCommandExecute( "read_model -i" "tests/pynusmv_tools/tlace/admin.smv") self.assertEqual(ret, 0, "cannot read the model") ret = cmd.Cmd_SecureCommandExecute("go") self.assertEqual(ret, 0, "cannot build the model") propDb = glob.prop_database() master = propDb.master fsm = propDb.master.bddFsm self.assertTrue(propDb.get_size() >= 3, "propDb misses some props") prop = propDb.get_prop_at_index(2) self.assertIsNotNone(prop, "prop should not be None") spec = prop.exprcore res = check(fsm, spec) self.assertTrue(res[0], "spec should be satisfied") self.assertIsNone(res[1], "TLACE should not exist")
def test_print_violated_spec_admin_ax(self): # Initialize the model ret = cmd.Cmd_SecureCommandExecute( "read_model -i " "tests/pynusmv_tools/tlace/admin.smv") self.assertEqual(ret, 0, "cannot read the model") ret = cmd.Cmd_SecureCommandExecute("go") self.assertEqual(ret, 0, "cannot build the model") propDb = glob.prop_database() master = propDb.master fsm = propDb.master.bddFsm self.assertTrue(len(propDb) >= 6, "propDb has no properties") prop = propDb[5] spec = prop.exprcore res = check(fsm, spec) self.assertFalse(res[0], "spec should be violated") self.assertIsNotNone(res[1], "TLACE should be given") print(xml_representation(fsm, res[1], spec))