Exemple #1
0
def test_create_decision3():
    obj = ActivityDiagram('ad3')
    obj.create_initial_node('n3')

    decision = DecisionStream()
    decision.create_activity('nda3.1')
    decision.create_transition('ndt3.1', 9.49)
    decision.create_merge('ndm3.1')

    obj.elements.create_decision(decision)

    decision = DecisionStream()
    decision.create_merge('ndm3.2')

    obj.elements.create_decision(decision)

    assert obj.elements.decision_node[0][0].elements[0] == 0
    assert obj.elements.decision_node[0][0].activity_node[0] == 'nda3.1'

    assert (obj.elements.decision_node[0][0].transitions[0].transition_name
            ) == 'ndt3.1'

    assert (obj.elements.decision_node[0][0].transitions[0].transition_prob
            ) == 9.49

    assert obj.elements.decision_node[0][0].elements[1] == 1
    assert obj.elements.decision_node[0][0].merge_node == 'ndm3.1'

    assert obj.elements.decision_node[0][1].elements[0] == 1
    assert obj.elements.decision_node[0][1].merge_node == 'ndm3.2'
Exemple #2
0
def test_create_activity2():
    obj = ActivityDiagram('ad2')

    obj.create_initial_node('n2')
    obj.elements.create_activity('at2')

    assert 'at2' == obj.elements.activity_name[0]
    assert 0 == obj.elements.elements_order[0]
Exemple #3
0
def test_create_transition2():
    obj = ActivityDiagram('ad2')

    obj.create_initial_node('n2')
    obj.create_transitions('t2', 0.09)

    assert 't2' == obj.transitions[0].transition_name
    assert 0.09 == obj.transitions[0].transition_prob
Exemple #4
0
def test_create_transition():
    obj = ActivityDiagram('ad1')

    obj.create_initial_node('n1')
    obj.create_transitions('t1', 0.01)

    assert 't1' == obj.transitions[0].transition_name
    assert 0.01 == obj.transitions[0].transition_prob
Exemple #5
0
def test_create_final2():
    obj = ActivityDiagram('ad2')

    obj.create_initial_node('n2')
    obj.elements.create_final('f2')

    assert 'f2' == obj.elements.final_node
    assert 3 == obj.elements.elements_order[0]
Exemple #6
0
def test_create_merge2():
    obj = ActivityDiagram('ad2')

    obj.create_initial_node('n2')
    obj.elements.create_merge('m2')

    assert 'm2' == obj.elements.merge_node[0]
    assert 2 == obj.elements.elements_order[0]
Exemple #7
0
def test_aux_decision():
    obj = ActivityDiagram('ad1')

    obj.create_initial_node('n1')
    obj.elements.aux_decision()

    assert obj.elements.elements_order[0] == 1
    assert obj.elements.decision_node_number == 1
Exemple #8
0
def test_create_activity3():
    obj = ActivityDiagram('ad3')

    obj.create_initial_node('n3')

    obj.elements.create_activity('at3')
    obj.elements.create_activity('at3.1')

    assert 'at3' == obj.elements.activity_name[0]
    assert 0 == obj.elements.elements_order[0]

    assert 'at3.1' == obj.elements.activity_name[1]
    assert 0 == obj.elements.elements_order[1]
Exemple #9
0
def test_create_transition3():
    obj = ActivityDiagram('ad3')

    obj.create_initial_node('n3')

    obj.create_transitions('t3', 0.90)
    obj.create_transitions('t3.1', 11.44)

    assert 't3' == obj.transitions[0].transition_name
    assert 0.90 == obj.transitions[0].transition_prob

    assert 't3.1' == obj.transitions[1].transition_name
    assert 11.44 == obj.transitions[1].transition_prob
Exemple #10
0
def test_create_merge3():
    obj = ActivityDiagram('ad3')

    obj.create_initial_node('n3')

    obj.elements.create_merge('m3')
    obj.elements.create_merge('m3.1')

    assert 'm3' == obj.elements.merge_node[0]
    assert 2 == obj.elements.elements_order[0]

    assert 'm3.1' == obj.elements.merge_node[1]
    assert 2 == obj.elements.elements_order[1]
Exemple #11
0
def test_create_decision2():
    obj = ActivityDiagram('ad2')
    obj.create_initial_node('n2')

    decision = DecisionStream()
    decision.create_activity('nda2')
    decision.create_transition('ndt2', 9.50)
    decision.create_merge('nm1')

    obj.elements.create_decision(decision)

    assert obj.elements.decision_node[0][0].elements[0] == 0
    assert obj.elements.decision_node[0][0].activity_node[0] == 'nda2'

    assert (obj.elements.decision_node[0][0].transitions[0].transition_name
            ) == 'ndt2'

    assert (obj.elements.decision_node[0][0].transitions[0].transition_prob
            ) == 9.50

    assert obj.elements.decision_node[0][0].elements[1] == 1
    assert obj.elements.decision_node[0][0].merge_node == 'nm1'
Exemple #12
0
def test_create_decision():
    obj = ActivityDiagram('ad1')
    obj.create_initial_node('n1')

    decision = DecisionStream()
    decision.create_activity('nda1')
    decision.create_transition('ndt1', 8.59)
    decision.create_merge('ndm1')

    obj.elements.create_decision(decision)

    assert obj.elements.decision_node[0][0].elements[0] == 0
    assert obj.elements.decision_node[0][0].activity_node[0] == 'nda1'

    assert (obj.elements.decision_node[0][0].transitions[0].transition_name
            ) == 'ndt1'

    assert (obj.elements.decision_node[0][0].transitions[0].transition_prob
            ) == 8.59

    assert obj.elements.decision_node[0][0].elements[1] == 1
    assert obj.elements.decision_node[0][0].merge_node == 'ndm1'
Exemple #13
0
def test_activity_diagram2():
    obj = ActivityDiagram('ad2')
    assert 'ad2' == obj.name
Exemple #14
0
def test_create_initial_node3():
    obj = ActivityDiagram('ad3')
    obj.create_initial_node('n3')
    assert 'n3' == obj.elements.start_node
Exemple #15
0
def test_activity_diagram3():
    obj = ActivityDiagram('ad3')
    assert 'ad3' == obj.name
Exemple #16
0
from activity.activity_diagram import ActivityDiagram
from activity.decision_node import DecisionStream
from activity.exceptions import ActivityRepresentationException
from sequence.create_sequence import create_sequence_diagram
from menu.menu_options import MenuOptions
from menu.transitions_options import TransitionsOptions
from menu.elements_options import ElementsOptions
import os

if __name__ == "__main__":
    opt = input("Deseja criar um novo Diagrama de Atividades (s/n): ")

    if opt[0].lower() == "s":
        name = input("Nome do Diagrama: ")

        act = ActivityDiagram(name)

        while (1):
            os.system("clear")

            option = int(
                input("-- Criação do Diagrama de Atividades --\n" +
                      "1 - Inserir Elementos\n" + "2 - Inserir Transição\n" +
                      "3 - Finalizar Diagrama de Atividade\n" + "-> "))

            if option == 1:
                obj = ElementsOptions(act)

            elif option == 2:
                obj = TransitionsOptions(act)