def test_bmc_setup(self): # pre conditions not satisfied # model must be loaded with self.assertRaises(NuSMVNeedBooleanModelError): bmcglob.bmc_setup() # vars need to be encoded load(self.model()) with self.assertRaises(NuSMVNeedBooleanModelError): bmcglob.bmc_setup() # boolean model must be compiled out of the sexp flatten_hierarchy() with self.assertRaises(NuSMVNeedBooleanModelError): bmcglob.bmc_setup() # hierarchy must be flattened (actually, this is a requirement for the # boolean model too) encode_variables() with self.assertRaises(NuSMVNeedBooleanModelError): bmcglob.bmc_setup() # may not be called 2 times build_boolean_model() with self.assertRaises(NuSMVBmcAlreadyInitializedError): bmcglob.bmc_setup() bmcglob.bmc_setup() # even if the force flag is on (that's COI related) with self.assertRaises(NuSMVBmcAlreadyInitializedError): bmcglob.bmc_setup(force=True) bmcglob.bmc_exit()
def test_sets_the_global_values(self): glob.flatten_hierarchy() glob.encode_variables() with self.assertRaises(NuSMVNeedBooleanModelError): glob.master_bool_sexp_fsm() glob.build_boolean_model() self.assertIsNotNone(glob.master_bool_sexp_fsm())
def test_master_be_fsm(self): load(self.model()) flatten_hierarchy() encode_variables() build_boolean_model() bmcglob.bmc_setup() # may not provoke C assert failures bmcglob.build_master_be_fsm() self.assertEqual(bmcglob.master_be_fsm(), BeFsm.global_master_instance()) bmcglob.bmc_exit()
def test_build_master_be_fsm(self): load(self.model()) flatten_hierarchy() encode_variables() build_boolean_model() bmcglob.bmc_setup() # may not provoke C assert failures bmcglob.build_master_be_fsm() bmcglob.bmc_exit()
def go_bmc(force=False): """ Performs all the necessary steps to use loaded model and be able to perform bmc related operations on it. :raises NuSMVNoReadModelError: if no module was read (:see:`glob.load`) before this method was called. """ cmp = glob.global_compile_cmps() if not _compile.cmp_struct_get_read_model(cmp): raise NuSMVNoReadModelError("No read model.") # Check cmps and perform what is needed if not _compile.cmp_struct_get_flatten_hrc(cmp): glob.flatten_hierarchy() if not _compile.cmp_struct_get_encode_variables(cmp): glob.encode_variables() if not _compile.cmp_struct_get_build_bool_model(cmp): glob.build_boolean_model(force=force) if not _compile.cmp_struct_get_bmc_setup(cmp): bmc_setup(force=force)
def go_bmc(force=False): """ Performs all the necessary steps to use loaded model and be able to perform bmc related operations on it. :raises NuSMVNoReadModelError: if no module was read (:func:`pynusmv.glob.load`) before this method was called. """ cmp = glob.global_compile_cmps() if not _compile.cmp_struct_get_read_model(cmp): raise NuSMVNoReadModelError("No read model.") # Check cmps and perform what is needed if not _compile.cmp_struct_get_flatten_hrc(cmp): glob.flatten_hierarchy() if not _compile.cmp_struct_get_encode_variables(cmp): glob.encode_variables() if not _compile.cmp_struct_get_build_bool_model(cmp): glob.build_boolean_model(force=force) if not _compile.cmp_struct_get_bmc_setup(cmp): bmc_setup(force=force)
def test_must_not_be_already_built_unless_force_flag(self): glob.flatten_hierarchy() glob.encode_variables() glob.build_boolean_model() glob.build_boolean_model(force=True)
def test_must_not_be_already_built(self): glob.flatten_hierarchy() glob.encode_variables() glob.build_boolean_model() with self.assertRaises(NuSMVModelAlreadyBuiltError): glob.build_boolean_model()
def test_vars_must_be_encoded(self): glob.flatten_hierarchy() with self.assertRaises(NuSMVNeedVariablesEncodedError): glob.build_boolean_model()