Ejemplo n.º 1
0
    def test_hashabledict(self):
        hd1 = HashableDict(a=1, b='2', c=3456, abc=0.123456, x='abc')
        hd2 = HashableDict(a=2, b='2', c=3456, abc=0.123456, x='abc')

        set_ = set()
        set_.add(hd1)
        set_.add(hd2)
        set_.add(hd1)

        self.assertEqual(len(set_), 2)
Ejemplo n.º 2
0
 def test_or(self):
     ast = negation_normal_form(parse_ctlq("AF ('admin = bob' | AG ?)"))
     self.assertTrue(check_ctlqx(ast))
     fsm = self.init_model()
     solution = {
         HashableDict({
             'admin': 'alice',
             'state': 'waiting'
         }),
         HashableDict({
             'admin': 'alice',
             'state': 'processing'
         })
     }
     self.assertCountEqual(bdd_to_set(fsm, solve_ctlqx(fsm, ast)), solution)
Ejemplo n.º 3
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()
Ejemplo n.º 4
0
 def test_au(self):
     ast = negation_normal_form(parse_ctlq("A[? U 'state = processing']"))
     self.assertTrue(check_ctlqx(ast))
     fsm = self.init_model()
     solution = {
         HashableDict({
             'admin': 'none',
             'state': 'starting'
         }),
         HashableDict({
             'admin': 'none',
             'state': 'choosing'
         }),
         HashableDict({
             'admin': 'alice',
             'state': 'waiting'
         }),
         HashableDict({
             'admin': 'bob',
             'state': 'waiting'
         })
     }
     self.assertCountEqual(bdd_to_set(fsm, solve_ctlqx(fsm, ast)), solution)
Ejemplo n.º 5
0
 def test_ax(self):
     ast = negation_normal_form(parse_ctlq("AX ?"))
     self.assertTrue(check_ctlqx(ast))
     fsm = self.init_model()
     solution = {HashableDict({'admin': 'none', 'state': 'choosing'})}
     self.assertCountEqual(bdd_to_set(fsm, solve_ctlqx(fsm, ast)), solution)