Commit 7f784654 authored by kovacsa's avatar kovacsa
Browse files

AKovacs update

parent 63ad22e0
Loading
Loading
Loading
Loading
+12 −23
Original line number Original line Diff line number Diff line
@@ -6,39 +6,28 @@
 *****************************************************************/
 *****************************************************************/


//Restriction c)
//Restriction c)
/*if the value list notation is used, only the number of elements listed in the modified template is inherited
/*For templates, template fields and elements of record of and set of types, the above rules specified for
records and sets apply with the following deviations:
 * if the value list notation is used, only the number of elements listed in the modified template is inherited
from the parent (i.e. the list is truncated at the last element of the list notation in the modified template)*/
from the parent (i.e. the list is truncated at the last element of the list notation in the modified template)*/


module Sem_1505_ModifiedTemplates_009 {
module Sem_1505_ModifiedTemplates_009 {


type component GeneralComp { }
type component GeneralComp { }


type record MyMessageType {
type record of charstring MyMessageType;
	integer field1,

	charstring field2,
template MyMessageType m_templateOne := {"A","AB", "ABC", "ABCD","ABCDE","ABCDEF"};
	boolean field3,
	charstring field4
}


template MyMessageType m_templateOne := {
	field1 := 1,
	field2 := "Hello World",
	field3 := true,
	field4 := "Hello World2"
}


template MyMessageType m_templateTwo modifies m_templateOne := { -, "ABC", false}	//field 4 is not inherited from the parent
template MyMessageType m_templateTwo modifies m_templateOne := { "-", "AB",  "ABC"}	//after 3rd element no more elements are inherited from the parent


testcase TC_Sem_1505_ModifiedTemplates_009() runs on GeneralComp {
testcase TC_Sem_1505_ModifiedTemplates_009() runs on GeneralComp {
	if (
	if (match(valueof(m_templateTwo),{"-", "AB",  "ABC"}))
	   (match(valueof(m_templateOne.field1),1)) and
    {
	   (match(valueof(m_templateTwo.field2),"ABC")) and
		setverdict(pass,m_templateTwo);
	   (match(valueof(m_templateTwo.field3), false)) and
	   (match(valueof(m_templateTwo.field4),"<undefined>"))	 
	    ){
		setverdict(pass,m_templateTwo.field4);
	} else {
	} else {
		setverdict(fail,m_templateTwo.field4);
		setverdict(fail,m_templateTwo);
	}
	}
}
}


+11 −23
Original line number Original line Diff line number Diff line
@@ -6,39 +6,27 @@
 *****************************************************************/
 *****************************************************************/
 
 
//Restriction c)
//Restriction c)
/*if the value list notation is used, only the number of elements listed in the modified template is inherited
/*For templates, template fields and elements of record of and set of types, the above rules specified for
records and sets apply with the following deviations:
 * if the value list notation is used, only the number of elements listed in the modified template is inherited
from the parent (i.e. the list is truncated at the last element of the list notation in the modified template)*/
from the parent (i.e. the list is truncated at the last element of the list notation in the modified template)*/

module Sem_1505_ModifiedTemplates_010 {
module Sem_1505_ModifiedTemplates_010 {


type component GeneralComp { }
type component GeneralComp { }


type set MyMessageType {
type set of integer MyMessageType;
	integer field1,

	charstring field2,
template MyMessageType m_templateOne := {1,2,3,4,5,6,7,8,9,10};
	boolean field3,
	charstring field4
}


template MyMessageType m_templateOne := {
	field1 := 1,
	field2 := "Hello World",
	field3 := true,
	field4 := "Hello World2"
}


template MyMessageType m_templateTwo modifies m_templateOne := { -, "ABC", false}	//field 4 is not inherited from the parent
template MyMessageType m_templateTwo modifies m_templateOne := {2,2,3}	//after 3rd element no more elements are inherited from the parent + modification on the first element


testcase TC_Sem_1505_ModifiedTemplates_010() runs on GeneralComp {
testcase TC_Sem_1505_ModifiedTemplates_010() runs on GeneralComp {
	if (
	if (match(valueof(m_templateTwo),{2,2,3}))
	   (match(valueof(m_templateOne.field1),1)) and
    {
	   (match(valueof(m_templateTwo.field2),"ABC")) and
		setverdict(pass,m_templateTwo);
	   (match(valueof(m_templateTwo.field3), false)) and
	   (match(valueof(m_templateTwo.field4),"<undefined>"))	 
	    ){
		setverdict(pass,m_templateTwo.field4);
	} else {
	} else {
		setverdict(fail,m_templateTwo.field4);
		setverdict(fail,m_templateTwo);
	}
	}
}
}


+12 −17
Original line number Original line Diff line number Diff line
@@ -13,18 +13,15 @@ appended).*/


module NegSem_150605_Referencing_union_alternatives_005 {
module NegSem_150605_Referencing_union_alternatives_005 {


    type record My_Rec {
        integer   r1 ,
        float     r2 optional
    }
    
    
    type union My_Union {
    type union My_Union {
        integer  u1,
        integer  u1,
        My_Rec    u2  
        float    u2
    }
    }
    
    
    
    type record My_Rec {
    
        My_Union  r1 optional
    }


    type component GeneralComp {  }	
    type component GeneralComp {  }	


@@ -32,19 +29,17 @@ module NegSem_150605_Referencing_union_alternatives_005 {


    testcase TC_NegSem_150605_Referencing_union_alternatives_005() runs on GeneralComp {
    testcase TC_NegSem_150605_Referencing_union_alternatives_005() runs on GeneralComp {
        
        
     var template My_Rec m_template;
     var template integer m_template;
        
        
        
        
        
     var template My_Union My_Template;
     My_Template.u1 := 1;
     My_Template.u2 := {r1:=1, r2:=0.1 ifpresent} ;
        
        
     var template My_Rec My_Template;
     My_Template.r1 := {u1:=1} ifpresent;
      
      
		
		
		m_template := My_Template.u2;	//error: ifpresent attribute is attached 
	 m_template := My_Template.r1.u1;	//error: ifpresent attribute is attached 
  
  
		setverdict(pass);
		setverdict(pass,m_template);




 }
 }