Ejemplo n.º 1
0
    def test_fig_16(self):

        i_grammar = FunctionIndexedGrammar([self.functions[x] for x in [0, 19]],
                                           [["b", "a"]])
        self.assertFalse(i_grammar.is_empty())

        i_grammar.update([["a", "b"]])
        self.assertTrue(i_grammar.is_empty())
Ejemplo n.º 2
0
    def test_mif_10(self):

        i_grammar = FunctionIndexedGrammar(
            [self.functions[x] for x in [2, 3, 4, 5]], [["b"]])
        self.assertFalse(i_grammar.is_empty())

        i_grammar.update([["b"]])
        self.assertFalse(i_grammar.is_empty())

        i_grammar.update([["c"]])
        self.assertFalse(i_grammar.is_empty())

        i_grammar.update([["e"]])
        self.assertTrue(i_grammar.is_empty())
Ejemplo n.º 3
0
    def test_fig_40(self):

        i_grammar = FunctionIndexedGrammar([self.tree_functions[x] for x in [9]] +
                                           [self.functions[x] for x in [37, 38, 39, 40]],
                                           [["d", "b"]])

        self.assertFalse(i_grammar.is_empty())
Ejemplo n.º 4
0
    def test_fig_39(self):

        i_grammar = FunctionIndexedGrammar([self.tree_functions[x] for x in [8]] +
                                           [self.functions[x] for x in [34, 35, 36]],
                                           [["b"]])

        self.assertFalse(i_grammar.is_empty())
Ejemplo n.º 5
0
    def test_fig_23(self):

        i_grammar = FunctionIndexedGrammar([self.tree_functions[x] for x in [0]] +
                                           [self.functions[x] for x in [25]],
                                           [["c"]])

        self.assertTrue(i_grammar.is_empty())
Ejemplo n.º 6
0
    def test_fig_30(self):

        i_grammar = FunctionIndexedGrammar([self.tree_functions[x] for x in [1]] +
                                           [self.functions[x] for x in [30, 31]],
                                           [["d"]])

        self.assertFalse(i_grammar.is_empty())
Ejemplo n.º 7
0
    def test_fig_25(self):

        i_grammar = FunctionIndexedGrammar([self.tree_functions[x] for x in [2]] +
                                           [self.functions[x] for x in [25, 26, 6, 27]],
                                           [["q"]])

        self.assertFalse(i_grammar.is_empty())
Ejemplo n.º 8
0
    def test_fig_20(self):

        i_grammar = FunctionIndexedGrammar([self.functions[x] for x in [20]],
                                           [["c", "q"]],
                                           eq_rules=[self.equivalence_rules[x] for x in [1]])

        self.assertFalse(i_grammar.is_empty())
Ejemplo n.º 9
0
    def test_fig_21(self):

        i_grammar = FunctionIndexedGrammar([self.functions[x] for x in [21, 22]],
                                           [["a", "c", "b", "d"]],
                                           eq_rules=[])

        self.assertTrue(i_grammar.is_empty())
Ejemplo n.º 10
0
    def test_fig_38(self):

        i_grammar = FunctionIndexedGrammar([self.functions[x] for x in [32, 33]],
                                           [["a", "c", "d", "b"]],
                                           eq_rules=[self.equivalence_rules[x] for x in [4]])

        self.assertFalse(i_grammar.is_empty())
Ejemplo n.º 11
0
    def test_fig_31(self):

        i_grammar = FunctionIndexedGrammar([self.tree_functions[x] for x in [0]] +
                                           [self.functions[x] for x in [28]],
                                           [["a", "c"]])

        self.assertFalse(i_grammar.is_empty())
Ejemplo n.º 12
0
    def test_fig_29(self):

        i_grammar = FunctionIndexedGrammar([self.tree_functions[x] for x in [4, 5, 6, 7]],
                                           [["a"]])

        self.assertFalse(i_grammar.is_empty())
Ejemplo n.º 13
0
    def test_mif_26(self):

        i_grammar = FunctionIndexedGrammar([self.functions[x] for x in [24]] +
                                           [self.mifunctions[x] for x in [3]],
                                           [["c", "d"]])
        self.assertTrue(i_grammar.is_empty())
Ejemplo n.º 14
0
    def test_fig_15(self):

        i_grammar = FunctionIndexedGrammar([self.functions[x] for x in [16, 17, 18, 19]],
                                           [["a"]])
        self.assertFalse(i_grammar.is_empty())
Ejemplo n.º 15
0
    def test_fig_14(self):

        i_grammar = FunctionIndexedGrammar([self.functions[x] for x in [14, 15]],
                                           [["q"]])

        self.assertTrue(i_grammar.is_empty())
Ejemplo n.º 16
0
    def test_fig_13(self):

        i_grammar = FunctionIndexedGrammar([self.functions[x] for x in [12, 13]],
                                           [["xm"]])
        # empty without subfunctions
        self.assertTrue(i_grammar.is_empty())
Ejemplo n.º 17
0
    def test_mif_6(self):

        i_grammar = FunctionIndexedGrammar([self.functions[x] for x in [2, 7]],
                                           [["b"]])
        self.assertFalse(i_grammar.is_empty())
Ejemplo n.º 18
0
    def test_mif_5(self):

        i_grammar = FunctionIndexedGrammar([self.functions[x] for x in [1]],
                                           [["b"]])
        self.assertTrue(i_grammar.is_empty())
Ejemplo n.º 19
0
    def test_mif_24(self):

        i_grammar = FunctionIndexedGrammar([self.functions[x] for x in [25]] +
                                           [self.mifunctions[x] for x in [2]],
                                           [["b", "c"]])
        self.assertTrue(i_grammar.is_empty())
Ejemplo n.º 20
0
    def test_fig_32(self):

        i_grammar = FunctionIndexedGrammar([self.tree_functions[x] for x in [6]],
                                           [["c-"]])

        self.assertTrue(i_grammar.is_empty())
Ejemplo n.º 21
0
    def test_mif_25(self):

        i_grammar = FunctionIndexedGrammar([self.functions[x] for x in [26]] +
                                           [self.mifunctions[x] for x in [3]],
                                           [["d"]])
        self.assertFalse(i_grammar.is_empty())
Ejemplo n.º 22
0
    def test_mif_21(self):

        i_grammar = FunctionIndexedGrammar(
            [self.functions[x]
             for x in [21, 22]] + [self.mifunctions[x] for x in [0]], [["q"]])
        self.assertFalse(i_grammar.is_empty())
Ejemplo n.º 23
0
    def test_mif_22(self):

        i_grammar = FunctionIndexedGrammar(
            [self.functions[x]
             for x in [21, 23]] + [self.mifunctions[x] for x in [1]], [["q"]])
        self.assertTrue(i_grammar.is_empty())
Ejemplo n.º 24
0
    def test_fig_1(self):

        i_grammar = FunctionIndexedGrammar([self.functions[x] for x in [9, 5]], [["b"]])
        self.assertFalse(i_grammar.is_empty())
Ejemplo n.º 25
0
    def test_fig_19(self):

        i_grammar = FunctionIndexedGrammar([self.functions[x] for x in [20]],
                                           [["c"], ["query", "c"]])
        self.assertFalse(i_grammar.is_empty())