/******************************************************************************
 * 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 == 0; //^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 integer 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 cv;
}

const integer c := 3;

function f() runs on CT {
  var template integer vt := @dynamic {
    if (value > c) { return true; }
    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; }

}
