|
@@ -60,6 +60,94 @@ retype = [
|
|
|
'"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_link"', 1, '"Inheritance"', '""', '"Funcdef"', '"Any"',
|
|
|
+ '"instantiate_link"', 1, '"Inheritance"', '""', '"Action"', '"Any"',
|
|
|
+ '"instantiate_link"', 1, '"Inheritance"', '""', '"Param"', '"Any"',
|
|
|
+ '"instantiate_link"', 1, '"Inheritance"', '""', '"Statement"', '"Action"',
|
|
|
+ '"instantiate_link"', 1, '"Inheritance"', '""', '"Expression"', '"Action"',
|
|
|
+ '"instantiate_link"', 1, '"Inheritance"', '""', '"Resolve"', '"Statement"',
|
|
|
+ '"instantiate_link"', 1, '"Inheritance"', '""', '"If"', '"Statement"',
|
|
|
+ '"instantiate_link"', 1, '"Inheritance"', '""', '"Break"', '"Statement"',
|
|
|
+ '"instantiate_link"', 1, '"Inheritance"', '""', '"Continue"', '"Statement"',
|
|
|
+ '"instantiate_link"', 1, '"Inheritance"', '""', '"Global"', '"Statement"',
|
|
|
+ '"instantiate_link"', 1, '"Inheritance"', '""', '"While"', '"Statement"',
|
|
|
+ '"instantiate_link"', 1, '"Inheritance"', '""', '"Assign"', '"Statement"',
|
|
|
+ '"instantiate_link"', 1, '"Inheritance"', '""', '"Return"', '"Statement"',
|
|
|
+ '"instantiate_link"', 1, '"Inheritance"', '""', '"Call"', '"Statement"',
|
|
|
+ '"instantiate_link"', 1, '"Inheritance"', '""', '"Declare"', '"Statement"',
|
|
|
+ '"instantiate_link"', 1, '"Inheritance"', '""', '"Call"', '"Expression"',
|
|
|
+ '"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_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_true"', '"If"', '"Statement"',
|
|
|
+ '"instantiate_attribute"', 1, '"if_true"', '"name"', '"true"',
|
|
|
+ '"instantiate_link"', 1, '"Association"', '"if_false"', '"If"', '"Statement"',
|
|
|
+ '"instantiate_attribute"', 1, '"if_false"', '"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"', '"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, '"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"',
|
|
|
+ '"exit"',
|
|
|
+ ]
|
|
|
+
|
|
|
bottom_attributes = [
|
|
|
'"model"',
|
|
|
'"instantiate_link"', 1, '"Association"', '"lc"', '"Class"', '"Integer"',
|
|
@@ -145,28 +233,8 @@ def conformance_call(operation, model, metamodel):
|
|
|
'"access"', '"resolve"', '"%s"' % operation,
|
|
|
'3',
|
|
|
'"const"', 3,
|
|
|
- '"call"',
|
|
|
- '"access"', '"resolve"', '"dict_read"',
|
|
|
- '2',
|
|
|
- '"call"',
|
|
|
- '"access"', '"resolve"', '"dict_read"',
|
|
|
- '2',
|
|
|
- '"const"', 3,
|
|
|
- '"const"', '"model"',
|
|
|
- 'false',
|
|
|
- '"const"', '"%s"' % model,
|
|
|
- 'false',
|
|
|
- '"call"',
|
|
|
- '"access"', '"resolve"', '"dict_read"',
|
|
|
- '2',
|
|
|
- '"call"',
|
|
|
- '"access"', '"resolve"', '"dict_read"',
|
|
|
- '2',
|
|
|
- '"const"', 2,
|
|
|
- '"const"', '"model"',
|
|
|
- 'false',
|
|
|
- '"const"', '"%s"' % metamodel,
|
|
|
- 'false',
|
|
|
+ '"const"', '"%s"' % model,
|
|
|
+ '"const"', '"%s"' % metamodel,
|
|
|
'false',
|
|
|
'true',
|
|
|
]
|
|
@@ -193,17 +261,6 @@ is_nominal_instance = \
|
|
|
conformance_call("is_nominal_instance", "b", "C") + \
|
|
|
conformance_call("is_nominal_instance", "c", "C")
|
|
|
|
|
|
-is_structural_instance = \
|
|
|
- conformance_call("is_structural_instance", "a", "A") + \
|
|
|
- conformance_call("is_structural_instance", "b", "A") + \
|
|
|
- conformance_call("is_structural_instance", "c", "A") + \
|
|
|
- conformance_call("is_structural_instance", "a", "B") + \
|
|
|
- conformance_call("is_structural_instance", "b", "B") + \
|
|
|
- conformance_call("is_structural_instance", "c", "B") + \
|
|
|
- conformance_call("is_structural_instance", "a", "C") + \
|
|
|
- conformance_call("is_structural_instance", "b", "C") + \
|
|
|
- conformance_call("is_structural_instance", "c", "C")
|
|
|
-
|
|
|
def conformance_check(node):
|
|
|
return [
|
|
|
'"output"',
|
|
@@ -220,6 +277,10 @@ class TestConstructorsModels(unittest.TestCase):
|
|
|
commands = bottom + retype + bottom_attributes + conformance_check(1) + ['"return"', 'false']
|
|
|
self.assertTrue(run_barebone(commands, ["OK"], 1))
|
|
|
|
|
|
+ def test_constructors_action_language(self):
|
|
|
+ commands = bottom + retype + bottom_attributes + action_language + conformance_check(1) + ['"return"', 'false']
|
|
|
+ self.assertTrue(run_barebone(commands, ["OK"], 1))
|
|
|
+
|
|
|
def test_constructors_instantiate_scd(self):
|
|
|
commands = bottom + retype + bottom_attributes + instantiate_scd + conformance_check(2) + ['"return"', 'false']
|
|
|
self.assertTrue(run_barebone(commands, ["OK"], 1))
|
|
@@ -245,10 +306,3 @@ class TestConstructorsModels(unittest.TestCase):
|
|
|
'False', 'True', 'False',
|
|
|
'False', 'False', 'True']
|
|
|
self.assertTrue(run_barebone(commands, expected, 1))
|
|
|
-
|
|
|
- def test_constructors_is_structural_instance(self):
|
|
|
- commands = bottom + retype + bottom_attributes + instantiate_example + is_structural_instance + ['"return"', 'false']
|
|
|
- expected = ['True', 'False', 'True',
|
|
|
- 'True', 'True', 'True',
|
|
|
- 'True', 'False', 'True']
|
|
|
- self.assertTrue(run_barebone(commands, expected, 1))
|