def test_ast_to_spec(self): queries = ["?", "~?", "'request' & ?", "? | 'state = ready'", "? -> '!request'", "'state = busy' <-> ?", "AX ?", "AF ?", "AG ?", "EX ?", "EF ?", "EG ?", "A[True U ?]", "A[? W False]", "E[? U True]", "E[False W ?]", "A[False oU ?]", "A[? oW True]", "A[True dU ?]", "A[? dW False]", "E[False oU ?]", "E[? oW True]", "E[True dU ?]", "E[? dW False]"] for query in queries: init_nusmv() self.init_model() self.assertIsInstance(ast_to_spec(replace(parse_ctlq(query), TrueExp())), Spec) deinit_nusmv()
def test_bdd_to_set(self): set_ = {HashableDict({'state': 'ready', 'request': 'TRUE'}), HashableDict({'state': 'ready', 'request': 'FALSE'})} init_nusmv() fsm = self.init_model() self.assertEqual(bdd_to_set(fsm, fsm.init), set_) deinit_nusmv()
def test_init(self): init_nusmv() # Should not produce error fsm = BddFsm.from_filename("tests/pynusmv/models/admin.smv") reset_nusmv() # Should not produce error fsm = BddFsm.from_filename("tests/pynusmv/models/admin.smv") deinit_nusmv()
def test_gc(self): """ This test should not produce a segfault due to freed memory after deiniting NuSMV. This is thanks to the PyNuSMV GC system that keeps track of all wrapped pointers and free them when deiniting NuSMV, if needed. """ init_nusmv() fsm = BddFsm.from_filename("tests/pynusmv/models/admin.smv") init = fsm.init deinit_nusmv()
def tearDown(self): deinit_nusmv()
parser.add_argument('model', help='the NuSMV model with specifications') args = parser.parse_args(allargs) # Initialize the model fsm = BddFsm.from_filename(args.model) propDb = glob.prop_database() # Check all CTL properties for prop in propDb: # Check type if prop.type == propTypes['CTL']: spec = prop.exprcore (satisfied, cntex) = check_ctl_spec(fsm, spec) # Print the result and the TLACE if any print('Specification',str(spec), 'is', str(satisfied), file=sys.stderr) if not satisfied: print(xml_representation(fsm, cntex, spec)) print() if __name__ == '__main__': # Initialize NuSMV init_nusmv() check_and_explain(sys.argv[1:]) # Quit NuSMV deinit_nusmv()
def postloop(self): deinit_nusmv()
def tearDown(self): glob.reset_globals() deinit_nusmv()
def test_init_deinit_stats(self): init_nusmv() deinit_nusmv(ddinfo=True)
def __exit__(self, type_, value, traceback): """Performs what one would usually do in tearDown""" bmc_exit() deinit_nusmv()
def tearDown(self): bmc_exit() deinit_nusmv()
def test_two_init(self): with self.assertRaises(NuSMVInitError): init_nusmv() init_nusmv() deinit_nusmv()