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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/***************************************************
** @author STF 487
** @version 0.0.1
** @purpose 1:B.1.2.8, Ensure that the IUT correctly handles content decoding
** @verdict pass accept, ttcn3verdict:pass
***************************************************/
//Restriction a)
/*It can be assigned to templates and template fields of bitstring, hexstring, octetstring,
charstring and universal charstring types.*/
module Sem_B010209_decoded_content_004 {
type record MessageType {
charstring payload
}
type record Mymessage {
integer field1,
bitstring field2 optional
}
type port loopbackPort message{inout MessageType};
type component GeneralComp {
port loopbackPort messagePort
}
testcase TC_Sem_B010209_decoded_content_004() runs on GeneralComp {
var bitstring v_enc;
var Mymessage v_testMessage;
var MessageType Message;
v_testMessage:= {
field1 := 10,
field2 := '1001'B
}
Message.payload := bit2str(encvalue(v_testMessage)); //encode message to payload, charstring
template MessageType mw_matchingTemplate:=
{
payload := decmatch Mymessage: {field1:= 10, field2 := '1001'B}
}
messagePort.send(Message); //send message
alt {
[] messagePort.receive(mw_matchingTemplate) {
setverdict(pass);
}
[] messagePort.receive {
setverdict(fail,mw_matchingTemplate);
}
}
}
control{
execute(TC_Sem_B010209_decoded_content_004());
}
}