testcase inout and out parameters do not work properly
Summary
Inconsistency within the TTCN-3 standard that TITAN shall address.
Steps and/or TTCN-3 code to reproduce
module my{
type port mypt message{
inout charstring;
}with{extension "internal";}
type component myct{
var integer v := 0;
port mypt P;
}
altstep myas(integer pii, in integer pi := 1, inout integer pio, out integer po) runs on myct{
[] any port.receive{if(pio==3 and pii==1 and pi == 2){pii := 11; pi := 12; pio := 13; po := 14;log("parameter values in altstep",pii,pi,pio,po);}}
}
function myfn(integer pii, in integer pi, inout integer pio, out integer po) runs on myct{
P.send("1");
alt{
[] myas(pii, pi, pio, po){log("HMOYN EDW!");log("parameter values in function",pii,pi,pio,po);}
}
}
testcase mytc(integer pii, in integer pi, inout integer pio, out integer po) runs on myct{
var myct ptc := myct.create;
connect(mtc:P, ptc:P);
ptc.start(myfn(pii,pi,pio,po));
log("parameter values in testcase",pii,pi,pio,po);
P.receive("1");
P.send("heloka");
ptc.done;
}
testcase passertc() runs on myct{
setverdict(pass);
}
control{
var integer vii := 1;
var integer vi := 2;
var integer vio := 3;
var integer vo := 4;
execute(mytc(vii,vi,vio,vo));
log("variable values",vii,vi,vio,vo);
if(vii==1 and vi==2 and vio==13 and vo==14){
execute(passertc());
}
}
}
What is the current bug behavior?
The new value of out and inout parameters passed to a testcase called from the control part are invisible from the calling scope (control part), which contradicts the low-level description of the behavior of out and inout parameters in the standard.
What is the expected correct behavior?
At the same time, the current behavior of TITAN agrees the following requirement of the standard: "The test case shall be independent in the sense that it shall be possible to execute the derived executable test case in isolation from other such test cases." There is thus, a contradiction in the standard: If an out or inout parameter of a test case in the control part works properly, and is passed as a parameter to and used by a consecutive test case, this above requirement is not met, while out and inout parameters of the test case work as specified.
Recommendation: Let's make out and inout parameters of test cases work as defined in the standard. At the same time, a warning could be displayed by the compiler and the IDE (maybe even in the runtime log) about the risks of an out or inout formal parameter of a test case if such parameters are used in the code.
Relevant logs and/or screenshots
Possible fixes
Titan version
8.1.0
Platform details (OS type and version)
Microsoft Windows 10 Enterprise 10.0.19042
/cc @aknappqwt