瀏覽代碼

Patches for tests and conformance bottom finding

Yentl Van Tendeloo 7 年之前
父節點
當前提交
c1a60e4b8d
共有 4 個文件被更改,包括 7 次插入6 次删除
  1. 4 1
      bootstrap/conformance_finding.alc
  2. 1 1
      bootstrap/typing.alc
  3. 1 3
      unit/test_all.py
  4. 1 1
      wrappers/modelverse_SCCD.py

+ 4 - 1
bootstrap/conformance_finding.alc

@@ -85,7 +85,10 @@ Boolean function find_type_mapping(model : Element):
 				retype(model, readAssociationDestination(model, elem), node_target_element)
 				retype(model, readAssociationDestination(model, elem), node_target_element)
 			elif (node_source_element == node_target_element):
 			elif (node_source_element == node_target_element):
 				// A node, and we are sure that there is only one
 				// A node, and we are sure that there is only one
-				retype(model, elem, node_source_element)
+				if (is_edge(model["model"][elem])):
+					retype(model, elem, edge_element)
+				else:
+					retype(model, elem, node_source_element)
 
 
 	// 3) (optional) verify that the mapping is correct with conformance checking
 	// 3) (optional) verify that the mapping is correct with conformance checking
 	// TODO
 	// TODO

+ 1 - 1
bootstrap/typing.alc

@@ -96,7 +96,7 @@ Void function set_type_mapping(model : Element, type_mapping_model : Element):
 					destination_name = string_replace(tmp_destination_name, "type_", "")
 					destination_name = string_replace(tmp_destination_name, "type_", "")
 					break!
 					break!
 
 
-			if (bool_and(dict_in(m_model, source_name), dict_in(mm_model, destination_name))):
+			if (bool_and(bool_and(dict_in(m_model, source_name), dict_in(mm_model, destination_name)), read_nr_out(type_mapping_model[key]) == 0)):
 				// Element is in neither model or metamodel
 				// Element is in neither model or metamodel
 				// Must be a typing link!
 				// Must be a typing link!
 				// So add it
 				// So add it

+ 1 - 3
unit/test_all.py

@@ -381,9 +381,6 @@ class TestModelverse(unittest.TestCase):
         model_add("test/PetriNet", "formalisms/SimpleClassDiagrams", open("integration/code/pn_design.mvc", "r").read())
         model_add("test/PetriNet", "formalisms/SimpleClassDiagrams", open("integration/code/pn_design.mvc", "r").read())
         model_add("test/my_pn", "test/PetriNet", open("integration/code/pn_design_model.mvc", "r").read())
         model_add("test/my_pn", "test/PetriNet", open("integration/code/pn_design_model.mvc", "r").read())
 
 
-        alter_context("test/PetriNet", "formalisms/SimpleClassDiagrams")
-        alter_context("test/my_pn", "test/PetriNet")
-        
         got = element_list_nice("test/PetriNet")
         got = element_list_nice("test/PetriNet")
         expected = \
         expected = \
             [{'id': 'Natural', 'type': 'SimpleAttribute', 'constraint': None, 'name': 'Natural'},
             [{'id': 'Natural', 'type': 'SimpleAttribute', 'constraint': None, 'name': 'Natural'},
@@ -418,6 +415,7 @@ class TestModelverse(unittest.TestCase):
         count_nodes = 0
         count_nodes = 0
         count_edges = 0
         count_edges = 0
         for entry in element_list_nice("test/PetriNet"):
         for entry in element_list_nice("test/PetriNet"):
+            print(entry)
             assert entry["type"] in ["Node", "Edge"]
             assert entry["type"] in ["Node", "Edge"]
             if entry["type"] == "Node":
             if entry["type"] == "Node":
                 assert len(entry) == 2
                 assert len(entry) == 2

+ 1 - 1
wrappers/modelverse_SCCD.py

@@ -1,7 +1,7 @@
 """
 """
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
 
-Date:   Fri May 25 16:14:54 2018
+Date:   Fri May 25 16:49:54 2018
 
 
 Model author: Yentl Van Tendeloo
 Model author: Yentl Van Tendeloo
 Model name:   MvK Server
 Model name:   MvK Server