|
用loong写了个3mp 和 ASN联合使用的例子 供大家学习
3mp文件
module MyExample{
import from BigInt language "ASN.1:2002" all;
type port PCOType message
{
inout all;
}
type component MTCType
{
port PCOType MyPCO;
port PCOType YourPCO;
}
template charstring ch :=?;
template Dss_Parms a :=
{
p := 1,
q := 2,
g := 3
} ;
function recieve_message() runs on MTCType
{
var charstring v_char;
var Dss_Parms v_Dss_Parms;
timer t := 1.0;
t.start;
alt
{
[]YourPCO.receive(ch)->value v_char
{
log(v_char);
setverdict(pass)
}
[]YourPCO.receive(a)->value v_Dss_Parms
{
log(v_Dss_Parms);
setverdict(pass)
}
[]YourPCO.receive //若不用模板匹配,选择执行的是这一步
{
log("reveive");
setverdict(fail)
}
[]t.timeout
{
setverdict(fail)
}
}
}
testcase HelloW() runs on MTCType
{
connect(mtc:MyPCO,mtc:YourPCO);
MyPCO.send("Hello,World!");
recieve_message();
MyPCO.send(a);
recieve_message();
}
control{
execute(HelloW());
}
}
ASN文件
BigInt DEFINITIONS ::= BEGIN
BigIntType ::= INTEGER
Dss-Parms ::= SEQUENCE {
p INTEGER,
q INTEGER,
g INTEGER
}
END
[ 本帖最后由 gyh_2000 于 2009-11-12 17:18 编辑 ] |
|