Sem_1508_TemplateRestrictions_036.ttcn 1.47 KB
Newer Older
/*****************************************************************
 ** @author   STF 470 (updated by STF 521)
 ** @version  0.0.2
 ** @purpose  1:15.8, Ensure that the restrictiveness of parameters template(omit)->template(present) is handled correctly.
 ** @verdict  pass accept, ttcn3verdict:pass
 *****************************************************************/

// The issue is still a problem in TTCN-3:2016 as rules of 15.8 allow runtime (content-dependent) check. 
// For that reason, the test seems valid, but there's an active CR7603 on this topic that would lead to 
// stricter approach in which case the test should be change to a negative one.

module Sem_1508_TemplateRestrictions_036 {

	type component GeneralComp { }

    type record ExampleType {
        integer a,
        boolean b optional
    }

    template(present) ExampleType m_baseTemplate(template(present) integer p_myInt) := {
        a := p_myInt,
        b := true
    }

    template(present) ExampleType m_modifiedTemplate(template integer p_myInt) modifies m_baseTemplate := {
        a := 21
    }

	testcase TC_Sem_1508_TemplateRestrictions_036() runs on GeneralComp {
stancakapost's avatar
stancakapost committed
        if (match(valueof(m_modifiedTemplate(1).a), 21) and
            match(valueof(m_modifiedTemplate(1).b), true)
        ) {
            setverdict(pass);
        } else {
            setverdict(fail);
        }
    }

    control{
        execute(TC_Sem_1508_TemplateRestrictions_036());
    }
}