Commit 7905243a authored by urbant's avatar urbant
Browse files

Tests for actual parameters (only requirements, no tests for restriction implemented yet)

parent 553355a5
Loading
Loading
Loading
Loading
+33 −0
Original line number Diff line number Diff line
/***************************************************
 ** @author   STF 487
 ** @version  0.0.1
 ** @purpose  1:5.4.2, verify that template parameters cannot be used as in formal value parameters of functions
 ** @verdict  pass reject
 ***************************************************/

// The following requirement is tested:
// Actual parameters that are passed by value to in formal value parameters shall be 
// variables, literal values, module parameters, constants, variables, value returning 
// (external) functions, formal value parameters (of in, inout or out parameterization) 
// of the current scope or expressions composed of the above.

module NegSem_050402_actual_parameters_001 { 

    type component GeneralComp {
	}
    
    template integer m_msg := 1;
    
    function f_test(in integer p_val) {
        if (p_val == 1) { setverdict(pass); }
        else { setverdict(fail); }
    }

    testcase TC_NegSem_050402_actual_parameters_001() runs on GeneralComp {
        f_test(m_msg); // tested parameter passing
	}

	control {
		execute(TC_NegSem_050402_actual_parameters_001());
	}
}
+32 −0
Original line number Diff line number Diff line
/***************************************************
 ** @author   STF 487
 ** @version  0.0.1
 ** @purpose  1:5.4.2, verify that template variables cannot be used as in formal value parameters of functions
 ** @verdict  pass reject
 ***************************************************/

// The following requirement is tested:
// Actual parameters that are passed by value to in formal value parameters shall be 
// variables, literal values, module parameters, constants, variables, value returning 
// (external) functions, formal value parameters (of in, inout or out parameterization) 
// of the current scope or expressions composed of the above.

module NegSem_050402_actual_parameters_002 { 

    type component GeneralComp {
	}
    
    function f_test(in integer p_val) {
        if (p_val == 2) { setverdict(pass); }
        else { setverdict(fail); }
    }

    testcase TC_NegSem_050402_actual_parameters_002() runs on GeneralComp {
        var template integer vm_msg := 2;
        f_test(vm_msg); // tested parameter passing
	}

	control {
		execute(TC_NegSem_050402_actual_parameters_002());
	}
}
+36 −0
Original line number Diff line number Diff line
/***************************************************
 ** @author   STF 487
 ** @version  0.0.1
 ** @purpose  1:5.4.2, verify that template in parameters cannot be used as in formal value parameters of functions
 ** @verdict  pass reject
 ***************************************************/

// The following requirement is tested:
// Actual parameters that are passed by value to in formal value parameters shall be 
// variables, literal values, module parameters, constants, variables, value returning 
// (external) functions, formal value parameters (of in, inout or out parameterization) 
// of the current scope or expressions composed of the above.

module NegSem_050402_actual_parameters_003 { 

    type component GeneralComp {
    }
    
    function f_test(in integer p_val) {
        if (p_val == 3) { setverdict(pass); }
        else { setverdict(fail); }
    }

    function f_caller(in template integer p_val) {
        f_test(p_val); // tested parameter passing
    }

    
    testcase TC_NegSem_050402_actual_parameters_003() runs on GeneralComp {
        f_caller(3); // this parameter passing is not a subject of the test
	}

	control {
		execute(TC_NegSem_050402_actual_parameters_003());
	}
}
+38 −0
Original line number Diff line number Diff line
/***************************************************
 ** @author   STF 487
 ** @version  0.0.1
 ** @purpose  1:5.4.2, verify that template out parameters cannot be used as in formal value parameters of functions
 ** @verdict  pass reject
 ***************************************************/

// The following requirement is tested:
// Actual parameters that are passed by value to in formal value parameters shall be 
// variables, literal values, module parameters, constants, variables, value returning 
// (external) functions, formal value parameters (of in, inout or out parameterization) 
// of the current scope or expressions composed of the above.

module NegSem_050402_actual_parameters_004 { 

    type component GeneralComp {
    }
    
    function f_test(in integer p_val) {
        if (p_val == 4) { setverdict(pass); }
        else { setverdict(fail); }
    }

    function f_caller(out template integer p_val) {
        p_val := 4; // out parameter shall have a value before we can pass it to a function
        f_test(p_val); // tested parameter passing
    }

    
    testcase TC_NegSem_050402_actual_parameters_004() runs on GeneralComp {
        var template integer v_val;
        f_caller(v_val); // this parameter passing is not a subject of the test
	}

	control {
		execute(TC_NegSem_050402_actual_parameters_004());
	}
}
+37 −0
Original line number Diff line number Diff line
/***************************************************
 ** @author   STF 487
 ** @version  0.0.1
 ** @purpose  1:5.4.2, verify that template inout parameters cannot be used as in formal value parameters of functions
 ** @verdict  pass reject
 ***************************************************/

// The following requirement is tested:
// Actual parameters that are passed by value to in formal value parameters shall be 
// variables, literal values, module parameters, constants, variables, value returning 
// (external) functions, formal value parameters (of in, inout or out parameterization) 
// of the current scope or expressions composed of the above.

module NegSem_050402_actual_parameters_005 { 

    type component GeneralComp {
    }
    
    function f_test(in integer p_val) {
        if (p_val == 4) { setverdict(pass); }
        else { setverdict(fail); }
    }

    function f_caller(inout template integer p_val) {
        f_test(p_val); // tested parameter passing
    }

    
    testcase TC_NegSem_050402_actual_parameters_005() runs on GeneralComp {
        var template integer v_val := 5;
        f_caller(v_val); // this parameter passing is not a subject of the test
	}

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