NegSem_150605_Referencing_union_alternatives_005.ttcn 1.34 KB
Newer Older
kovacsa's avatar
kovacsa committed
/*****************************************************************
 ** @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 {

kovacsa's avatar
kovacsa committed
    
kovacsa's avatar
kovacsa committed
    type union My_Union {
kovacsa's avatar
kovacsa committed
        integer  u1,
        float    u2
kovacsa's avatar
kovacsa committed
    type record My_Rec {
        My_Union  r1 optional
    }
kovacsa's avatar
kovacsa committed

    type component GeneralComp {  }	

   

    testcase TC_NegSem_150605_Referencing_union_alternatives_005() runs on GeneralComp {
        
kovacsa's avatar
kovacsa committed
     var template integer m_template;
kovacsa's avatar
kovacsa committed
     var template My_Rec My_Template;
     My_Template.r1 := {u1:=1} ifpresent;
      
kovacsa's avatar
kovacsa committed
	 m_template := My_Template.r1.u1;	//error: ifpresent attribute is attached 
kovacsa's avatar
kovacsa committed
		setverdict(pass,m_template);
kovacsa's avatar
kovacsa committed


 }

    control{
        execute(TC_NegSem_150605_Referencing_union_alternatives_005());
    }
}