Exemple #1
0
 def test_nd_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")
     
     # nD<c1,c2> ~c3.payer
     nds = nd(fsm, ["c1", "c2"], ~c3p)
     self.assertTrue(nds.isnot_false())
     state = fsm.pick_one_state(nds)
     (s, ag, sp) = explain_nd(fsm, state, ["c1", "c2"], ~c3p)
     self.assertEqual(s, state)
     self.assertEqual(ag, {"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)
Exemple #2
0
    def test_nd_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")

        # nD<c1,c2> ~c3.payer
        nds = nd(fsm, ["c1", "c2"], ~c3p)
        self.assertTrue(nds.isnot_false())
        state = fsm.pick_one_state(nds)
        (s, ag, sp) = explain_nd(fsm, state, ["c1", "c2"], ~c3p)
        self.assertEqual(s, state)
        self.assertEqual(ag, {"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)
Exemple #3
0
 def test_nd_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")
     
     # nD<at, af> at.local
     nds = nd(fsm, ["at", "af"], lt)
     self.assertTrue(nds.isnot_false())
     state = fsm.pick_one_state(nds)
     (s, ag, sp) = explain_nd(fsm, state, ["at", "af"], lt)
     self.assertEqual(s, state)
     self.assertEqual(ag, {"at", "af"})
     self.assertTrue(sp <= lt)
     self.assertTrue((sp <= fsm.equivalent_states(state, {"at"})) &
                     (sp <= fsm.equivalent_states(state, {"af"})))
     self.assertTrue(sp <= fsm.reachable_states)
Exemple #4
0
    def test_nd_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")

        # nD<at, af> at.local
        nds = nd(fsm, ["at", "af"], lt)
        self.assertTrue(nds.isnot_false())
        state = fsm.pick_one_state(nds)
        (s, ag, sp) = explain_nd(fsm, state, ["at", "af"], lt)
        self.assertEqual(s, state)
        self.assertEqual(ag, {"at", "af"})
        self.assertTrue(sp <= lt)
        self.assertTrue((sp <= fsm.equivalent_states(state, {"at"}))
                        & (sp <= fsm.equivalent_states(state, {"af"})))
        self.assertTrue(sp <= fsm.reachable_states)