Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*****************************************************************
** @author STF 487
** @version 0.0.1
** @purpose 1:15.6.5, Ensure that referencing an alternative of a union template field to which the ifpresent attribute is attached, shall cause an error
** @verdict pass reject
*****************************************************************/
//Restriction c)
/*Ifpresent attribute: referencing an alternative of a union template field to which the ifpresent attribute is
attached, shall cause an error (irrespective of the value or the matching mechanism to which ifpresent is
appended).*/
module NegSem_150605_Referencing_union_alternatives_005 {
type record My_Rec {
integer r1 ,
float r2 optional
}
type union My_Union {
integer u1,
My_Rec u2
}
type component GeneralComp { }
testcase TC_NegSem_150605_Referencing_union_alternatives_005() runs on GeneralComp {
var template My_Rec m_template;
var template My_Union My_Template;
My_Template.u1 := 1;
My_Template.u2 := {r1:=1, r2:=0.1 ifpresent} ;
m_template := My_Template.u2; //error: ifpresent attribute is attached
setverdict(pass);
}
control{
execute(TC_NegSem_150605_Referencing_union_alternatives_005());
}
}