git-svn-id: https://projects.brucker.ch/su4sml/svn/su4sml/trunk@7813 3260e6d1-4efc-4170-b0a7-36055960796d

This commit is contained in:
Manuel Krucker 2008-04-29 18:48:45 +00:00
parent 3fa9ba196b
commit 300e133fd5
4 changed files with 50 additions and 10 deletions

View File

@ -72,17 +72,19 @@ exception WFCPO_DataModelError
fun c_allInstance_term (c:Classifier) =
let
val _ = trace function_calls ("WF_data_CS.c_allInstances\n")
val x = Variable ("x",DummyT)
val uni_name_x = HolOcl_Namespace.gen_unique_string()
val x = Variable (uni_name_x,DummyT)
(* get class as an holocl term *)
val holocl_class_name = get_class_of (name_of c)
val class_type = type_of c
val class = Variable("c",class_type)
val uni_name_c = HolOcl_Namespace.gen_unique_string()
val class = Variable(uni_name_c,class_type)
(* OclAny.allInstances() *)
val allInstances = OperationCall (class,class_type,["oclLib","OclAny","allInstances"],[],Set (class_type))
(* x.oclIsTypeOf(c) *)
val oclIsTypeOf = OperationWithType (x,DummyT,"oclIsTypeOf",class_type,Boolean)
(* Iterator exists *)
val exists = Iterator("exists",[("x",DummyT)],allInstances,Set(class_type),oclIsTypeOf,Boolean,Boolean)
val exists = Iterator("exists",[(uni_name_x,DummyT)],allInstances,Set(class_type),oclIsTypeOf,Boolean,Boolean)
val _ = trace function_ends ("WF_data_CS.c_allInstances\n")
in
exists

View File

@ -88,6 +88,8 @@ sig
val name_of_inv : Rep_Core.Classifier -> Rep_OclType.Path
val name_of_pre : Rep_Core.Classifier -> Rep_Core.operation -> Rep_OclType.Path
val name_of_post : Rep_Core.Classifier -> Rep_Core.operation -> Rep_OclType.Path
val gen_unique_string : unit -> string
end
@ -102,6 +104,24 @@ struct
| l2 (* Level 2 *)
val id = ref 0;
fun gen_unique_string () =
let
val _ = id:=(!id+1)
in
("var"^Int.toString(!id))
end
fun init_id () =
let
val _ = id:= 0
val _ = Rep_Logger.trace 10 ("id reseted ...\n")
in
()
end
fun listin _ [] = false
| listin e (x::xs) = if e=x then true else listin e xs

View File

@ -8,6 +8,10 @@ open WFCPOG_TestSuite
structure RFM_Data = WFCPOG_Refine_Constraint.WFCPOG_RFM_Data
structure TAX_Data = WFCPOG_Taxonomy_Constraint.WFCPOG_TAX_Data
val _ = Control.Print.printDepth:=30
val _ = Control.Print.printLength:=30
(** ################# **)
(** WELLFORMED-CHECKS **)
(** ################# **)
@ -88,17 +92,15 @@ val wfs = [wfc_rfm_SC]
val pos = [po_rfm_SC]
*)
(*
val wfs = []
val pos = [po_cm]
*)
val pos = [po_cm,po_sm]
(*
val wfs = []
val pos = [po_cstr]
*)
(*
val wfs = [wfc_vis]
val pos = []
*)

View File

@ -177,7 +177,15 @@ fun are_conditions_visible_help [] model = true
val _ = trace 50 ("package operations = " ^ (name_of_op a) ^ "\n")
val posts = postcondition_of_op a
in
List.map (fn (x,y) => expr_is_visible package y model) posts
List.map (fn (x,y) =>
let
val _ = trace 50 ("next post: \n" )
in
if (expr_is_visible public y model)
then true
else raise WFCPOG.WFCPOG_WFC_FailedException ("WFC not hold in class " ^ (string_of_path (name_of h)) ^ " in the condition " ^ (valOf (x)) ^ " with term: " ^ (ocl2string false y) ^ "\n")
end
) posts
end
) (package_operations_of h model)
val _ = trace 50 ("package operations done.\n\n")
@ -186,7 +194,15 @@ fun are_conditions_visible_help [] model = true
val _ = trace 50 ("protected operations " ^ (name_of_op a) ^ "\n")
val posts = postcondition_of_op a
in
List.map (fn (x,y) => expr_is_visible protected y model) posts
List.map (fn (x,y) =>
let
val _ = trace 50 ("next post: \n" )
in
if (expr_is_visible public y model)
then true
else raise WFCPOG.WFCPOG_WFC_FailedException ("WFC not hold in class " ^ (string_of_path (name_of h)) ^ " in the condition " ^ (valOf (x)) ^ " with term: " ^ (ocl2string false y) ^ "\n")
end
) posts
end
) (protected_operations_of h model)
val _ = trace 50 ("protected operations done.\n\n")