|
@@ -7,58 +7,66 @@ from utils import execute, kill, run_file, run_barebone
|
|
|
bottom = [
|
|
|
"model",
|
|
|
"instantiate_bottom", "1",
|
|
|
+ "add_node", "1", "Element",
|
|
|
"add_node", "1", "Class",
|
|
|
- "add_node", "1", "Any",
|
|
|
+ "add_node", "1", "AttributeValue",
|
|
|
"add_node", "1", "String",
|
|
|
- "add_value", "1", "name", "name",
|
|
|
- "add_edge", "1", "Association", "Class", "Any",
|
|
|
- "add_edge", "1", "Inheritance", "Class", "Class",
|
|
|
- "add_edge", "1", "Association_attribute", "Association", "String",
|
|
|
- "add_edge", "1", "Association_name", "Association_attribute", "name",
|
|
|
- "add_edge", "1", "assoc_inh_class", "Association", "Class",
|
|
|
- "add_edge", "1", "class_inh_any", "Class", "Any",
|
|
|
- "add_edge", "1", "string_inh_any", "String", "Any",
|
|
|
+ "add_value", "1", "name_value", "name",
|
|
|
+ "add_edge", "1", "Association", "Class", "Class",
|
|
|
+ "add_edge", "1", "Inheritance", "Element", "Element",
|
|
|
+ "add_edge", "1", "Attribute", "Element", "AttributeValue",
|
|
|
+ "add_edge", "1", "attr_name", "Attribute", "String",
|
|
|
+ "add_edge", "1", "attr_name_name", "attr_name", "name_value",
|
|
|
+ "add_edge", "1", "class_inh_element", "Class", "Element",
|
|
|
+ "add_edge", "1", "attributevalue_inh_element", "AttributeValue", "Element",
|
|
|
+ "add_edge", "1", "association_inh_class", "Association", "Class",
|
|
|
+ "add_edge", "1", "attribute_inh_attributevalue", "Attribute", "AttributeValue",
|
|
|
+
|
|
|
"retype_model", "1", "1",
|
|
|
+ "retype", "1", "Element", "Class",
|
|
|
"retype", "1", "Class", "Class",
|
|
|
- "retype", "1", "Any", "Class",
|
|
|
- "retype", "1", "String", "Class",
|
|
|
- "retype", "1", "name", "String",
|
|
|
+ "retype", "1", "AttributeValue", "Class",
|
|
|
+ "retype", "1", "String", "AttributeValue",
|
|
|
+ "retype", "1", "name_value", "String",
|
|
|
"retype", "1", "Association", "Association",
|
|
|
"retype", "1", "Inheritance", "Association",
|
|
|
- "retype", "1", "Association_attribute", "Association",
|
|
|
- "retype", "1", "Association_name", "Association_attribute",
|
|
|
- "retype", "1", "assoc_inh_class", "Inheritance",
|
|
|
- "retype", "1", "class_inh_any", "Inheritance",
|
|
|
- "retype", "1", "string_inh_any", "Inheritance",
|
|
|
- "export_node", "1", "models/SimpleClassDiagrams",
|
|
|
+ "retype", "1", "Attribute", "Association",
|
|
|
+ "retype", "1", "attr_name", "Attribute",
|
|
|
+ "retype", "1", "attr_name_name", "attr_name",
|
|
|
+ "retype", "1", "class_inh_element", "Inheritance",
|
|
|
+ "retype", "1", "attributevalue_inh_element", "Inheritance",
|
|
|
+ "retype", "1", "association_inh_class", "Inheritance",
|
|
|
+ "retype", "1", "attribute_inh_attributevalue", "Inheritance",
|
|
|
+
|
|
|
+ "export_node", "1", "models/SimpleClassDiagrams_new",
|
|
|
"exit",
|
|
|
]
|
|
|
|
|
|
action_language = [
|
|
|
"model",
|
|
|
- "instantiate_node", "1", "Class", "Action",
|
|
|
- "instantiate_node", "1", "Class", "Statement",
|
|
|
- "instantiate_node", "1", "Class", "Expression",
|
|
|
- "instantiate_node", "1", "Class", "funcdef",
|
|
|
- "instantiate_node", "1", "Class", "param",
|
|
|
- "instantiate_node", "1", "Class", "if",
|
|
|
- "instantiate_node", "1", "Class", "break",
|
|
|
- "instantiate_node", "1", "Class", "while",
|
|
|
- "instantiate_node", "1", "Class", "continue",
|
|
|
- "instantiate_node", "1", "Class", "assign",
|
|
|
- "instantiate_node", "1", "Class", "return",
|
|
|
- "instantiate_node", "1", "Class", "output",
|
|
|
- "instantiate_node", "1", "Class", "declare",
|
|
|
- "instantiate_node", "1", "Class", "global",
|
|
|
- "instantiate_node", "1", "Class", "access",
|
|
|
- "instantiate_node", "1", "Class", "constant",
|
|
|
- "instantiate_node", "1", "Class", "input",
|
|
|
- "instantiate_node", "1", "Class", "resolve",
|
|
|
- "instantiate_node", "1", "Class", "call",
|
|
|
- "instantiate_link", "1", "Association", "dict_link", "Action", "Any",
|
|
|
+ "instantiate_node", "1", "AttributeValue", "Action",
|
|
|
+ "instantiate_node", "1", "AttributeValue", "Statement",
|
|
|
+ "instantiate_node", "1", "AttributeValue", "Expression",
|
|
|
+ "instantiate_node", "1", "AttributeValue", "funcdef",
|
|
|
+ "instantiate_node", "1", "AttributeValue", "param",
|
|
|
+ "instantiate_node", "1", "AttributeValue", "if",
|
|
|
+ "instantiate_node", "1", "AttributeValue", "break",
|
|
|
+ "instantiate_node", "1", "AttributeValue", "while",
|
|
|
+ "instantiate_node", "1", "AttributeValue", "continue",
|
|
|
+ "instantiate_node", "1", "AttributeValue", "assign",
|
|
|
+ "instantiate_node", "1", "AttributeValue", "return",
|
|
|
+ "instantiate_node", "1", "AttributeValue", "output",
|
|
|
+ "instantiate_node", "1", "AttributeValue", "declare",
|
|
|
+ "instantiate_node", "1", "AttributeValue", "global",
|
|
|
+ "instantiate_node", "1", "AttributeValue", "access",
|
|
|
+ "instantiate_node", "1", "AttributeValue", "constant",
|
|
|
+ "instantiate_node", "1", "AttributeValue", "input",
|
|
|
+ "instantiate_node", "1", "AttributeValue", "resolve",
|
|
|
+ "instantiate_node", "1", "AttributeValue", "call",
|
|
|
+ "instantiate_link", "1", "Association", "dict_link", "Action", "Element",
|
|
|
"instantiate_link", "1", "Association", "to_str", "dict_link", "String",
|
|
|
"instantiate_attribute", "1", "to_str", "name", "name",
|
|
|
- "instantiate_link", "1", "Inheritance", "", "Action", "Any",
|
|
|
+ "instantiate_link", "1", "Inheritance", "", "Action", "Element",
|
|
|
"instantiate_link", "1", "Inheritance", "", "funcdef", "Action",
|
|
|
"instantiate_link", "1", "Inheritance", "", "param", "Action",
|
|
|
"instantiate_link", "1", "Inheritance", "", "Statement", "Action",
|
|
@@ -77,51 +85,51 @@ action_language = [
|
|
|
"instantiate_link", "1", "Inheritance", "", "access", "Expression",
|
|
|
"instantiate_link", "1", "Inheritance", "", "constant", "Expression",
|
|
|
"instantiate_link", "1", "Inheritance", "", "input", "Expression",
|
|
|
- "instantiate_link", "1", "Association", "statement_next", "Statement", "Statement",
|
|
|
+ "instantiate_link", "1", "Attribute", "statement_next", "Statement", "Statement",
|
|
|
+ "instantiate_link", "1", "Attribute", "if_cond", "if", "Expression",
|
|
|
+ "instantiate_link", "1", "Attribute", "if_then", "if", "Statement",
|
|
|
+ "instantiate_link", "1", "Attribute", "if_else", "if", "Statement",
|
|
|
+ "instantiate_link", "1", "Attribute", "while_cond", "while", "Expression",
|
|
|
+ "instantiate_link", "1", "Attribute", "while_body", "while", "Statement",
|
|
|
+ "instantiate_link", "1", "Attribute", "assign_var", "assign", "Element",
|
|
|
+ "instantiate_link", "1", "Attribute", "assign_value", "assign", "Expression",
|
|
|
+ "instantiate_link", "1", "Attribute", "break_while", "break", "while",
|
|
|
+ "instantiate_link", "1", "Attribute", "continue_while", "continue", "while",
|
|
|
+ "instantiate_link", "1", "Attribute", "return_value", "return", "Expression",
|
|
|
+ "instantiate_link", "1", "Attribute", "resolve_var", "resolve", "Element",
|
|
|
+ "instantiate_link", "1", "Attribute", "access_var", "access", "Element",
|
|
|
+ "instantiate_link", "1", "Attribute", "constant_node", "constant", "Element",
|
|
|
+ "instantiate_link", "1", "Attribute", "output_node", "output", "Expression",
|
|
|
+ "instantiate_link", "1", "Attribute", "global_var", "global", "String",
|
|
|
+ "instantiate_link", "1", "Attribute", "param_name", "param", "String",
|
|
|
+ "instantiate_link", "1", "Attribute", "param_value", "param", "Expression",
|
|
|
+ "instantiate_link", "1", "Attribute", "param_next_param", "param", "param",
|
|
|
+ "instantiate_link", "1", "Attribute", "funcdef_body", "funcdef", "Statement",
|
|
|
+ "instantiate_link", "1", "Attribute", "call_func", "call", "Expression",
|
|
|
+ "instantiate_link", "1", "Attribute", "call_params", "call", "param",
|
|
|
+ "instantiate_link", "1", "Attribute", "call_last_param", "call", "param",
|
|
|
"instantiate_attribute", "1", "statement_next", "name", "next",
|
|
|
- "instantiate_link", "1", "Association", "if_cond", "if", "Expression",
|
|
|
"instantiate_attribute", "1", "if_cond", "name", "cond",
|
|
|
- "instantiate_link", "1", "Association", "if_then", "if", "Statement",
|
|
|
"instantiate_attribute", "1", "if_then", "name", "true",
|
|
|
- "instantiate_link", "1", "Association", "if_else", "if", "Statement",
|
|
|
"instantiate_attribute", "1", "if_else", "name", "false",
|
|
|
- "instantiate_link", "1", "Association", "while_cond", "while", "Expression",
|
|
|
"instantiate_attribute", "1", "while_cond", "name", "cond",
|
|
|
- "instantiate_link", "1", "Association", "while_body", "while", "Statement",
|
|
|
"instantiate_attribute", "1", "while_body", "name", "body",
|
|
|
- "instantiate_link", "1", "Association", "assign_var", "assign", "Any",
|
|
|
"instantiate_attribute", "1", "assign_var", "name", "var",
|
|
|
- "instantiate_link", "1", "Association", "assign_value", "assign", "Expression",
|
|
|
"instantiate_attribute", "1", "assign_value", "name", "value",
|
|
|
- "instantiate_link", "1", "Association", "break_while", "break", "while",
|
|
|
"instantiate_attribute", "1", "break_while", "name", "while",
|
|
|
- "instantiate_link", "1", "Association", "continue_while", "continue", "while",
|
|
|
"instantiate_attribute", "1", "continue_while", "name", "while",
|
|
|
- "instantiate_link", "1", "Association", "return_value", "return", "Expression",
|
|
|
"instantiate_attribute", "1", "return_value", "name", "value",
|
|
|
- "instantiate_link", "1", "Association", "resolve_var", "resolve", "Any",
|
|
|
"instantiate_attribute", "1", "resolve_var", "name", "var",
|
|
|
- "instantiate_link", "1", "Association", "access_var", "access", "Any",
|
|
|
"instantiate_attribute", "1", "access_var", "name", "var",
|
|
|
- "instantiate_link", "1", "Association", "constant_node", "constant", "Any",
|
|
|
"instantiate_attribute", "1", "constant_node", "name", "node",
|
|
|
- "instantiate_link", "1", "Association", "output_node", "output", "Expression",
|
|
|
"instantiate_attribute", "1", "output_node", "name", "node",
|
|
|
- "instantiate_link", "1", "Association", "global_var", "global", "String",
|
|
|
"instantiate_attribute", "1", "global_var", "name", "var",
|
|
|
- "instantiate_link", "1", "Association", "param_name", "param", "String",
|
|
|
"instantiate_attribute", "1", "param_name", "name", "name",
|
|
|
- "instantiate_link", "1", "Association", "param_value", "param", "Expression",
|
|
|
"instantiate_attribute", "1", "param_value", "name", "value",
|
|
|
- "instantiate_link", "1", "Association", "param_next_param", "param", "param",
|
|
|
"instantiate_attribute", "1", "param_next_param", "name", "next_param",
|
|
|
- "instantiate_link", "1", "Association", "funcdef_body", "funcdef", "Statement",
|
|
|
"instantiate_attribute", "1", "funcdef_body", "name", "body",
|
|
|
- "instantiate_link", "1", "Association", "call_func", "call", "Expression",
|
|
|
"instantiate_attribute", "1", "call_func", "name", "func",
|
|
|
- "instantiate_link", "1", "Association", "call_params", "call", "param",
|
|
|
"instantiate_attribute", "1", "call_params", "name", "params",
|
|
|
- "instantiate_link", "1", "Association", "call_last_param", "call", "param",
|
|
|
"instantiate_attribute", "1", "call_last_param", "name", "last_param",
|
|
|
|
|
|
"instantiate_link", "1", "Inheritance", "", "statement_next", "dict_link",
|
|
@@ -148,27 +156,23 @@ action_language = [
|
|
|
"instantiate_link", "1", "Inheritance", "", "call_params", "dict_link",
|
|
|
"instantiate_link", "1", "Inheritance", "", "call_last_param", "dict_link",
|
|
|
|
|
|
- "instantiate_link", "1", "Association", "constraint", "Class", "funcdef",
|
|
|
+ "instantiate_link", "1", "Attribute", "constraint", "Class", "funcdef",
|
|
|
"instantiate_attribute", "1", "constraint", "name", "constraint",
|
|
|
"exit",
|
|
|
]
|
|
|
|
|
|
bottom_attributes = [
|
|
|
"model",
|
|
|
- "instantiate_node", "1", "Class", "Integer",
|
|
|
- "instantiate_link", "1", "Inheritance", "integer_inh_any", "Integer", "Any",
|
|
|
- "instantiate_link", "1", "Association", "lc", "Class", "Integer",
|
|
|
- "instantiate_attribute", "1", "lc", "name", "lower_cardinality",
|
|
|
- "instantiate_link", "1", "Association", "uc", "Class", "Integer",
|
|
|
- "instantiate_attribute", "1", "uc", "name", "upper_cardinality",
|
|
|
- "instantiate_link", "1", "Association", "slc", "Association", "Integer",
|
|
|
- "instantiate_attribute", "1", "slc", "name", "source_lower_cardinality",
|
|
|
- "instantiate_link", "1", "Association", "suc", "Association", "Integer",
|
|
|
- "instantiate_attribute", "1", "suc", "name", "source_upper_cardinality",
|
|
|
- "instantiate_link", "1", "Association", "tlc", "Association", "Integer",
|
|
|
- "instantiate_attribute", "1", "tlc", "name", "target_lower_cardinality",
|
|
|
- "instantiate_link", "1", "Association", "tuc", "Association", "Integer",
|
|
|
- "instantiate_attribute", "1", "tuc", "name", "target_upper_cardinality",
|
|
|
+ "instantiate_node", "1", "AttributeValue", "Natural",
|
|
|
+ "instantiate_node", "1", "AttributeValue", "Boolean",
|
|
|
+ "model_define_attribute", "1", "Attribute", "optional", False, "Boolean",
|
|
|
+ "model_define_attribute", "1", "Class", "lower_cardinality", True, "Natural",
|
|
|
+ "model_define_attribute", "1", "Class", "upper_cardinality", True, "Natural",
|
|
|
+ "model_define_attribute", "1", "Class", "source_lower_cardinality", True, "Natural",
|
|
|
+ "model_define_attribute", "1", "Class", "source_upper_cardinality", True, "Natural",
|
|
|
+ "model_define_attribute", "1", "Class", "target_lower_cardinality", True, "Natural",
|
|
|
+ "model_define_attribute", "1", "Class", "target_upper_cardinality", True, "Natural",
|
|
|
+ "instantiate_attribute", "1", "attr_name", "optional", False,
|
|
|
"exit",
|
|
|
]
|
|
|
|
|
@@ -221,7 +225,7 @@ instantiate_scd = [
|
|
|
"instantiate_attribute", "2", "P2T_weight", "name", "weight",
|
|
|
"instantiate_link", "2", "Association", "T2P_weight", "T2P", "Integer",
|
|
|
"instantiate_attribute", "2", "T2P_weight", "name", "weight",
|
|
|
- "export_node", "2", "models/PetriNets",
|
|
|
+ "export_node", "2", "models/PetriNets_new",
|
|
|
"exit",
|
|
|
]
|
|
|
|
|
@@ -318,15 +322,15 @@ def conformance_check(node):
|
|
|
|
|
|
class TestConstructorsModels(unittest.TestCase):
|
|
|
def test_constructors_instantiate_bottom(self):
|
|
|
- commands = bottom + bottom_attributes + conformance_check("models/SimpleClassDiagrams") + ["return", False]
|
|
|
+ commands = bottom + bottom_attributes + conformance_check("models/SimpleClassDiagrams_new") + ["return", False]
|
|
|
self.assertTrue(run_barebone(commands, ["OK"], 1))
|
|
|
|
|
|
def test_constructors_action_language(self):
|
|
|
- commands = bottom + action_language + bottom_attributes + conformance_check("models/SimpleClassDiagrams") + ["return", False]
|
|
|
+ commands = bottom + action_language + bottom_attributes + conformance_check("models/SimpleClassDiagrams_new") + ["return", False]
|
|
|
self.assertTrue(run_barebone(commands, ["OK"], 1))
|
|
|
|
|
|
def test_constructors_constraints(self):
|
|
|
- commands = bottom + action_language + bottom_attributes + add_constraints(1) + conformance_check("models/SimpleClassDiagrams") + ["return", False]
|
|
|
+ commands = bottom + action_language + bottom_attributes + add_constraints(1) + conformance_check("models/SimpleClassDiagrams_new") + ["return", False]
|
|
|
self.assertTrue(run_barebone(commands, ["OK"], 1))
|
|
|
|
|
|
def test_constructors_constraints_executed(self):
|
|
@@ -334,7 +338,7 @@ class TestConstructorsModels(unittest.TestCase):
|
|
|
self.assertTrue(run_barebone(commands, ["OK"], 1))
|
|
|
|
|
|
def test_constructors_instantiate_scd(self):
|
|
|
- commands = bottom + bottom_attributes + instantiate_scd + conformance_check("models/PetriNets") + ["return", False]
|
|
|
+ commands = bottom + bottom_attributes + instantiate_scd + conformance_check("models/PetriNets_new") + ["return", False]
|
|
|
self.assertTrue(run_barebone(commands, ["OK"], 1))
|
|
|
|
|
|
def test_constructors_instantiate_pn(self):
|