Exemplo n.º 1
0
def test_set_new_transtable():

    alphabet = ["a", "b"]
    states = ["1", "2"]

    table = TransitionTable(alphabet, states)
    table.add_transition("a", "2", "2")
    table.add_transition("b", "2", "2")
    table.add_transition("a", "1", "2")
    table.add_transition("b", "1", "1")

    dfa = DFA(table)

    # invalid table
    try:
        dfa.trans_table = {}
    except ValueError:
        pass

    # new table
    new_table = TransitionTable(alphabet, states)
    new_table.add_transition("b", "2", "2")
    new_table.add_transition("a", "1", "2")
    new_table.add_transition("b", "1", "1")

    dfa.trans_table = new_table
Exemplo n.º 2
0
def test_set_new_transtable():

    alphabet = ["a", "b"]
    states = ["1", "2"]

    table = TransitionTable(alphabet, states)
    table.add_transition("a", "2", "2")
    table.add_transition("b", "2", "2")
    table.add_transition("a", "1", "2")
    table.add_transition("b", "1", "1")

    dfa = DFA(table)

    # invalid table
    try:
        dfa.trans_table = {}
    except ValueError:
        pass

    # new table
    new_table = TransitionTable(alphabet, states)
    new_table.add_transition("b", "2", "2")
    new_table.add_transition("a", "1", "2")
    new_table.add_transition("b", "1", "1")

    dfa.trans_table = new_table