Commit cd9cb643 authored by Botond Baranyi's avatar Botond Baranyi
Browse files

Changed ttcn2string to no longer display the charstring value of printable...


Changed ttcn2string to no longer display the charstring value of printable octetstrings (bug 529655)

Change-Id: Iec73dd7ed079bec08414fd1947cce86701d0fa61
Signed-off-by: Botond Baranyi's avatarBotond Baranyi <botond.baranyi@ericsson.com>
parent 7fa00a37
...@@ -509,7 +509,7 @@ OCTETSTRING::operator const unsigned char*() const ...@@ -509,7 +509,7 @@ OCTETSTRING::operator const unsigned char*() const
void OCTETSTRING::log() const void OCTETSTRING::log() const
{ {
if (val_ptr != NULL) { if (val_ptr != NULL) {
boolean only_printable = TRUE; boolean only_printable = TTCN_Logger::get_log_format() == TTCN_Logger::LF_LEGACY;
TTCN_Logger::log_char('\''); TTCN_Logger::log_char('\'');
for (int i = 0; i < val_ptr->n_octets; i++) { for (int i = 0; i < val_ptr->n_octets; i++) {
unsigned char octet = val_ptr->octets_ptr[i]; unsigned char octet = val_ptr->octets_ptr[i];
......
...@@ -517,6 +517,34 @@ testcase tc_simple_octetstring_unbound() runs on octetstrOper_comptype { ...@@ -517,6 +517,34 @@ testcase tc_simple_octetstring_unbound() runs on octetstrOper_comptype {
if(isbound(vl_o3)) {setverdict(pass)} else {setverdict(fail)} if(isbound(vl_o3)) {setverdict(pass)} else {setverdict(fail)}
} }
const octetstring c_printable := '616263'O; // "abc"
// Testing log2str on a printable octetstring.
// In this case the charstring value is displayed in brackets after the octetstring value.
testcase tc_printable_octetstring_log2str() runs on octetstrOper_comptype {
var charstring res := log2str(c_printable);
var charstring exp := "'616263'O (\"abc\")";
if (res != exp) {
setverdict(fail, "Expected: ", exp, ", got: ", res);
}
else {
setverdict(pass);
}
}
// Testing ttcn2string on a printable octetstring.
// In this case the charstring value is not displayed.
testcase tc_printable_octetstring_ttcn2string() runs on octetstrOper_comptype {
var charstring res := ttcn2string(c_printable);
var charstring exp := "'616263'O";
if (res != exp) {
setverdict(fail, "Expected: ", exp, ", got: ", res);
}
else {
setverdict(pass);
}
}
control { control {
const octetstring cl_1:='AA11'O; const octetstring cl_1:='AA11'O;
var octetstring vl_1; var octetstring vl_1;
...@@ -564,5 +592,7 @@ control { ...@@ -564,5 +592,7 @@ control {
execute(octetstrIsvalue()); execute(octetstrIsvalue());
execute(octetstrIsbound()); execute(octetstrIsbound());
execute(tc_simple_octetstring_unbound()); execute(tc_simple_octetstring_unbound());
execute(tc_printable_octetstring_log2str());
execute(tc_printable_octetstring_ttcn2string());
} }
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment