Loading 15_templates/1506_referencing_elements_of_templates_or_template_fields/150602_referencing_record_and_set_fields/NegSem_150602_ReferencingRecordAndSetFields_005.ttcn 0 → 100644 +32 −0 Original line number Diff line number Diff line /***************************************************************** ** @author STF 409 ** @version $Rev: 150 $ ** @purpose 1:15.6.2, Ensure that ** @verdict pass reject *****************************************************************/ module NegSem_150602_ReferencingRecordAndSetFields_005 { type component GeneralComp { } type record MyRecordOne { integer f1 } testcase TC_NegSem_150602_ReferencingRecordAndSetFields_005() runs on GeneralComp { var template MyRecordOne m_R1 := { f1 := * ifpresent } var template MyRecordOne m_R2 := { f1 := m_R1.f1 // access to a field with ifpresent shall cause an error! } setverdict(fail); } control{ execute(TC_NegSem_150602_ReferencingRecordAndSetFields_005()); } } No newline at end of file 15_templates/1506_referencing_elements_of_templates_or_template_fields/150602_referencing_record_and_set_fields/Sem_150602_ReferencingRecordAndSetFields_001.ttcn 0 → 100644 +43 −0 Original line number Diff line number Diff line /***************************************************************** ** @author STF 409 ** @version $Rev: 150 $ ** @purpose 1:15.6.2, Ensure that when referencing a subfield within a structured field to which AnyValue is assigned, ? shall be returned for mandatory subfields and * shall be returned for optional subfields. ** @verdict pass accept, ttcn3verdict:pass *****************************************************************/ module Sem_150602_ReferencingRecordAndSetFields_001 { type component GeneralComp { } type record MyRecordTwo { integer g1, MyRecordTwo g2 optional } type record MyRecordOne { integer f1 optional, MyRecordTwo f2 optional } testcase TC_Sem_150602_ReferencingRecordAndSetFields_001() runs on GeneralComp { var template MyRecordOne m_R1 := { f1 := 0, f2 := ? } var template MyRecordTwo m_R2 := m_R1.f2; // m_R2.g1 is mandatory, therefore it shall be ? // m_R2.g2 is optional, therefore it shall be * if (match("?", m_R2.g1) and match("*", m_R2.g2)) { setverdict(pass); } else { setverdict(fail); } } control{ execute(TC_Sem_150602_ReferencingRecordAndSetFields_001()); } } No newline at end of file 15_templates/1506_referencing_elements_of_templates_or_template_fields/150602_referencing_record_and_set_fields/Sem_150602_ReferencingRecordAndSetFields_002.ttcn 0 → 100644 +60 −0 Original line number Diff line number Diff line /***************************************************************** ** @author STF 409 ** @version $Rev: 150 $ ** @purpose 1:15.6.2, Ensure that the recurisve anyvalue expansion is performed correctly when new values are assigned. ** @verdict pass accept, ttcn3verdict:pass *****************************************************************/ module Sem_150602_ReferencingRecordAndSetFields_002 { type component GeneralComp { } type record MyRecordTwo { integer g1, MyRecordTwo g2 optional } type record MyRecordOne { integer f1 optional, MyRecordTwo f2 optional } testcase TC_Sem_150602_ReferencingRecordAndSetFields_002() runs on GeneralComp { var template MyRecordOne m_R1 := { f1 := 0, f2 := ? } m_R1.f2.g2.g2 := {g1:=1, g2:=omit}; // as f2 is ? and we access g2.g2, TTCN-3 should expand the following fields to // contain the following values: // m_R1.f1 = 0 // m_R1.f2 = { // g1 = ? // g2 = { // g1 = ?, // g2 = { // g1 = 1 // g2 = omit // } // } // } if (match(0, m_R1.f1) and match("?", m_R1.f2.g1) and match("?", m_R1.f2.g1.g2) and match(1, m_R1.f2.g2.g2.g1) and match(omit, m_R1.f2.g2.g2.g2) ){ setverdict(pass); } else { setverdict(fail); } } control{ execute(TC_Sem_150602_ReferencingRecordAndSetFields_002()); } } No newline at end of file Loading
15_templates/1506_referencing_elements_of_templates_or_template_fields/150602_referencing_record_and_set_fields/NegSem_150602_ReferencingRecordAndSetFields_005.ttcn 0 → 100644 +32 −0 Original line number Diff line number Diff line /***************************************************************** ** @author STF 409 ** @version $Rev: 150 $ ** @purpose 1:15.6.2, Ensure that ** @verdict pass reject *****************************************************************/ module NegSem_150602_ReferencingRecordAndSetFields_005 { type component GeneralComp { } type record MyRecordOne { integer f1 } testcase TC_NegSem_150602_ReferencingRecordAndSetFields_005() runs on GeneralComp { var template MyRecordOne m_R1 := { f1 := * ifpresent } var template MyRecordOne m_R2 := { f1 := m_R1.f1 // access to a field with ifpresent shall cause an error! } setverdict(fail); } control{ execute(TC_NegSem_150602_ReferencingRecordAndSetFields_005()); } } No newline at end of file
15_templates/1506_referencing_elements_of_templates_or_template_fields/150602_referencing_record_and_set_fields/Sem_150602_ReferencingRecordAndSetFields_001.ttcn 0 → 100644 +43 −0 Original line number Diff line number Diff line /***************************************************************** ** @author STF 409 ** @version $Rev: 150 $ ** @purpose 1:15.6.2, Ensure that when referencing a subfield within a structured field to which AnyValue is assigned, ? shall be returned for mandatory subfields and * shall be returned for optional subfields. ** @verdict pass accept, ttcn3verdict:pass *****************************************************************/ module Sem_150602_ReferencingRecordAndSetFields_001 { type component GeneralComp { } type record MyRecordTwo { integer g1, MyRecordTwo g2 optional } type record MyRecordOne { integer f1 optional, MyRecordTwo f2 optional } testcase TC_Sem_150602_ReferencingRecordAndSetFields_001() runs on GeneralComp { var template MyRecordOne m_R1 := { f1 := 0, f2 := ? } var template MyRecordTwo m_R2 := m_R1.f2; // m_R2.g1 is mandatory, therefore it shall be ? // m_R2.g2 is optional, therefore it shall be * if (match("?", m_R2.g1) and match("*", m_R2.g2)) { setverdict(pass); } else { setverdict(fail); } } control{ execute(TC_Sem_150602_ReferencingRecordAndSetFields_001()); } } No newline at end of file
15_templates/1506_referencing_elements_of_templates_or_template_fields/150602_referencing_record_and_set_fields/Sem_150602_ReferencingRecordAndSetFields_002.ttcn 0 → 100644 +60 −0 Original line number Diff line number Diff line /***************************************************************** ** @author STF 409 ** @version $Rev: 150 $ ** @purpose 1:15.6.2, Ensure that the recurisve anyvalue expansion is performed correctly when new values are assigned. ** @verdict pass accept, ttcn3verdict:pass *****************************************************************/ module Sem_150602_ReferencingRecordAndSetFields_002 { type component GeneralComp { } type record MyRecordTwo { integer g1, MyRecordTwo g2 optional } type record MyRecordOne { integer f1 optional, MyRecordTwo f2 optional } testcase TC_Sem_150602_ReferencingRecordAndSetFields_002() runs on GeneralComp { var template MyRecordOne m_R1 := { f1 := 0, f2 := ? } m_R1.f2.g2.g2 := {g1:=1, g2:=omit}; // as f2 is ? and we access g2.g2, TTCN-3 should expand the following fields to // contain the following values: // m_R1.f1 = 0 // m_R1.f2 = { // g1 = ? // g2 = { // g1 = ?, // g2 = { // g1 = 1 // g2 = omit // } // } // } if (match(0, m_R1.f1) and match("?", m_R1.f2.g1) and match("?", m_R1.f2.g1.g2) and match(1, m_R1.f2.g2.g2.g1) and match(omit, m_R1.f2.g2.g2.g2) ){ setverdict(pass); } else { setverdict(fail); } } control{ execute(TC_Sem_150602_ReferencingRecordAndSetFields_002()); } } No newline at end of file