Exemple #1
0
    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()
Exemple #2
0
    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()
Exemple #3
0
 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()
Exemple #4
0
    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()
Exemple #5
0
 def tearDown(self):
     deinit_nusmv()
Exemple #6
0
    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()
Exemple #7
0
 def postloop(self):
     deinit_nusmv()
 def tearDown(self):
     glob.reset_globals()
     deinit_nusmv()
Exemple #9
0
 def tearDown(self):
     deinit_nusmv()
Exemple #10
0
 def test_init_deinit_stats(self):
     init_nusmv()
     deinit_nusmv(ddinfo=True)
Exemple #11
0
 def postloop(self):
     deinit_nusmv()
Exemple #12
0
 def __exit__(self, type_, value, traceback):
     """Performs what one would usually do in tearDown"""
     bmc_exit()
     deinit_nusmv()
Exemple #13
0
 def __exit__(self, type_, value, traceback):
     """Performs what one would usually do in tearDown"""
     bmc_exit()
     deinit_nusmv()
Exemple #14
0
 def tearDown(self):
     glob.reset_globals()
     deinit_nusmv()
Exemple #15
0
 def tearDown(self):
     bmc_exit()
     deinit_nusmv()
Exemple #16
0
 def tearDown(self):
     bmc_exit()
     deinit_nusmv()
Exemple #17
0
 def test_two_init(self):
     with self.assertRaises(NuSMVInitError):
         init_nusmv()
         init_nusmv()
     deinit_nusmv()