conformance_test/positive_tests added
[deliverable/titan.core.git] / conformance_test / positive_tests / 05_basic_language_elements / 0504_parametrization / 050402_actual_parameters / Sem_050402_actual_parameters_002.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, Ensure that the IUT accepts nested assignment of actual parameters.
13 ** @verdict pass accept, ttcn3verdict:pass
14 ***************************************************/
15
16 module Sem_050402_actual_parameters_002 {
17
18 type enumerated MyEnumeratedType {e_black, e_white}
19 type integer address;
20
21 type record MyRecord {
22 integer field1,
23 boolean field2,
24 address field3,
25 MyEnumeratedType field4,
26 integer field5
27 }
28
29 template MyRecord m_parametrizedTemplate1
30 (
31 integer p_integer := 0,
32 boolean p_boolean := true,
33 address p_address := 5,
34 MyEnumeratedType p_enumerated := e_black,
35 template integer p_integerTemplate := ?
36 ) := {
37 field1 := p_integer,
38 field2 := p_boolean,
39 field3 := p_address,
40 field4 := p_enumerated,
41 field5 := p_integerTemplate
42 }
43
44
45 template MyRecord m_parametrizedTemplate2
46 (
47 integer p_integer := 0,
48 boolean p_boolean := true,
49 address p_address := 5,
50 MyEnumeratedType p_enumerated := e_black,
51 template integer p_integerTemplate := ?
52 ) := {
53 field1 := p_integer+1, //this line is different from the previous template
54 field2 := not p_boolean, //this line is different from the previous template
55 field3 := p_address,
56 field4 := p_enumerated,
57 field5 := p_integerTemplate
58 }
59
60
61
62 type component GeneralComp {
63
64 }
65
66
67 testcase TC_Sem_050402_actual_parameters_002(template MyRecord p_templateSelection) runs on GeneralComp {
68
69
70 var MyRecord ExpectedValues := {
71 field1 := 1,
72 field2 := false,
73 field3 := 1,
74 field4 := e_white,
75 field5 := 1
76 }
77
78 if (match(ExpectedValues, p_templateSelection)) {
79 setverdict(pass);
80 }
81 else {
82 setverdict(fail);
83 }
84
85 }
86
87
88 control{
89 execute(TC_Sem_050402_actual_parameters_002(m_parametrizedTemplate1(1,false,1,e_white,1)) );
90 execute(TC_Sem_050402_actual_parameters_002(m_parametrizedTemplate2(0,true,1,e_white,1)) );
91 }
92
93 }
This page took 0.034673 seconds and 5 git commands to generate.