Commit 9e1862f8 authored by urbant's avatar urbant
Browse files

Missing test cases for requirements specified in clause 5.4.1.2

parent d6021a15
Loading
Loading
Loading
Loading
+28 −0
Original line number Diff line number Diff line
/***************************************************
 ** @author   STF 487
 ** @version  0.0.1
 ** @purpose  1:5.4.1.2, verify that in template formal parameters of template cannot used dash as default value
 ** @verdict  pass reject
 ***************************************************/

// The following requirement is tested:
// Formal template parameters of modified templates may inherit their default templates from the 
// corresponding parameters of their parent templates; this shall explicitly be denoted by using 
// a dash (don't change) symbol at the place of the modified template parameter's default template.

module NegSem_05040102_parameters_of_kind_template_001 { 

	type component GeneralComp {
	}	
    
    type record R
    {
        integer field1,
        integer field2
    }
	
    template R mw_t(template integer p_int1 := ?, in template integer p_int2 := -) := {
        field1 := p_int1,
        field2 := p_int2
    }
}
+33 −0
Original line number Diff line number Diff line
/***************************************************
 ** @author   STF 487
 ** @version  0.0.1
 ** @purpose  1:5.4.1.2, verify that modified template cannot used dash as default value when original template parameter had no default value
 ** @verdict  pass accept, noexecution
 ***************************************************/

// The following requirement is tested:
// Formal template parameters of modified templates may inherit their default templates from the 
// corresponding parameters of their parent templates; this shall explicitly be denoted by using 
// a dash (don't change) symbol at the place of the modified template parameter's default template.

module NegSem_05040102_parameters_of_kind_template_002 { 

	type component GeneralComp {
	}	
    
    type record R
    {
        integer field1,
        integer field2
    }
	
    template R m_t(template integer p_int1, in template integer p_int2 := 4) := {
        field1 := p_int1,
        field2 := p_int2
    }
    
    template R m_tmod(template integer p_int1 := -, in template integer p_int2 := ?) modifies m_t := {
        field1 := p_int1,
        field2 := p_int2
    }
}
+41 −0
Original line number Diff line number Diff line
/***************************************************
 ** @author   STF 487
 ** @version  0.0.1
 ** @purpose  1:5.4.1.2, verify that template definitions cannot contain out template formal parameters
 ** @verdict  pass reject
 ***************************************************/

// The following requirement is tested:
// Restriction b)
// Formal template parameters of templates ... shall always be in parameters.

module NegSem_05040101_parameters_of_kind_template_003 { 
	type component GeneralComp {
	}	
    
    type record R
    {
        integer field1,
        integer field2
    }

    function f(out template integer p_int) return template integer {
        p_int := ?;
        return p_int;
    }
    
    template R m_t(out template integer p_int) := {
        field1 := 0,
        field2 := f(p_int)
    }
    
	testcase TC_NegSem_05040101_parameters_of_kind_template_003() runs on GeneralComp {
        var template integer v_int;
        log(m_t(v_int));        
        setverdict(pass);
	}

	control{
		execute(TC_NegSem_05040101_parameters_of_kind_template_003());
	}
}
+41 −0
Original line number Diff line number Diff line
/***************************************************
 ** @author   STF 487
 ** @version  0.0.1
 ** @purpose  1:5.4.1.2, verify that template definitions cannot contain inout template formal parameters
 ** @verdict  pass reject
 ***************************************************/

// The following requirement is tested:
// Restriction b)
// Formal value parameters of templates ... shall always be in parameters.

module NegSem_05040102_parameters_of_kind_template_004 { 
	type component GeneralComp {
	}	
    
    type record R
    {
        integer field1,
        integer field2
    }

    function f(inout template integer p_int) return template integer {
        p_int := ?;
        return p_int;
    }
    
    template R m_t(inout template integer p_int) := {
        field1 := 0,
        field2 := f(p_int)
    }
    
	testcase TC_NegSem_05040102_parameters_of_kind_template_004() runs on GeneralComp {
        var template integer v_int := 1;
        log(m_t(v_int));        
        setverdict(pass);
	}

	control{
		execute(TC_NegSem_05040102_parameters_of_kind_template_004());
	}
}
+29 −0
Original line number Diff line number Diff line
/***************************************************
 ** @author   STF 487
 ** @version  0.0.1
 ** @purpose  1:5.4.1.2, verify that out template formal parameters cannot have default values
 ** @verdict  pass reject
 ***************************************************/

// The following requirement is tested:
// Restriction c)
// Default templates can be provided for in parameters only.

module NegSem_05040102_parameters_of_kind_template_005 { 
	type component GeneralComp {
	}	

    function f(out template integer p_int := ?) {
    }
    
	testcase TC_NegSem_05040102_parameters_of_kind_template_005() runs on GeneralComp {
        var template integer v_int;
        f(v_int);
        log(v_int);
        setverdict(pass);
	}

	control{
		execute(TC_NegSem_05040102_parameters_of_kind_template_005());
	}
}
Loading