Browse Source

Fixed RPGame test: metamodel is now valid!

Yentl Van Tendeloo 9 years ago
parent
commit
3f20fa01d8

+ 12 - 0
bootstrap/constructors.alc

@@ -284,6 +284,15 @@ Action function construct_function():
 	Element params
 	String arg_names_decl
 
+	log("Constructing function")
+	while (value_neq(input(), "funcdef")):
+		// We skip over everything that is not a funcdef, as these are all just definitions of global stuff
+		log("Skip over input!")
+
+	log("Reading name of function")
+	// Consume the name
+	input()
+
 	params = create_node()
 	nrParams = input()
 	counter = 0
@@ -301,4 +310,7 @@ Action function construct_function():
 	// Now add the body
 	dict_add(func, "body", construct_unknown())
 
+	// Consume the final 'false', to indicate that no additional code will come
+	input()
+
 	return func

+ 1 - 1
integration/code/pn_interface.alc

@@ -369,7 +369,7 @@ Element function model_loaded(model : Element):
 			specific_op = dict_read(pn_operations(), cmd)
 			specific_op(model)
 		else:
-			output("Unknown command; aborting")
+			output("Unknown command: " + cast_v2s(cmd))
 			output("Use command 'help' to get a list of available commands")
 
 Element function initial_prompt():

+ 8 - 2
integration/test_pn_interface.py

@@ -408,6 +408,10 @@ include "primitives.alh"
 include "object_operations.alh"
 
 Element function constraint(model : Element, name : String):
+\treturn "OK"
+            """
+
+        """
 \tElement associations
 \tElement back_associations
 \tElement association
@@ -424,9 +428,10 @@ Element function constraint(model : Element, name : String):
 \t\t\tdestination = reverseKeyLookup(model["model"], read_edge_dst(association))
 \t\t\tif (destination != name):
 \t\t\t\treturn "Left link does not have a right link back to the same node"
-            """
+        """
 
         constructors = get_constructor(constraint_code)
+        print(constructors)
 
         self.assertTrue(run_file(all_files,
             ['"new"', '"SimpleClassDiagrams"', '"RPGame"',
@@ -469,8 +474,9 @@ Element function constraint(model : Element, name : String):
                 '"attr_add"', '"tile_top"', '"target_upper_cardinality"', '1',
                 '"attr_add"', '"tile_bottom"', '"source_upper_cardinality"', '1',
                 '"attr_add"', '"tile_bottom"', '"target_upper_cardinality"', '1',
+                '"constrain"', '"Tile"',
             ] + constructors + [
                 '"verify"',
             ],
-            init + new + loaded + (instantiate_node + prompt) * 7 + (instantiate_edge + prompt) * 10 + (attr_add + prompt) * 22 + ["OK"] + prompt,
+            init + new + loaded + (instantiate_node + prompt) * 7 + (instantiate_edge + prompt) * 10 + (attr_add + prompt) * 22 + ["Element to constrain (empty for global)?", "Give input to function constructors for LOCAL constraint!", "Added constraint to model!"] + prompt + ["OK"] + prompt,
             mode))

+ 3 - 1
integration/utils.py

@@ -154,7 +154,9 @@ def run_file(files, parameters, expected, mode):
                         return False
 
                     while 1:
-                        val = urllib2.urlopen(urllib2.Request(address, urllib.urlencode({"op": "get_output", "username": username})), timeout=10).read()
+                        print("Wait for result")
+                        val = urllib2.urlopen(urllib2.Request(address, urllib.urlencode({"op": "get_output", "username": username})), timeout=120).read()
+                        print("Got result: " + str(val))
                         l, r = val.split("&", 1)
                         if l.startswith("id"):
                             id_str = l