Browse Source

All tests working on PyPy

Yentl Van Tendeloo 8 years ago
parent
commit
c8e627eb87
3 changed files with 37 additions and 61 deletions
  1. BIN
      bootstrap/bootstrap.m.gz
  2. 1 22
      bootstrap/transform.alc
  3. 36 39
      integration/test_pn_interface.py

BIN
bootstrap/bootstrap.m.gz


+ 1 - 22
bootstrap/transform.alc

@@ -67,77 +67,59 @@ Element function get_possible_bindings(host_model : Element, schedule_model : El
 	String original_typename
 
 	options = create_node()
-	log("Finding possible bindings for: " + current_element)
-	log("    knowing: " + dict_to_string(map))
 
 	typename = reverseKeyLookup(schedule_model["metamodel"]["model"], dict_read_node(schedule_model["type_mapping"], schedule_model["model"][current_element]))
 	original_typename = string_substr(typename, 4, string_len(typename))
 
 	if (is_edge(schedule_model["model"][current_element])):
-		log("Is edge!")
 		// Is an edge, so check for already bound source/target
 		src_label = read_attribute(schedule_model, reverseKeyLookup(schedule_model["model"], read_edge_src(schedule_model["model"][current_element])), "label")
 		dst_label = read_attribute(schedule_model, reverseKeyLookup(schedule_model["model"], read_edge_dst(schedule_model["model"][current_element])), "label")
-		log("SRC: " + src_label)
-		log("DST: " + dst_label)
 
 		if (bool_and(set_in(dict_keys(map), src_label), set_in(dict_keys(map), dst_label))):
 			// Source and destination are bound
 			options = allOutgoingAssociationInstances(host_model, map[src_label], original_typename)
 			options = set_overlap(options, allIncomingAssociationInstances(host_model, map[dst_label], original_typename))
-			log("Overlap!")
 
 		elif (set_in(dict_keys(map), src_label)):
 			// Source is bound
 			options = allOutgoingAssociationInstances(host_model, map[src_label], original_typename)
-			log("Source")
 
 		elif (set_in(dict_keys(map), dst_label)):
 			// Destination is bound
 			options = allIncomingAssociationInstances(host_model, map[dst_label], original_typename)
-			log("Destination")
 
 		else:
 			// Neither is bound, so just get all of them
 			log("ERROR: unbound source/target for association!")
+			//TODO should actually return all
 			return create_node()!
 	else:
 		// Is a node, so find whether or not there are some connections that are already resolved
-		// TODO check implementation
-		log("Is node!")
 		Element ic
 		Element oc
 		String poll
 
 		ic = allIncomingAssociationInstances(schedule_model, current_element, "Pre_Element")
 		oc = allOutgoingAssociationInstances(schedule_model, current_element, "Pre_Element")
-		log("Incoming: " + set_to_string(ic))
-		log("Outgoing: " + set_to_string(oc))
 
-		log("Search in")
 		while (bool_and(read_nr_out(ic) > 0, read_nr_out(options) == 0)):
 			poll = set_pop(ic)
 			if (dict_in(map, read_attribute(schedule_model, poll, "label"))):
 				// This incoming link is already defined, so we just have one option: the destination of the link we matched
 				set_add(options, readAssociationDestination(host_model, map[read_attribute(schedule_model, poll, "label")]))
-				log("Found mapped incoming: " + poll)
 			
-		log("Search out")
 		while (bool_and(read_nr_out(oc) > 0, read_nr_out(options) == 0)):
 			poll = set_pop(oc)
 			if (dict_in(map, read_attribute(schedule_model, poll, "label"))):
 				// This incoming link is already defined, so we just have one option: the destination of the link we matched
 				set_add(options, readAssociationSource(host_model, map[read_attribute(schedule_model, poll, "label")]))
-				log("Found mapped outgoing: " + poll)
 
-		log("Done")
 		if (read_nr_out(options) == 0):
 			// Is a node and no connections, so we just pick all options
-			log("None found, revert to all")
 			options = allInstances(host_model, original_typename)
 		elif (read_nr_out(options) > 1):
 			// Multiple "only" options, which will not work out: no options!
-			log("Multiple found; halting")
 			return create_node()!
 
 	// Filter options further
@@ -165,7 +147,6 @@ Element function get_possible_bindings(host_model : Element, schedule_model : El
 				if (result):
 					set_add(filtered_options, option)
 
-	log("    options: " + set_to_string(filtered_options))
 	return filtered_options!
 
 Element function match(host_model : Element, schedule_model : Element, LHS : Element):
@@ -409,9 +390,7 @@ Boolean function transform_forall(host_model : Element, schedule_model : Element
 		result = False
 
 	while (read_nr_out(mappings) > 0):
-		log("Executing " + current)
 		mapping = set_pop(mappings)
-		log("For mapping: " + dict_to_string(mapping))
 		// TODO check if there are actually no deletions happening in the meantime of other matched elements...
 		RHS = set_pop(allAssociationDestinations(schedule_model, current, "AtomicRHS"))
 		rewrite(host_model, schedule_model, RHS, mapping)

+ 36 - 39
integration/test_pn_interface.py

@@ -812,25 +812,23 @@ Element function constraint(model : Element, name : String):
                     "read", "p3",
                     "exit",
             ],
-            None, "PO"))
-
-          #greeting + prompt * 3 +
-          #  load + loaded +
-          #  read_node("t1", "Transition", [], [("executing", "Boolean", False)]) + prompt +
-          #  read_node("p1", "Place", [], [("tokens", "Natural", 1)]) + prompt +
-          #  read_node("p2", "Place", [], [("tokens", "Natural", 2)]) + prompt +
-          #  read_node("p3", "Place", [], [("tokens", "Natural", 3)]) + prompt +
-          #  prompt +
-          #  ramify + prompt + 
-          #  prompt +
-          #  transform + transform_result_true + prompt +
-          #  load + loaded +
-          #  ["OK"] + prompt +
-          #  read_node("t1", "Transition", [], [("executing", "Boolean", False)]) + prompt +
-          #  read_node("p1", "Place", [], [("tokens", "Natural", 0)]) + prompt +
-          #  read_node("p2", "Place", [], [("tokens", "Natural", 1)]) + prompt +
-          #  read_node("p3", "Place", [], [("tokens", "Natural", 5)]) + prompt, 
-          #"PO"))
+          greeting + prompt * 3 +
+            load + loaded +
+            read_node("t1", "Transition", [], [("executing", "Boolean", False)]) + prompt +
+            read_node("p1", "Place", [], [("tokens", "Natural", 1)]) + prompt +
+            read_node("p2", "Place", [], [("tokens", "Natural", 2)]) + prompt +
+            read_node("p3", "Place", [], [("tokens", "Natural", 3)]) + prompt +
+            prompt +
+            ramify + prompt + 
+            prompt +
+            transform + transform_result_true + prompt +
+            load + loaded +
+            ["OK"] + prompt +
+            read_node("t1", "Transition", [], [("executing", "Boolean", False)]) + prompt +
+            read_node("p1", "Place", [], [("tokens", "Natural", 0)]) + prompt +
+            read_node("p2", "Place", [], [("tokens", "Natural", 1)]) + prompt +
+            read_node("p3", "Place", [], [("tokens", "Natural", 5)]) + prompt, 
+          "PO"))
 
     def test_po_pn_interface_transform_pn_to_runtime(self):
         PN_runtime = \
