|
@@ -0,0 +1,39 @@
|
|
|
+import unittest
|
|
|
+import sys
|
|
|
+import os
|
|
|
+
|
|
|
+from utils import execute, kill, run_file, run_barebone
|
|
|
+sys.path.append("interface/HUTN")
|
|
|
+from hutn_compiler.compiler import main as do_compile
|
|
|
+
|
|
|
+def model_compile(filename):
|
|
|
+ return do_compile(filename, "interface/HUTN/grammars/modelling.g", "M")
|
|
|
+
|
|
|
+def conformance_call(operation, model, metamodel):
|
|
|
+ return [
|
|
|
+ '"output"',
|
|
|
+ '"call"',
|
|
|
+ '"access"', '"resolve"', '"%s"' % operation,
|
|
|
+ '3',
|
|
|
+ '"call"', '"access"', '"resolve"', '"import_node"', '1', '"const"', '"models/example_M"', 'false',
|
|
|
+ '"const"', '"%s"' % model,
|
|
|
+ '"const"', '"%s"' % metamodel,
|
|
|
+ 'false',
|
|
|
+ 'true',
|
|
|
+ ]
|
|
|
+
|
|
|
+def conformance_check(node):
|
|
|
+ return [
|
|
|
+ '"output"',
|
|
|
+ '"call"',
|
|
|
+ '"access"', '"resolve"', '"conformance_scd"',
|
|
|
+ '1',
|
|
|
+ '"call"', '"access"', '"resolve"', '"import_node"', '1', '"const"', '"%s"' % (node), 'false',
|
|
|
+ 'false',
|
|
|
+ 'true',
|
|
|
+ ]
|
|
|
+
|
|
|
+class TestConstructorsModelsCompiled(unittest.TestCase):
|
|
|
+ def test_constructors_petrinets(self):
|
|
|
+ commands = model_compile("interface/HUTN/test/modelling_language/code/petrinets.mvc") + conformance_check("models/PetriNets") + ['"return"', 'false']
|
|
|
+ self.assertTrue(run_barebone(commands, ["OK"], 1))
|