Ejemplo n.º 1
0
 def test_ne_dincry(self):
     fsm = self.model()
     
     c1p = eval_simple_expression(fsm, "c1.payer")
     c2p = eval_simple_expression(fsm, "c2.payer")
     c3p = eval_simple_expression(fsm, "c3.payer")
     c1h = eval_simple_expression(fsm, "c1.coin = head")
     c2h = eval_simple_expression(fsm, "c2.coin = head")
     c3h = eval_simple_expression(fsm, "c3.coin = head")
     odd = eval_simple_expression(fsm, "countsay = odd")
     even = eval_simple_expression(fsm, "countsay = even")
     unk = eval_simple_expression(fsm, "countsay = unknown")
     true = eval_simple_expression(fsm, "TRUE")
     false = eval_simple_expression(fsm, "FALSE")
     
     # nE<c1,c2> ~c3.payer
     nes = ne(fsm, ["c1", "c2"], ~c3p)
     self.assertTrue(nes.isnot_false())
     state = fsm.pick_one_state(nes)
     (s, ag, sp) = explain_ne(fsm, state, ["c1", "c2"], ~c3p)
     self.assertEqual(s, state)
     self.assertTrue(ag in [{"c1"}, {"c2"}])
     self.assertTrue(sp <= ~c3p)
     self.assertTrue((sp <= fsm.equivalent_states(state, {"c1"})) |
                     (sp <= fsm.equivalent_states(state, {"c2"})))
     self.assertTrue(sp <= fsm.reachable_states)
Ejemplo n.º 2
0
    def test_ne_dincry(self):
        fsm = self.model()

        c1p = eval_simple_expression(fsm, "c1.payer")
        c2p = eval_simple_expression(fsm, "c2.payer")
        c3p = eval_simple_expression(fsm, "c3.payer")
        c1h = eval_simple_expression(fsm, "c1.coin = head")
        c2h = eval_simple_expression(fsm, "c2.coin = head")
        c3h = eval_simple_expression(fsm, "c3.coin = head")
        odd = eval_simple_expression(fsm, "countsay = odd")
        even = eval_simple_expression(fsm, "countsay = even")
        unk = eval_simple_expression(fsm, "countsay = unknown")
        true = eval_simple_expression(fsm, "TRUE")
        false = eval_simple_expression(fsm, "FALSE")

        # nE<c1,c2> ~c3.payer
        nes = ne(fsm, ["c1", "c2"], ~c3p)
        self.assertTrue(nes.isnot_false())
        state = fsm.pick_one_state(nes)
        (s, ag, sp) = explain_ne(fsm, state, ["c1", "c2"], ~c3p)
        self.assertEqual(s, state)
        self.assertTrue(ag in [{"c1"}, {"c2"}])
        self.assertTrue(sp <= ~c3p)
        self.assertTrue((sp <= fsm.equivalent_states(state, {"c1"}))
                        | (sp <= fsm.equivalent_states(state, {"c2"})))
        self.assertTrue(sp <= fsm.reachable_states)
Ejemplo n.º 3
0
 def test_ne_simple(self):
     fsm = self.simplemodel()
     
     lt = eval_simple_expression(fsm, "at.local")
     lf = eval_simple_expression(fsm, "af.local")
     g = eval_simple_expression(fsm, "global")
     true = eval_simple_expression(fsm, "TRUE")
     false = eval_simple_expression(fsm, "FALSE")
     
     # nE<at, af> g
     nes = ne(fsm, ["at", "af"], g)
     self.assertTrue(nes.isnot_false())
     state = fsm.pick_one_state(nes)
     (s, ag, sp) = explain_ne(fsm, state, ["at", "af"], g)
     self.assertEqual(s, state)
     self.assertTrue(ag in [{"at"}, {"af"}])
     self.assertTrue(sp <= g)
     self.assertTrue((sp <= fsm.equivalent_states(state, {"at"})) |
                     (sp <= fsm.equivalent_states(state, {"af"})))
     self.assertTrue(sp <= fsm.reachable_states)
Ejemplo n.º 4
0
    def test_ne_simple(self):
        fsm = self.simplemodel()

        lt = eval_simple_expression(fsm, "at.local")
        lf = eval_simple_expression(fsm, "af.local")
        g = eval_simple_expression(fsm, "global")
        true = eval_simple_expression(fsm, "TRUE")
        false = eval_simple_expression(fsm, "FALSE")

        # nE<at, af> g
        nes = ne(fsm, ["at", "af"], g)
        self.assertTrue(nes.isnot_false())
        state = fsm.pick_one_state(nes)
        (s, ag, sp) = explain_ne(fsm, state, ["at", "af"], g)
        self.assertEqual(s, state)
        self.assertTrue(ag in [{"at"}, {"af"}])
        self.assertTrue(sp <= g)
        self.assertTrue((sp <= fsm.equivalent_states(state, {"at"}))
                        | (sp <= fsm.equivalent_states(state, {"af"})))
        self.assertTrue(sp <= fsm.reachable_states)