conformance_test/positive_tests added
[deliverable/titan.core.git] / conformance_test / positive_tests / 05_basic_language_elements / 0504_parametrization / 050402_actual_parameters / NegSem_050402_actual_parameters_138.ttcn
1 /******************************************************************************
2 * Copyright (c) 2000-2016 Ericsson Telecom AB
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Adrien Kirjak – initial implementation
10 *
11 ** @version 0.0.1
12 ** @purpose 1:5.4.2, verify that error is generated when passing union and its sub-element to inout parameters
13 ** @verdict pass reject
14 ***************************************************/
15
16 // The following requirement is tested:
17 // Whenever a value or template of a record, set, union, record of, set of, array
18 // and anytype type is passed as an actual parameter to an inout parameter, none of
19 // the fields or elemens of this structured value or template shall be passed as
20 // an actual parameter to another inout parameter of the same parameterized TTCN-3
21 // object. This restriction applies recursively to all sub-elements of the structured
22 // value or template in any level of nesting.
23
24 module NegSem_050402_actual_parameters_138 {
25
26 type component GeneralComp {
27 }
28
29 type record Sub {
30 integer subfield1
31 }
32
33 type union U {
34 Sub option1,
35 charstring option2
36 }
37
38 function f_test (inout integer p_val, inout U p_un) {
39 p_un.option1.subfield1 := 10;
40 if (p_val == 10) { setverdict(pass); }
41 else { setverdict(fail); }
42 }
43
44 testcase TC_NegSem_050402_actual_parameters_138() runs on GeneralComp {
45 var U v_val := { option1 := { subfield1 := 1 } };
46 f_test(v_val.option1.subfield1, v_val);
47 }
48
49 control {
50 execute(TC_NegSem_050402_actual_parameters_138());
51 }
52 }
This page took 0.039607 seconds and 5 git commands to generate.