|
@@ -93,6 +93,57 @@ instantiate_pn = [
|
|
|
'"exit"',
|
|
|
]
|
|
|
|
|
|
+instantiate_example = [
|
|
|
+ '"model"',
|
|
|
+ '"instantiate_model"', 1, 2,
|
|
|
+ '"define_inheritance"', 2, '"l3"',
|
|
|
+ '"instantiate_node"', 2, '"Class"', '"A"',
|
|
|
+ '"instantiate_node"', 2, '"Class"', '"B"',
|
|
|
+ '"instantiate_node"', 2, '"Class"', '"C"',
|
|
|
+ '"instantiate_link"', 2, '"l3"', '"b_inherits_a"', '"B"', '"A"',
|
|
|
+ '"exit"',
|
|
|
+ '"model"',
|
|
|
+ '"instantiate_model"', 2, 3,
|
|
|
+ '"instantiate_node"', 3, '"A"', '"a"',
|
|
|
+ '"instantiate_node"', 3, '"B"', '"b"',
|
|
|
+ '"instantiate_node"', 3, '"C"', '"c"',
|
|
|
+ '"exit"',
|
|
|
+ ]
|
|
|
+
|
|
|
+def is_direct_instance_call(model, metamodel):
|
|
|
+ return [
|
|
|
+ '"output"',
|
|
|
+ '"call"',
|
|
|
+ '"access"', '"resolve"', '"is_direct_instance"',
|
|
|
+ '3',
|
|
|
+ '"const"', 3,
|
|
|
+ '"call"',
|
|
|
+ '"access"', '"resolve"', '"dict_read"',
|
|
|
+ '2',
|
|
|
+ '"const"', 3,
|
|
|
+ '"const"', '"%s"' % model,
|
|
|
+ 'false',
|
|
|
+ '"call"',
|
|
|
+ '"access"', '"resolve"', '"dict_read"',
|
|
|
+ '2',
|
|
|
+ '"const"', 2,
|
|
|
+ '"const"', '"%s"' % metamodel,
|
|
|
+ 'false',
|
|
|
+ 'false',
|
|
|
+ 'true',
|
|
|
+ ]
|
|
|
+
|
|
|
+is_direct_instance = \
|
|
|
+ is_direct_instance_call("a", "A") + \
|
|
|
+ is_direct_instance_call("b", "A") + \
|
|
|
+ is_direct_instance_call("c", "A") + \
|
|
|
+ is_direct_instance_call("a", "B") + \
|
|
|
+ is_direct_instance_call("b", "B") + \
|
|
|
+ is_direct_instance_call("c", "B") + \
|
|
|
+ is_direct_instance_call("a", "C") + \
|
|
|
+ is_direct_instance_call("b", "C") + \
|
|
|
+ is_direct_instance_call("c", "C")
|
|
|
+
|
|
|
def conformance_check(node):
|
|
|
return [
|
|
|
'"output"',
|
|
@@ -102,741 +153,28 @@ def conformance_check(node):
|
|
|
'"const"', node,
|
|
|
'false',
|
|
|
'true',
|
|
|
- '"return"',
|
|
|
- 'false',
|
|
|
]
|
|
|
|
|
|
class TestConstructorsModels(unittest.TestCase):
|
|
|
def test_constructors_instantiate_bottom(self):
|
|
|
- commands = bottom + retype + conformance_check(1)
|
|
|
+ commands = bottom + retype + conformance_check(1) + ['"return"', 'false']
|
|
|
self.assertTrue(run_barebone(commands, ["OK"], 1))
|
|
|
|
|
|
def test_constructors_instantiate_scd(self):
|
|
|
- commands = bottom + retype + instantiate_scd + conformance_check(2)
|
|
|
+ commands = bottom + retype + instantiate_scd + conformance_check(2) + ['"return"', 'false']
|
|
|
self.assertTrue(run_barebone(commands, ["OK"], 1))
|
|
|
|
|
|
def test_constructors_instantiate_pn(self):
|
|
|
- commands = bottom + retype + instantiate_scd + instantiate_pn + conformance_check(3)
|
|
|
+ commands = bottom + retype + instantiate_scd + instantiate_pn + conformance_check(3) + ['"return"', 'false']
|
|
|
self.assertTrue(run_barebone(commands, ["OK"], 1))
|
|
|
|
|
|
- """
|
|
|
- def test_constructors_instantiate_model(self):
|
|
|
- commands = bottom + [
|
|
|
- '"instantiate_model"',
|
|
|
- 1,
|
|
|
- 1, '"Inheritance"',
|
|
|
- '"Type"', '"Integer"',
|
|
|
- 'false',
|
|
|
- 'false',
|
|
|
- 'true',
|
|
|
- '"Class"', '"Place"',
|
|
|
- 'true',
|
|
|
- '"tokens"', '"Integer"', 'false',
|
|
|
- 'false',
|
|
|
- 'true',
|
|
|
- '"Class"', '"Transition"',
|
|
|
- 'false',
|
|
|
- 'false',
|
|
|
- 'true',
|
|
|
- '"Association"', '"P2T"', '"Place"', '"Transition"',
|
|
|
- 'true',
|
|
|
- '"weight"', '"Integer"', 'false',
|
|
|
- 'false',
|
|
|
- 'true',
|
|
|
- '"Association"', '"T2P"', '"Transition"', '"Place"',
|
|
|
- 'true',
|
|
|
- '"weight"', '"Integer"', 'false',
|
|
|
- 'false',
|
|
|
- 'false',
|
|
|
- 2,
|
|
|
- '"instantiate_model"',
|
|
|
- 2,
|
|
|
- 1, '"Inheritance"',
|
|
|
- '"Place"', '"p1"',
|
|
|
- 'false',
|
|
|
- 'true',
|
|
|
- '"tokens"', '5', 'false',
|
|
|
- 'true',
|
|
|
- '"Transition"', '"t1"',
|
|
|
- 'false',
|
|
|
- 'false',
|
|
|
- 'true',
|
|
|
- '"P2T"', '""', '"p1"', '"t1"',
|
|
|
- 'false',
|
|
|
- 'true',
|
|
|
- '"weight"', '1', 'false',
|
|
|
- 'true',
|
|
|
- '"T2P"', '""', '"t1"', '"p1"',
|
|
|
- 'false',
|
|
|
- 'true',
|
|
|
- '"weight"', '2', 'false',
|
|
|
- 'false',
|
|
|
- 3,
|
|
|
- '"output"', '"const"', '3',
|
|
|
- 'true',
|
|
|
- '"return"', 'true',
|
|
|
- '"const"', 'true',
|
|
|
- ]
|
|
|
- self.assertTrue(run_barebone(flatten(commands), ['3'], 1))
|
|
|
-
|
|
|
- def test_constructors_retype_model(self):
|
|
|
- commands = bottom + retype + [
|
|
|
- '"output"', '"const"', '3',
|
|
|
- 'true',
|
|
|
- '"return"', 'true',
|
|
|
- '"const"', 'true',
|
|
|
- ]
|
|
|
- self.assertTrue(run_barebone(flatten(commands), ['3'], 1))
|
|
|
-
|
|
|
- def test_constructors_instantiate_model_inheritance(self):
|
|
|
- commands = bottom + [
|
|
|
- '"instantiate_model"',
|
|
|
- 1,
|
|
|
- 1, '"Inheritance"',
|
|
|
- '"Class"', '"A"',
|
|
|
- 'true',
|
|
|
- '"a"', '{"value": "Integer"}', 'false',
|
|
|
- 'false',
|
|
|
- 'true',
|
|
|
- '"Class"', '"B"',
|
|
|
- 'true',
|
|
|
- '"b"', '{"value": "Integer"}', 'false',
|
|
|
- 'false',
|
|
|
- 'true',
|
|
|
- '"Inheritance"', '"b_inherits_from_a"', '"B"', '"A"',
|
|
|
- 'false',
|
|
|
- 'false',
|
|
|
- 'false',
|
|
|
- 2,
|
|
|
- '"instantiate_model"',
|
|
|
- 2,
|
|
|
- 1, '"Inheritance"',
|
|
|
- '"A"', '"a1"',
|
|
|
- 'false',
|
|
|
- 'true',
|
|
|
- '"a"', '1', 'false',
|
|
|
- 'true',
|
|
|
- '"B"', '"b1"',
|
|
|
- 'false',
|
|
|
- 'true',
|
|
|
- '"a"', '2', 'true',
|
|
|
- '"b"', '3', 'false',
|
|
|
- 'false',
|
|
|
- 3,
|
|
|
- '"output"', '"const"', '3',
|
|
|
- 'true',
|
|
|
- '"return"', 'true',
|
|
|
- '"const"', 'true',
|
|
|
- ]
|
|
|
- self.assertTrue(run_barebone(flatten(commands), ['3'], 1))
|
|
|
-
|
|
|
- def test_constructors_conformance_metametamodel(self):
|
|
|
- commands = bottom + retype + [
|
|
|
- '"output"', '"call"',
|
|
|
- '"access"',
|
|
|
- '"resolve"', '"conformance_scd"',
|
|
|
- '1',
|
|
|
- '"const"', 1,
|
|
|
- 'false',
|
|
|
- 'true',
|
|
|
- '"return"', 'true',
|
|
|
- '"const"', 'true',
|
|
|
- ]
|
|
|
- self.assertTrue(run_barebone(flatten(commands), ['OK'], 1))
|
|
|
-
|
|
|
- def test_constructors_conformance_metamodel(self):
|
|
|
- commands = bottom + retype + [
|
|
|
- '"instantiate_model"',
|
|
|
- 1,
|
|
|
- 1, '"Inheritance"',
|
|
|
- '"Class"', '"Place"',
|
|
|
- 'true',
|
|
|
- '"tokens"', '{"value": "Integer"}', 'false',
|
|
|
- 'false',
|
|
|
- 'true',
|
|
|
- '"Class"', '"Transition"',
|
|
|
- 'false',
|
|
|
- 'false',
|
|
|
- 'true',
|
|
|
- '"Association"', '"P2T"', '"Place"', '"Transition"',
|
|
|
- 'true',
|
|
|
- '"weight"', '{"value": "Integer"}', 'false',
|
|
|
- 'false',
|
|
|
- 'true',
|
|
|
- '"Association"', '"T2P"', '"Transition"', '"Place"',
|
|
|
- 'true',
|
|
|
- '"weight"', '{"value": "Integer"}', 'false',
|
|
|
- 'false',
|
|
|
- 'false',
|
|
|
- 2,
|
|
|
- '"output"', '"call"',
|
|
|
- '"access"',
|
|
|
- '"resolve"', '"conformance_scd"',
|
|
|
- '1',
|
|
|
- '"const"', 2,
|
|
|
- 'false',
|
|
|
- 'true',
|
|
|
- '"return"', 'true',
|
|
|
- '"const"', 'true',
|
|
|
- ]
|
|
|
- self.assertTrue(run_barebone(flatten(commands), ['OK'], 1))
|
|
|
-
|
|
|
- def test_constructors_conformance_model(self):
|
|
|
- commands = bottom + retype + [
|
|
|
- '"instantiate_model"',
|
|
|
- 1,
|
|
|
- 1, '"Inheritance"',
|
|
|
- '"Class"', '"Place"',
|
|
|
- 'true',
|
|
|
- '"tokens"', '{"value": "Integer"}', 'false',
|
|
|
- 'false',
|
|
|
- 'true',
|
|
|
- '"Class"', '"Transition"',
|
|
|
- 'false',
|
|
|
- 'false',
|
|
|
- 'true',
|
|
|
- '"Association"', '"P2T"', '"Place"', '"Transition"',
|
|
|
- 'true',
|
|
|
- '"weight"', '{"value": "Integer"}', 'false',
|
|
|
- 'false',
|
|
|
- 'true',
|
|
|
- '"Association"', '"T2P"', '"Transition"', '"Place"',
|
|
|
- 'true',
|
|
|
- '"weight"', '{"value": "Integer"}', 'false',
|
|
|
- 'false',
|
|
|
- 'false',
|
|
|
- 2,
|
|
|
- '"instantiate_model"',
|
|
|
- 2,
|
|
|
- 1, '"Inheritance"',
|
|
|
- '"Place"', '"p1"',
|
|
|
- 'false',
|
|
|
- 'true',
|
|
|
- '"tokens"', '5', 'false',
|
|
|
- 'true',
|
|
|
- '"Transition"', '"t1"',
|
|
|
- 'false',
|
|
|
- 'false',
|
|
|
- 'true',
|
|
|
- '"P2T"', '""', '"p1"', '"t1"',
|
|
|
- 'false',
|
|
|
- 'true',
|
|
|
- '"weight"', '1', 'false',
|
|
|
- 'true',
|
|
|
- '"T2P"', '""', '"t1"', '"p1"',
|
|
|
- 'false',
|
|
|
- 'true',
|
|
|
- '"weight"', '2', 'false',
|
|
|
- 'false',
|
|
|
- 3,
|
|
|
- '"output"', '"call"',
|
|
|
- '"access"',
|
|
|
- '"resolve"', '"conformance_scd"',
|
|
|
- '1',
|
|
|
- '"const"', 3,
|
|
|
- 'false',
|
|
|
- 'true',
|
|
|
- '"return"', 'true',
|
|
|
- '"const"', 'true',
|
|
|
- ]
|
|
|
- self.assertTrue(run_barebone(flatten(commands), ['OK'], 1))
|
|
|
+ def test_constructors_instantiate_example(self):
|
|
|
+ commands = bottom + retype + instantiate_example + conformance_check(2) + conformance_check(3) + ['"return"', 'false']
|
|
|
+ self.assertTrue(run_barebone(commands, ["OK", "OK"], 1))
|
|
|
|
|
|
def test_constructors_is_direct_instance(self):
|
|
|
- commands = bottom + retype + [
|
|
|
- '"instantiate_model"',
|
|
|
- 1,
|
|
|
- 1, '"Inheritance"',
|
|
|
- '"Class"', '"A"',
|
|
|
- 'true',
|
|
|
- '"a"', '{"value": "Integer"}', 'false',
|
|
|
- 'false',
|
|
|
- 'true',
|
|
|
- '"Class"', '"B"',
|
|
|
- 'true',
|
|
|
- '"b"', '{"value": "Integer"}', 'false',
|
|
|
- 'false',
|
|
|
- 'true',
|
|
|
- '"Class"', '"C"',
|
|
|
- 'true',
|
|
|
- '"b"', '{"value": "Integer"}', 'true',
|
|
|
- '"c"', '{"value": "Integer"}', 'false',
|
|
|
- 'false',
|
|
|
- 'true',
|
|
|
- '"Inheritance"', '"__inh_1"', '"A"', '"B"',
|
|
|
- 'false',
|
|
|
- 'false',
|
|
|
- 'false',
|
|
|
- 2,
|
|
|
- '"instantiate_model"',
|
|
|
- 2,
|
|
|
- 1, '"Inheritance"',
|
|
|
- '"A"', '"a"',
|
|
|
- 'false',
|
|
|
- 'true',
|
|
|
- '"a"', '1', 'true',
|
|
|
- '"b"', '1', 'false',
|
|
|
- 'true',
|
|
|
- '"B"', '"b"',
|
|
|
- 'false',
|
|
|
- 'true',
|
|
|
- '"b"', '1', 'false',
|
|
|
- 'true',
|
|
|
- '"C"', '"c"',
|
|
|
- 'false',
|
|
|
- 'true',
|
|
|
- '"b"', '1', 'true',
|
|
|
- '"c"', '1', 'false',
|
|
|
- 'false',
|
|
|
- 3,
|
|
|
- ] + \
|
|
|
- function_call("is_direct_instance", "a", "A") + \
|
|
|
- function_call("is_direct_instance", "a", "B") + \
|
|
|
- function_call("is_direct_instance", "a", "C") + \
|
|
|
- function_call("is_direct_instance", "b", "A") + \
|
|
|
- function_call("is_direct_instance", "b", "B") + \
|
|
|
- function_call("is_direct_instance", "b", "C") + \
|
|
|
- function_call("is_direct_instance", "c", "A") + \
|
|
|
- function_call("is_direct_instance", "c", "B") + \
|
|
|
- function_call("is_direct_instance", "c", "C") + \
|
|
|
- ['"return"', 'true',
|
|
|
- '"const"', 'true',
|
|
|
- ]
|
|
|
- # Test in order:
|
|
|
- # a : A --> Yes
|
|
|
- # a : B --> No
|
|
|
- # a : C --> No
|
|
|
- # b : A --> No
|
|
|
- # b : B --> Yes
|
|
|
- # b : C --> No
|
|
|
- # c : A --> No
|
|
|
- # c : B --> No
|
|
|
- # c : C --> Yes
|
|
|
- self.assertTrue(run_barebone(flatten(commands), ['True', 'False', 'False', 'False', 'True', 'False', 'False', 'False', 'True'], 1))
|
|
|
-
|
|
|
- def test_constructors_is_nominal_instance(self):
|
|
|
- commands = bottom + retype + [
|
|
|
- '"instantiate_model"',
|
|
|
- 1,
|
|
|
- 1, '"Inheritance"',
|
|
|
- '"Class"', '"A"',
|
|
|
- 'true',
|
|
|
- '"a"', '{"value": "Integer"}', 'false',
|
|
|
- 'false',
|
|
|
- 'true',
|
|
|
- '"Class"', '"B"',
|
|
|
- 'true',
|
|
|
- '"b"', '{"value": "Integer"}', 'false',
|
|
|
- 'false',
|
|
|
- 'true',
|
|
|
- '"Class"', '"C"',
|
|
|
- 'true',
|
|
|
- '"b"', '{"value": "Integer"}', 'true',
|
|
|
- '"c"', '{"value": "Integer"}', 'false',
|
|
|
- 'false',
|
|
|
- 'true',
|
|
|
- '"Inheritance"', '"__inh_1"', '"A"', '"B"',
|
|
|
- 'false',
|
|
|
- 'false',
|
|
|
- 'false',
|
|
|
- 2,
|
|
|
- '"instantiate_model"',
|
|
|
- 2,
|
|
|
- 1, '"Inheritance"',
|
|
|
- '"A"', '"a"',
|
|
|
- 'false',
|
|
|
- 'true',
|
|
|
- '"a"', '1', 'true',
|
|
|
- '"b"', '1', 'false',
|
|
|
- 'true',
|
|
|
- '"B"', '"b"',
|
|
|
- 'false',
|
|
|
- 'true',
|
|
|
- '"b"', '1', 'false',
|
|
|
- 'true',
|
|
|
- '"C"', '"c"',
|
|
|
- 'false',
|
|
|
- 'true',
|
|
|
- '"b"', '1', 'true',
|
|
|
- '"c"', '1', 'false',
|
|
|
- 'false',
|
|
|
- 3, ] + \
|
|
|
- function_call("is_nominal_instance", "a", "A") + \
|
|
|
- function_call("is_nominal_instance", "a", "B") + \
|
|
|
- function_call("is_nominal_instance", "a", "C") + \
|
|
|
- function_call("is_nominal_instance", "b", "A") + \
|
|
|
- function_call("is_nominal_instance", "b", "B") + \
|
|
|
- function_call("is_nominal_instance", "b", "C") + \
|
|
|
- function_call("is_nominal_instance", "c", "A") + \
|
|
|
- function_call("is_nominal_instance", "c", "B") + \
|
|
|
- function_call("is_nominal_instance", "c", "C") + \
|
|
|
- [ '"return"', 'true',
|
|
|
- '"const"', 'true',
|
|
|
- ]
|
|
|
- # Test in order:
|
|
|
- # a : A --> Yes
|
|
|
- # a : B --> Yes
|
|
|
- # a : C --> No
|
|
|
- # b : A --> No
|
|
|
- # b : B --> Yes
|
|
|
- # b : C --> No
|
|
|
- # c : A --> No
|
|
|
- # c : B --> No
|
|
|
- # c : C --> Yes
|
|
|
- self.assertTrue(run_barebone(flatten(commands), ['True', 'True', 'False', 'False', 'True', 'False', 'False', 'False', 'True'], 1))
|
|
|
-
|
|
|
- def test_constructors_is_structural_instance(self):
|
|
|
- commands = bottom + retype + [
|
|
|
- '"instantiate_model"',
|
|
|
- 1,
|
|
|
- 1, '"Inheritance"',
|
|
|
- '"Class"', '"A"',
|
|
|
- 'true',
|
|
|
- '"a"', '{"value": "Integer"}', 'false',
|
|
|
- 'false',
|
|
|
- 'true',
|
|
|
- '"Class"', '"B"',
|
|
|
- 'true',
|
|
|
- '"b"', '{"value": "Integer"}', 'false',
|
|
|
- 'false',
|
|
|
- 'true',
|
|
|
- '"Class"', '"C"',
|
|
|
- 'true',
|
|
|
- '"b"', '{"value": "Integer"}', 'true',
|
|
|
- '"c"', '{"value": "Integer"}', 'false',
|
|
|
- 'false',
|
|
|
- 'true',
|
|
|
- '"Inheritance"', '"__inh_1"', '"A"', '"B"',
|
|
|
- 'false',
|
|
|
- 'false',
|
|
|
- 'false',
|
|
|
- 2,
|
|
|
- '"instantiate_model"',
|
|
|
- 2,
|
|
|
- 1, '"Inheritance"',
|
|
|
- '"A"', '"a"',
|
|
|
- 'false',
|
|
|
- 'true',
|
|
|
- '"a"', '1', 'false',
|
|
|
- 'true',
|
|
|
- '"B"', '"b"',
|
|
|
- 'false',
|
|
|
- 'true',
|
|
|
- '"b"', '1', 'false',
|
|
|
- 'true',
|
|
|
- '"C"', '"c"',
|
|
|
- 'false',
|
|
|
- 'true',
|
|
|
- '"b"', '1', 'true',
|
|
|
- '"c"', '1', 'false',
|
|
|
- 'false',
|
|
|
- 3, ] + \
|
|
|
- function_call("is_structural_instance", "a", "A") + \
|
|
|
- function_call("is_structural_instance", "a", "B") + \
|
|
|
- function_call("is_structural_instance", "a", "C") + \
|
|
|
- function_call("is_structural_instance", "b", "A") + \
|
|
|
- function_call("is_structural_instance", "b", "B") + \
|
|
|
- function_call("is_structural_instance", "b", "C") + \
|
|
|
- function_call("is_structural_instance", "c", "A") + \
|
|
|
- function_call("is_structural_instance", "c", "B") + \
|
|
|
- function_call("is_structural_instance", "c", "C") + \
|
|
|
- [ '"return"', 'true',
|
|
|
- '"const"', 'true',
|
|
|
- ]
|
|
|
- # Test in order:
|
|
|
- # a : A --> Yes
|
|
|
- # a : B --> No
|
|
|
- # a : C --> No
|
|
|
- # b : A --> No
|
|
|
- # b : B --> Yes
|
|
|
- # b : C --> No
|
|
|
- # c : A --> No
|
|
|
- # c : B --> Yes
|
|
|
- # c : C --> Yes
|
|
|
- self.assertTrue(run_barebone(flatten(commands), ['True', 'False', 'False', 'False', 'True', 'False', 'False', 'True', 'True'], 1))
|
|
|
-
|
|
|
- def test_constructors_readAttribute(self):
|
|
|
- commands = bottom + retype + [
|
|
|
- '"instantiate_model"',
|
|
|
- 1,
|
|
|
- 1, '"Inheritance"',
|
|
|
- '"Class"', '"Place"',
|
|
|
- 'true',
|
|
|
- '"tokens"', '{"value": "Integer"}', 'false',
|
|
|
- 'false',
|
|
|
- 'true',
|
|
|
- '"Class"', '"Transition"',
|
|
|
- 'false',
|
|
|
- 'false',
|
|
|
- 'true',
|
|
|
- '"Association"', '"P2T"', '"Place"', '"Transition"',
|
|
|
- 'true',
|
|
|
- '"weight"', '{"value": "Integer"}', 'false',
|
|
|
- 'false',
|
|
|
- 'true',
|
|
|
- '"Association"', '"T2P"', '"Transition"', '"Place"',
|
|
|
- 'true',
|
|
|
- '"weight"', '{"value": "Integer"}', 'false',
|
|
|
- 'false',
|
|
|
- 'false',
|
|
|
- 2,
|
|
|
- '"instantiate_model"',
|
|
|
- 2,
|
|
|
- 1, '"Inheritance"',
|
|
|
- '"Place"', '"p1"',
|
|
|
- 'false',
|
|
|
- 'true',
|
|
|
- '"tokens"', '5', 'false',
|
|
|
- 'true',
|
|
|
- '"Transition"', '"t1"',
|
|
|
- 'false',
|
|
|
- 'false',
|
|
|
- 'true',
|
|
|
- '"P2T"', '"arc1"', '"p1"', '"t1"',
|
|
|
- 'false',
|
|
|
- 'true',
|
|
|
- '"weight"', '1', 'false',
|
|
|
- 'true',
|
|
|
- '"T2P"', '"arc2"', '"t1"', '"p1"',
|
|
|
- 'false',
|
|
|
- 'true',
|
|
|
- '"weight"', '2', 'false',
|
|
|
- 'false',
|
|
|
- 3,
|
|
|
- '"output"', '"call"',
|
|
|
- '"access"',
|
|
|
- '"resolve"', '"readAttribute"',
|
|
|
- '3',
|
|
|
- '"const"', 3,
|
|
|
- '"call"',
|
|
|
- '"access"',
|
|
|
- '"resolve"', '"readElementByName"',
|
|
|
- '2',
|
|
|
- '"const"', 3,
|
|
|
- '"const"', '"p1"',
|
|
|
- 'false',
|
|
|
- '"const"', '"tokens"',
|
|
|
- 'false',
|
|
|
- 'true',
|
|
|
- '"output"', '"call"',
|
|
|
- '"access"',
|
|
|
- '"resolve"', '"readAttribute"',
|
|
|
- '3',
|
|
|
- '"const"', 3,
|
|
|
- '"call"',
|
|
|
- '"access"',
|
|
|
- '"resolve"', '"readElementByName"',
|
|
|
- '2',
|
|
|
- '"const"', 3,
|
|
|
- '"const"', '"arc1"',
|
|
|
- 'false',
|
|
|
- '"const"', '"weight"',
|
|
|
- 'false',
|
|
|
- 'true',
|
|
|
- '"output"', '"call"',
|
|
|
- '"access"',
|
|
|
- '"resolve"', '"readAttribute"',
|
|
|
- '3',
|
|
|
- '"const"', 3,
|
|
|
- '"call"',
|
|
|
- '"access"',
|
|
|
- '"resolve"', '"readElementByName"',
|
|
|
- '2',
|
|
|
- '"const"', 3,
|
|
|
- '"const"', '"arc2"',
|
|
|
- 'false',
|
|
|
- '"const"', '"weight"',
|
|
|
- 'false',
|
|
|
- 'true',
|
|
|
- '"return"', 'true',
|
|
|
- '"const"', 'true',
|
|
|
- ]
|
|
|
- self.assertTrue(run_barebone(flatten(commands), ['5', '1', '2'], 1))
|
|
|
-
|
|
|
- def test_constructors_readAndSetAttribute(self):
|
|
|
- commands = bottom + retype + [
|
|
|
- '"instantiate_model"',
|
|
|
- 1,
|
|
|
- 1, '"Inheritance"',
|
|
|
- '"Class"', '"Place"',
|
|
|
- 'true',
|
|
|
- '"tokens"', '{"value": "Integer"}', 'false',
|
|
|
- 'false',
|
|
|
- 'true',
|
|
|
- '"Class"', '"Transition"',
|
|
|
- 'false',
|
|
|
- 'false',
|
|
|
- 'true',
|
|
|
- '"Association"', '"P2T"', '"Place"', '"Transition"',
|
|
|
- 'true',
|
|
|
- '"weight"', '{"value": "Integer"}', 'false',
|
|
|
- 'false',
|
|
|
- 'true',
|
|
|
- '"Association"', '"T2P"', '"Transition"', '"Place"',
|
|
|
- 'true',
|
|
|
- '"weight"', '{"value": "Integer"}', 'false',
|
|
|
- 'false',
|
|
|
- 'false',
|
|
|
- 2,
|
|
|
- '"instantiate_model"',
|
|
|
- 2,
|
|
|
- 1, '"Inheritance"',
|
|
|
- '"Place"', '"p1"',
|
|
|
- 'false',
|
|
|
- 'true',
|
|
|
- '"tokens"', '5', 'false',
|
|
|
- 'true',
|
|
|
- '"Transition"', '"t1"',
|
|
|
- 'false',
|
|
|
- 'false',
|
|
|
- 'true',
|
|
|
- '"P2T"', '"arc1"', '"p1"', '"t1"',
|
|
|
- 'false',
|
|
|
- 'true',
|
|
|
- '"weight"', '1', 'false',
|
|
|
- 'true',
|
|
|
- '"T2P"', '"arc2"', '"t1"', '"p1"',
|
|
|
- 'false',
|
|
|
- 'true',
|
|
|
- '"weight"', '2', 'false',
|
|
|
- 'false',
|
|
|
- 3,
|
|
|
- '"output"', '"call"',
|
|
|
- '"access"',
|
|
|
- '"resolve"', '"readAttribute"',
|
|
|
- '3',
|
|
|
- '"const"', 3,
|
|
|
- '"call"',
|
|
|
- '"access"',
|
|
|
- '"resolve"', '"readElementByName"',
|
|
|
- '2',
|
|
|
- '"const"', 3,
|
|
|
- '"const"', '"p1"',
|
|
|
- 'false',
|
|
|
- '"const"', '"tokens"',
|
|
|
- 'false',
|
|
|
- 'true',
|
|
|
- '"output"', '"call"',
|
|
|
- '"access"',
|
|
|
- '"resolve"', '"readAttribute"',
|
|
|
- '3',
|
|
|
- '"const"', 3,
|
|
|
- '"call"',
|
|
|
- '"access"',
|
|
|
- '"resolve"', '"readElementByName"',
|
|
|
- '2',
|
|
|
- '"const"', 3,
|
|
|
- '"const"', '"arc1"',
|
|
|
- 'false',
|
|
|
- '"const"', '"weight"',
|
|
|
- 'false',
|
|
|
- 'true',
|
|
|
- '"output"', '"call"',
|
|
|
- '"access"',
|
|
|
- '"resolve"', '"readAttribute"',
|
|
|
- '3',
|
|
|
- '"const"', 3,
|
|
|
- '"call"',
|
|
|
- '"access"',
|
|
|
- '"resolve"', '"readElementByName"',
|
|
|
- '2',
|
|
|
- '"const"', 3,
|
|
|
- '"const"', '"arc2"',
|
|
|
- 'false',
|
|
|
- '"const"', '"weight"',
|
|
|
- 'false',
|
|
|
- 'true',
|
|
|
- '"call"',
|
|
|
- '"access"',
|
|
|
- '"resolve"', '"setAttribute"',
|
|
|
- '4',
|
|
|
- '"const"', 3,
|
|
|
- '"call"',
|
|
|
- '"access"',
|
|
|
- '"resolve"', '"readElementByName"',
|
|
|
- '2',
|
|
|
- '"const"', 3,
|
|
|
- '"const"', '"p1"',
|
|
|
- 'false',
|
|
|
- '"const"', '"tokens"',
|
|
|
- '"const"', '10',
|
|
|
- 'true',
|
|
|
- '"call"',
|
|
|
- '"access"',
|
|
|
- '"resolve"', '"setAttribute"',
|
|
|
- '4',
|
|
|
- '"const"', 3,
|
|
|
- '"call"',
|
|
|
- '"access"',
|
|
|
- '"resolve"', '"readElementByName"',
|
|
|
- '2',
|
|
|
- '"const"', 3,
|
|
|
- '"const"', '"arc1"',
|
|
|
- 'false',
|
|
|
- '"const"', '"weight"',
|
|
|
- '"const"', '16',
|
|
|
- 'true',
|
|
|
- '"call"',
|
|
|
- '"access"',
|
|
|
- '"resolve"', '"setAttribute"',
|
|
|
- '4',
|
|
|
- '"const"', 3,
|
|
|
- '"call"',
|
|
|
- '"access"',
|
|
|
- '"resolve"', '"readElementByName"',
|
|
|
- '2',
|
|
|
- '"const"', 3,
|
|
|
- '"const"', '"arc2"',
|
|
|
- 'false',
|
|
|
- '"const"', '"weight"',
|
|
|
- '"const"', '30',
|
|
|
- 'true',
|
|
|
- '"output"', '"call"',
|
|
|
- '"access"',
|
|
|
- '"resolve"', '"readAttribute"',
|
|
|
- '3',
|
|
|
- '"const"', 3,
|
|
|
- '"call"',
|
|
|
- '"access"',
|
|
|
- '"resolve"', '"readElementByName"',
|
|
|
- '2',
|
|
|
- '"const"', 3,
|
|
|
- '"const"', '"p1"',
|
|
|
- 'false',
|
|
|
- '"const"', '"tokens"',
|
|
|
- 'false',
|
|
|
- 'true',
|
|
|
- '"output"', '"call"',
|
|
|
- '"access"',
|
|
|
- '"resolve"', '"readAttribute"',
|
|
|
- '3',
|
|
|
- '"const"', 3,
|
|
|
- '"call"',
|
|
|
- '"access"',
|
|
|
- '"resolve"', '"readElementByName"',
|
|
|
- '2',
|
|
|
- '"const"', 3,
|
|
|
- '"const"', '"arc1"',
|
|
|
- 'false',
|
|
|
- '"const"', '"weight"',
|
|
|
- 'false',
|
|
|
- 'true',
|
|
|
- '"output"', '"call"',
|
|
|
- '"access"',
|
|
|
- '"resolve"', '"readAttribute"',
|
|
|
- '3',
|
|
|
- '"const"', 3,
|
|
|
- '"call"',
|
|
|
- '"access"',
|
|
|
- '"resolve"', '"readElementByName"',
|
|
|
- '2',
|
|
|
- '"const"', 3,
|
|
|
- '"const"', '"arc2"',
|
|
|
- 'false',
|
|
|
- '"const"', '"weight"',
|
|
|
- 'false',
|
|
|
- 'true',
|
|
|
- '"return"', 'true',
|
|
|
- '"const"', 'true',
|
|
|
- ]
|
|
|
- self.assertTrue(run_barebone(flatten(commands), ['5', '1', '2', '10', '16', '30'], 1))
|
|
|
- """
|
|
|
+ commands = bottom + retype + instantiate_example + is_direct_instance + ['"return"', 'false']
|
|
|
+ expected = ['True', 'False', 'False',
|
|
|
+ 'False', 'True', 'False',
|
|
|
+ 'False', 'False', 'True']
|
|
|
+ self.assertTrue(run_barebone(commands, expected, 1))
|