Commit 41b6dfc6 authored by Matthias Simon's avatar Matthias Simon
Browse files

Add new tests from teams folder

parent 1b8ee850
Loading
Loading
Loading
Loading
+36 −0
Original line number Diff line number Diff line
/***************************************************
 ** @author   STF 409, updated by STF 572
 ** @version  0.0.2
 ** @desc     Test cases for clause 5.2 Scope rules
 ** @purpose  1:5.3, Ensure that declarations are in the allowed ordering
 ** @verdict  pass accept, ttcn3verdict:pass
 ***************************************************/
module Sem_0503_Ordering_003 {

    type component GeneralComp {
        var integer vc_component := 0;
    }

    function f_function() runs on GeneralComp {
        var integer v_function := 0;
    }

    testcase TC_Sem_0503_Ordering_003() runs on GeneralComp  {
        if(true) {
            var integer v_int := 0;
            if (v_int == 0) {
                var integer v_statement_block_1 := 0;
                v_statement_block_1 := v_statement_block_1 + 1;
                var integer v_statement_block_2 := 0; // declaration in the middle of the block are allowed
            }

        }
        setverdict(pass);
    }

    control {
        var integer v_control := 0;
        execute(TC_Sem_0503_Ordering_003());
    }

}
+36 −0
Original line number Diff line number Diff line
/***************************************************
 ** @author   STF 409, updated by STF 572
 ** @version  0.0.1
 ** @desc     Test cases for clause 5.2 Scope rules
 ** @purpose  1:5.3, Ensure that declarations are in the allowed ordering
 ** @verdict  pass accept, ttcn3verdict:pass
 ***************************************************/
module Sem_0503_Ordering_004 {

    type component GeneralComp {
        var integer vc_component := 0;
    }

    function f_function() runs on GeneralComp {
        var integer v_function;
        v_function := 0;
        var integer v_function_2 := 0; // declaration don't have to be in the beginning of a block any more
    }

    testcase TC_Sem_0503_Ordering_004() runs on GeneralComp  {
        if(true) {
            var integer v_statement := 0;
            if (v_statement == 0) {
                var integer v_nested_statement := 0;
            }

        }
        setverdict(pass);
    }

    control {
        var integer v_control := 0;
        execute(TC_Sem_0503_Ordering_004());
    }

}
+28 −0
Original line number Diff line number Diff line
/***************************************************
 ** @author   STF 487
 ** @version  0.0.1
 ** @purpose  1:5.4.1.1, verify that default value of value formal parameters cannot reference component variables
 ** @verdict  pass reject
 ***************************************************/

// The following requirement is tested:
// Restriction e)
// The expression shall not refer to elements of the component type of the optional runs on clause.

module NegSem_05040101_parameters_of_kind_value_008 language "TTCN-3:2016" {
	type component GeneralComp {
        var integer vc_int := 0;
	}

    function f(in integer p_int := vc_int) runs on GeneralComp {
    }

	testcase TC_NegSem_05040101_parameters_of_kind_value_008() runs on GeneralComp {
        f();
        setverdict(pass);
	}

	control{
		execute(TC_NegSem_05040101_parameters_of_kind_value_008());
	}
}
+33 −0
Original line number Diff line number Diff line
/***************************************************
 ** @author   STF 487
 ** @version  0.0.1
 ** @purpose  1:5.4.1.1, verify that default value of value formal parameters cannot invoke functions with runs on clause
 ** @verdict  pass reject
 ***************************************************/

// The following requirement is tested:
// Restriction e)
// The expression shall not contain the invocation of functions with a runs on clause.

module NegSem_05040101_parameters_of_kind_value_010 {
	type component GeneralComp {
        var integer vc_int;
	}

    function fx() runs on GeneralComp return integer {
        return vc_int + 1;
    }

    function f(in integer p_int := fx()) runs on GeneralComp {
        log(p_int);
    }

	testcase TC_NegSem_05040101_parameters_of_kind_value_010() runs on GeneralComp {
        f();
        setverdict(pass);
	}

	control{
		execute(TC_NegSem_05040101_parameters_of_kind_value_010());
	}
}
+38 −0
Original line number Diff line number Diff line
/*****************************************************************
 ** @author   STF 521
 ** @version  0.0.1
 ** @purpose  1:5.4.1.1, Verify that altsteps with port parameters cannot be used in component.start operation
 ** @verdict  pass reject
 *****************************************************************/

// The following requirement is tested:
// Only function and altstep definitions may have formal port parameters, - with the exception of functions or
// altsteps started as test component behaviour (see clause 21.3.2).

module NegSem_05040101_parameters_of_kind_value_019 {

    type port P message {
        inout integer
    }
    type component C {
        port P p;
    }

    altstep a_test(P p_port) runs on C {
        [] p_port.receive(integer:?) {
            setverdict(pass);
        }
    }

    testcase TC_NegSem_05040101_parameters_of_kind_value_019() runs on C system C {
        var C v_ptc := C.create;
        connect(mtc:p, mtc:p);
        p.send(1);
        v_ptc.start(a_test(p));
        v_ptc.done;
    }

    control {
        execute(TC_NegSem_05040101_parameters_of_kind_value_019());
    }
}
 No newline at end of file
Loading