????????????????????????????????? binary_string.c??binary_string.h ????????????????????????????????Ь????????????????char????????????????????????δ?????

????????8???????λ??
?????????????????????????????????????????Э??????????????????λ??“??????”??????????????????????????????????????λ??????????
???????????????????TTCN-3??hexstring??????

module Codec_B {
//1.??????
type port common_port message {
inout all
}
//2.??????
type component MyMTC{
port common_port mtc_port;
}
type component MySUT{
port common_port sut_port;
}
// ??????????
testcase Basic_TC () runs on MyMTC system MySUT
{
mtc_port.clear;
//???????sut_port??????????SUT????????MTC???????
//sut_port.clear;
map(mtc:mtc_port?? system:sut_port);
mtc_port.start;
//???????sut_port??????????SUT????????MTC???????
//sut_port.start;
mtc_port.send('ABCD'H);
mtc_port.receive('ABCD'H);
mtc_port.send('ABC'H);
mtc_port.receive('ABC0'H);
setverdict(pass);
stop;
}
//???????
control {
execute(Basic_TC());
}
}
 ???????????У?????hexstring??????????????′????
????1.????????????octetstring?????????
????2.????????????????????????????????????????4λ?????????4λ??0????????????λ????????????????4λ???
??????binary_string.c ????????????????
/* Appends half byte to the end of binary string
* It's assumed that binary string has enough free space
*/
static void append_half_byte (MyBinaryString *string?? unsigned char data)
{
unsigned long free_pos;
free_pos = string->string.bits/8;
string->string.data[free_pos] = data;
string->string.bits += 4;
}
????12????
???????????????????????漰???????????????????SPASVOС??(021-61079698-8054)?????????????????????????