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 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
|
/******************************************************************************
* 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 map_param_common {
type record of integer IntList;
type port PT message {
in integer
out charstring
map param (in octetstring p1 := P1_INITIAL, out IntList p2)
unmap param (inout integer p)
}
type component CT {
port PT pt;
var boolean map_param := false;
var boolean unmap_param := false;
var boolean map_empty := false;
var boolean unmap_empty := false;
}
const octetstring P1_INITIAL := '1123'O;
const IntList P2_INITIAL := { 1, 2, 3 };
const IntList P2_FINAL := { 1, 2, 4, 8 };
const integer P_INITIAL := -2;
const integer P_FINAL := 2;
function f_test_params(CT p_comp) runs on CT system CT {
var IntList v_p2 := P2_INITIAL;
map(p_comp:pt, system:pt) param (-, v_p2);
if (v_p2 != P2_FINAL) {
setverdict(fail, "Final value of parameter p2 is incorrect: ", v_p2);
}
var integer v_p := P_INITIAL;
unmap(p_comp:pt, system:pt) param(v_p);
if (v_p != P_FINAL) {
setverdict(fail, "Final value of parameter p is incorrect: ", v_p);
}
map(p_comp:pt, system:pt);
unmap(p_comp:pt, system:pt);
}
function f_check_calls() runs on CT {
// check whether all 4 user functions have been called
if (map_param and unmap_param and map_empty and unmap_empty) {
setverdict(pass);
}
else {
setverdict(fail, "Not all user functions have been called.");
log("user_map with parameters: ", map_param);
log("user_unmap with parameters: ", unmap_param);
log("user_map without parameters: ", map_empty);
log("user_unmap without parameters: ", unmap_empty);
}
}
function f_test_params_retval(CT p_comp) runs on CT system CT return integer {
var IntList v_p2 := P2_INITIAL;
map(p_comp:pt, system:pt) param (-, v_p2);
if (v_p2 != P2_FINAL) {
setverdict(fail, "Final value of parameter p2 is incorrect: ", v_p2);
}
var integer v_p := P_INITIAL;
unmap(p_comp:pt, system:pt) param(v_p);
if (v_p != P_FINAL) {
setverdict(fail, "Final value of parameter p is incorrect: ", v_p);
}
map(p_comp:pt, system:pt);
unmap(p_comp:pt, system:pt);
return 0;
}
function f_test_params_mtc() runs on CT system CT {
var IntList v_p2 := P2_INITIAL;
map(mtc:pt, system:pt) param (-, v_p2);
if (v_p2 != P2_FINAL) {
setverdict(fail, "Final value of parameter p2 is incorrect: ", v_p2);
}
var integer v_p := P_INITIAL;
unmap(mtc:pt, system:pt) param(v_p);
if (v_p != P_FINAL) {
setverdict(fail, "Final value of parameter p is incorrect: ", v_p);
}
map(mtc:pt, system:pt);
unmap(mtc:pt, system:pt);
}
}
|