|
@@ -58,6 +58,23 @@ retype = [
|
|
'"exit"',
|
|
'"exit"',
|
|
]
|
|
]
|
|
|
|
|
|
|
|
+bottom_attributes = [
|
|
|
|
+ '"model"',
|
|
|
|
+ '"instantiate_link"', 1, '"Association"', '"lc"', '"Class"', '"Integer"',
|
|
|
|
+ '"instantiate_attribute"', 1, '"lc"', '"name"', '"lower_cardinality"',
|
|
|
|
+ '"instantiate_link"', 1, '"Association"', '"uc"', '"Class"', '"Integer"',
|
|
|
|
+ '"instantiate_attribute"', 1, '"lc"', '"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"',
|
|
|
|
+ '"exit"',
|
|
|
|
+ ]
|
|
|
|
+
|
|
instantiate_scd = [
|
|
instantiate_scd = [
|
|
'"model"',
|
|
'"model"',
|
|
'"instantiate_model"', 1, 2,
|
|
'"instantiate_model"', 1, 2,
|
|
@@ -67,9 +84,12 @@ instantiate_scd = [
|
|
'"instantiate_node"', 2, '"Type"', '"Integer"',
|
|
'"instantiate_node"', 2, '"Type"', '"Integer"',
|
|
'"instantiate_link"', 2, '"Association"', '"P2T"', '"Place"', '"Transition"',
|
|
'"instantiate_link"', 2, '"Association"', '"P2T"', '"Place"', '"Transition"',
|
|
'"instantiate_link"', 2, '"Association"', '"T2P"', '"Transition"', '"Place"',
|
|
'"instantiate_link"', 2, '"Association"', '"T2P"', '"Transition"', '"Place"',
|
|
- '"instantiate_named"', 2, '"Association"', '"tokens"', '"Place"', '"Integer"',
|
|
|
|
- '"instantiate_named"', 2, '"Association"', '"weight"', '"P2T"', '"Integer"',
|
|
|
|
- '"instantiate_named"', 2, '"Association"', '"weight"', '"T2P"', '"Integer"',
|
|
|
|
|
|
+ '"instantiate_link"', 2, '"Association"', '"Place_tokens"', '"Place"', '"Integer"',
|
|
|
|
+ '"instantiate_attribute"', 2, '"Place_tokens"', '"name"', '"tokens"',
|
|
|
|
+ '"instantiate_link"', 2, '"Association"', '"weight"', '"P2T"', '"Integer"',
|
|
|
|
+ '"instantiate_attribute"', 2, '"P2T_weight"', '"name"', '"weight"',
|
|
|
|
+ '"instantiate_link"', 2, '"Association"', '"weight"', '"T2P"', '"Integer"',
|
|
|
|
+ '"instantiate_attribute"', 2, '"T2P_weight"', '"name"', '"weight"',
|
|
'"exit"',
|
|
'"exit"',
|
|
]
|
|
]
|
|
|
|
|
|
@@ -101,8 +121,10 @@ instantiate_example = [
|
|
'"instantiate_node"', 2, '"Class"', '"B"',
|
|
'"instantiate_node"', 2, '"Class"', '"B"',
|
|
'"instantiate_node"', 2, '"Class"', '"C"',
|
|
'"instantiate_node"', 2, '"Class"', '"C"',
|
|
'"instantiate_link"', 2, '"Inheritance"', '"b_inherits_a"', '"B"', '"A"',
|
|
'"instantiate_link"', 2, '"Inheritance"', '"b_inherits_a"', '"B"', '"A"',
|
|
- '"instantiate_named"', 2, '"Association"', '"tokens"', '"A"', '"B"',
|
|
|
|
- '"instantiate_named"', 2, '"Association"', '"tokens"', '"C"', '"B"',
|
|
|
|
|
|
+ '"instantiate_link"', 2, '"Association"', '"A_tokens"', '"A"', '"B"',
|
|
|
|
+ '"instantiate_attribute"', 2, '"A_tokens"', '"name"', '"tokens"',
|
|
|
|
+ '"instantiate_link"', 2, '"Association"', '"C_tokens"', '"C"', '"B"',
|
|
|
|
+ '"instantiate_attribute"', 2, '"C_tokens"', '"name"', '"tokens"',
|
|
'"exit"',
|
|
'"exit"',
|
|
'"model"',
|
|
'"model"',
|
|
'"instantiate_model"', 2, 3,
|
|
'"instantiate_model"', 2, 3,
|
|
@@ -193,37 +215,37 @@ def conformance_check(node):
|
|
|
|
|
|
class TestConstructorsModels(unittest.TestCase):
|
|
class TestConstructorsModels(unittest.TestCase):
|
|
def test_constructors_instantiate_bottom(self):
|
|
def test_constructors_instantiate_bottom(self):
|
|
- commands = bottom + retype + conformance_check(1) + ['"return"', 'false']
|
|
|
|
|
|
+ commands = bottom + retype + bottom_attributes + conformance_check(1) + ['"return"', 'false']
|
|
self.assertTrue(run_barebone(commands, ["OK"], 1))
|
|
self.assertTrue(run_barebone(commands, ["OK"], 1))
|
|
|
|
|
|
def test_constructors_instantiate_scd(self):
|
|
def test_constructors_instantiate_scd(self):
|
|
- commands = bottom + retype + instantiate_scd + conformance_check(2) + ['"return"', 'false']
|
|
|
|
|
|
+ commands = bottom + retype + bottom_attributes + instantiate_scd + conformance_check(2) + ['"return"', 'false']
|
|
self.assertTrue(run_barebone(commands, ["OK"], 1))
|
|
self.assertTrue(run_barebone(commands, ["OK"], 1))
|
|
|
|
|
|
def test_constructors_instantiate_pn(self):
|
|
def test_constructors_instantiate_pn(self):
|
|
- commands = bottom + retype + instantiate_scd + instantiate_pn + conformance_check(3) + ['"return"', 'false']
|
|
|
|
|
|
+ commands = bottom + retype + bottom_attributes + instantiate_scd + instantiate_pn + conformance_check(3) + ['"return"', 'false']
|
|
self.assertTrue(run_barebone(commands, ["OK"], 1))
|
|
self.assertTrue(run_barebone(commands, ["OK"], 1))
|
|
|
|
|
|
def test_constructors_instantiate_example(self):
|
|
def test_constructors_instantiate_example(self):
|
|
- commands = bottom + retype + instantiate_example + conformance_check(2) + conformance_check(3) + ['"return"', 'false']
|
|
|
|
|
|
+ commands = bottom + retype + bottom_attributes + instantiate_example + conformance_check(2) + conformance_check(3) + ['"return"', 'false']
|
|
self.assertTrue(run_barebone(commands, ["OK", "OK"], 1))
|
|
self.assertTrue(run_barebone(commands, ["OK", "OK"], 1))
|
|
|
|
|
|
def test_constructors_is_direct_instance(self):
|
|
def test_constructors_is_direct_instance(self):
|
|
- commands = bottom + retype + instantiate_example + is_direct_instance + ['"return"', 'false']
|
|
|
|
|
|
+ commands = bottom + retype + bottom_attributes + instantiate_example + is_direct_instance + ['"return"', 'false']
|
|
expected = ['True', 'False', 'False',
|
|
expected = ['True', 'False', 'False',
|
|
'False', 'True', 'False',
|
|
'False', 'True', 'False',
|
|
'False', 'False', 'True']
|
|
'False', 'False', 'True']
|
|
self.assertTrue(run_barebone(commands, expected, 1))
|
|
self.assertTrue(run_barebone(commands, expected, 1))
|
|
|
|
|
|
def test_constructors_is_nominal_instance(self):
|
|
def test_constructors_is_nominal_instance(self):
|
|
- commands = bottom + retype + instantiate_example + is_nominal_instance + ['"return"', 'false']
|
|
|
|
|
|
+ commands = bottom + retype + bottom_attributes + instantiate_example + is_nominal_instance + ['"return"', 'false']
|
|
expected = ['True', 'True', 'False',
|
|
expected = ['True', 'True', 'False',
|
|
'False', 'True', 'False',
|
|
'False', 'True', 'False',
|
|
'False', 'False', 'True']
|
|
'False', 'False', 'True']
|
|
self.assertTrue(run_barebone(commands, expected, 1))
|
|
self.assertTrue(run_barebone(commands, expected, 1))
|
|
|
|
|
|
def test_constructors_is_structural_instance(self):
|
|
def test_constructors_is_structural_instance(self):
|
|
- commands = bottom + retype + instantiate_example + is_structural_instance + ['"return"', 'false']
|
|
|
|
|
|
+ commands = bottom + retype + bottom_attributes + instantiate_example + is_structural_instance + ['"return"', 'false']
|
|
expected = ['True', 'False', 'True',
|
|
expected = ['True', 'False', 'True',
|
|
'True', 'True', 'True',
|
|
'True', 'True', 'True',
|
|
'True', 'False', 'True']
|
|
'True', 'False', 'True']
|