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

AKovacs update

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

//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)*/

module Sem_1505_ModifiedTemplates_009 {

type component GeneralComp { }

type record MyMessageType {
	integer field1,
	charstring field2,
	boolean field3,
	charstring field4
}
type record of charstring MyMessageType;

template MyMessageType m_templateOne := {"A","AB", "ABC", "ABCD","ABCDE","ABCDEF"};

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 {
	if (
	   (match(valueof(m_templateOne.field1),1)) and
	   (match(valueof(m_templateTwo.field2),"ABC")) and
	   (match(valueof(m_templateTwo.field3), false)) and
	   (match(valueof(m_templateTwo.field4),"<undefined>"))	 
	    ){
		setverdict(pass,m_templateTwo.field4);
	if (match(valueof(m_templateTwo),{"-", "AB",  "ABC"}))
    {
		setverdict(pass,m_templateTwo);
	} else {
		setverdict(fail,m_templateTwo.field4);
		setverdict(fail,m_templateTwo);
	}
}

+11 −23
Original line number Diff line number Diff line
@@ -6,39 +6,27 @@
 *****************************************************************/
 
//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)*/

module Sem_1505_ModifiedTemplates_010 {

type component GeneralComp { }

type set MyMessageType {
	integer field1,
	charstring field2,
	boolean field3,
	charstring field4
}
type set of integer MyMessageType;

template MyMessageType m_templateOne := {1,2,3,4,5,6,7,8,9,10};

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 {
	if (
	   (match(valueof(m_templateOne.field1),1)) and
	   (match(valueof(m_templateTwo.field2),"ABC")) and
	   (match(valueof(m_templateTwo.field3), false)) and
	   (match(valueof(m_templateTwo.field4),"<undefined>"))	 
	    ){
		setverdict(pass,m_templateTwo.field4);
	if (match(valueof(m_templateTwo),{2,2,3}))
    {
		setverdict(pass,m_templateTwo);
	} else {
		setverdict(fail,m_templateTwo.field4);
		setverdict(fail,m_templateTwo);
	}
}

+12 −17
Original line number Diff line number Diff line
@@ -13,18 +13,15 @@ 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  
        float    u2
    }
    
    
    
    type record My_Rec {
        My_Union  r1 optional
    }

    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 {
        
     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);


 }