TempDynamic_SE.ttcn 2.39 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/******************************************************************************
 * Copyright (c) 2000-2021 Ericsson Telecom AB
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v2.0
 * which accompanies this distribution, and is available at
 * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
 *
 * Contributors:
 *   Baranyi, Botond
 *
 ******************************************************************************/
module TempDynamic_SE { //^In TTCN-3 module//

template integer t1 := @dynamic { return value mod 2 == 0; } 

function f_not_a_template() return integer { //^In function definition//
  return value mod 2; //^In return statement// //^In the left operand of operation//2 //Reference to value being matched is only allowed inside a dynamic template's statement block//
}

template integer t2 := @dynamic { } //^In template definition// //The dynamic template's statement block does not have a return statement//

template integer t3 := @dynamic { return; } //^In template definition// //^In return statement// //Missing return value. The dynamic template's statement block should return a boolean value//

template float t4 := @dynamic { return 1; } //^In template definition// //^In return statement// //boolean value was expected//

template integer t5 := @dynamic { return ?; } //^In template definition// //^In return statement// //A specific value without matching symbols was expected as return value//

template integer t6 := @dynamic { //^In template definition// //Control might leave the dynamic template's statement block without reaching a return statement//
  if (value > 3) { return true; }
}

type component CT {
  var integer v_cv;
}

const integer cg_c := 3;

function f_f() runs on CT {
  var template integer vt := @dynamic {
    if (value > cg_c) { return true; }
    v_cv := value;
    return false;
  }
}

template (omit) integer t7 := @dynamic { return value mod 2 == 0; } //^In template definition// //^While checking template restriction// //Restriction on template definition does not allow usage of dynamic match//

template (value) integer t8 := @dynamic { return value mod 2 == 0; } //^In template definition// //^While checking template restriction// //Restriction on template definition does not allow usage of dynamic match//

template (present) integer t9 := @dynamic { return value mod 2 == 0; }

}