@@ -1325,23 +1323,22 @@ Element function constraint(model : Element, name : String):
                 "transform", "pn", "pn_simulate",
                 "transform", "pn", "pn_print",
             ],
-          #greeting + prompt * 3 +
-          #  unify + prompt +
-          #  join + prompt +
-          #  load + loaded +
-          #  instantiate_edge + prompt +
-          #  instantiate_edge + prompt +
-          #  prompt +
-          #  ramify + prompt +
-          #  ramify + prompt + 
-          #  prompt +
-          #  prompt +
-          #  prompt +
-          #  transform + transform_result_true + prompt +
-          #  split + prompt +
-          #  transform + [set(['"p1" --> 1', '"p2" --> 2', '"p3" --> 3'])] + transform_result_true + prompt +
-          #  transform + transform_result_true + prompt +
-          #  transform + [set(['"p1" --> 0', '"p2" --> 1', '"p3" --> 5'])] + transform_result_true + prompt
-          #  , 
-          #"PO"))
-          None, "PO"))
+          greeting + prompt * 3 +
+            unify + prompt +
+            join + prompt +
+            load + loaded +
+            instantiate_edge + prompt +
+            instantiate_edge + prompt +
+            prompt +
+            ramify + prompt +
+            ramify + prompt + 
+            prompt +
+            prompt +
+            prompt +
+            transform + transform_result_true + prompt +
+            split + prompt +
+            transform + [set(['"p1" --> 1', '"p2" --> 2', '"p3" --> 3'])] + transform_result_true + prompt +
+            transform + transform_result_true + prompt +
+            transform + [set(['"p1" --> 0', '"p2" --> 1', '"p3" --> 5'])] + transform_result_true + prompt
+            , 
+          "PO"))