From eb26a4ae8e201552ffa895fe27a7364e0c5cbfd8 Mon Sep 17 00:00:00 2001 From: Botond Baranyi <botond.baranyi@ericsson.com> Date: Tue, 24 Apr 2018 12:30:59 +0200 Subject: [PATCH] RAW enc: fixed octetstring alignment (bug 533767) Change-Id: I6a37ff8659a8b9fcc350642f14285290dfc2a8c2 Signed-off-by: Botond Baranyi <botond.baranyi@ericsson.com> --- core/Octetstring.cc | 4 ++-- .../RAW_EncDec/RAW_EncDec_TD.fast_script | 20 +++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/core/Octetstring.cc b/core/Octetstring.cc index 7eb1e9831..23b206cea 100644 --- a/core/Octetstring.cc +++ b/core/Octetstring.cc @@ -1235,8 +1235,8 @@ int OCTETSTRING::RAW_encode(const TTCN_Typedescriptor_t& p_td, for (int a = 0; a < blength; a++) bc[a] = val_ptr->octets_ptr[a] << 1; } else myleaf.body.leaf.data_ptr = val_ptr->octets_ptr; - if (p_td.raw->endianness == ORDER_MSB) myleaf.align = -align_length; - else myleaf.align = align_length; + if (p_td.raw->endianness == ORDER_MSB) myleaf.align = align_length; + else myleaf.align = -align_length; return myleaf.length = bl + align_length; } diff --git a/function_test/RAW_EncDec/RAW_EncDec_TD.fast_script b/function_test/RAW_EncDec/RAW_EncDec_TD.fast_script index 645c7d6b2..139ff6b61 100644 --- a/function_test/RAW_EncDec/RAW_EncDec_TD.fast_script +++ b/function_test/RAW_EncDec/RAW_EncDec_TD.fast_script @@ -375,9 +375,9 @@ testcase TC_FIELDLENGTH_4_and_BYTEORDER_first_for_octetstring() runs on TempComp testcase TC_FIELDLENGTH_4_for_octetstring_3_octets_long() runs on TempComp { const RAW_PDU_18 i := '123456'O - const octetstring o := '12345600'O + const octetstring o := '00123456'O - if ((enc_RAW_PDU_18(i) == o)and(dec_RAW_PDU_18(o) == i & '00'O)) {setverdict(pass);} + if ((enc_RAW_PDU_18(i) == o)and(dec_RAW_PDU_18(o) == '00'O & i)) {setverdict(pass);} else {setverdict(fail,"enc_RAW_PDU_18(i)= ", enc_RAW_PDU_18(i), "; dec_RAW_PDU_18(o)= ", dec_RAW_PDU_18(o));} } @@ -392,9 +392,9 @@ external function dec_RAW_PDU_19(in octetstring stream) return RAW_PDU_19 with { testcase TC_FIELDLENGTH_5_for_octetstring_2_octets_long() runs on TempComp { const RAW_PDU_19 i := '1234'O - const octetstring o := '1234000000'O + const octetstring o := '0000001234'O - if ((enc_RAW_PDU_19(i) == o)and(dec_RAW_PDU_19(o) == i& '000000'O )) {setverdict(pass);} + if ((enc_RAW_PDU_19(i) == o)and(dec_RAW_PDU_19(o) == '000000'O & i)) {setverdict(pass);} else {setverdict(fail,"enc_RAW_PDU_19(i)= ", enc_RAW_PDU_19(i), "; dec_RAW_PDU_19(o)= ", dec_RAW_PDU_19(o));} } @@ -418,9 +418,9 @@ testcase TC_FIELDLENGTH_4_and_BYTEORDER_last_for_octetstring() runs on TempComp testcase TC_FIELDLENGTH_4_and_BYTEORDER_last_for_octetstring_3_octets_long() runs on TempComp { const RAW_PDU_20 i := '123456'O - const octetstring o := '00563412'O + const octetstring o := '56341200'O - if ((enc_RAW_PDU_20(i) == o)and(dec_RAW_PDU_20(o) == i & '00'O)) {setverdict(pass);} + if ((enc_RAW_PDU_20(i) == o)and(dec_RAW_PDU_20(o) == '00'O & i)) {setverdict(pass);} else {setverdict(fail,"enc_RAW_PDU_20(i)= ", enc_RAW_PDU_20(i), "; dec_RAW_PDU_20(o)= ", dec_RAW_PDU_20(o));} } @@ -2924,9 +2924,9 @@ external function dec_RAW_PDU_132(in octetstring stream) return RAW_PDU_132 with testcase TC_ALIGN_right_for_octetstring() runs on TempComp{ const RAW_PDU_132 i := '123456'O - const octetstring o := '12345600'O + const octetstring o := '00123456'O - if ((enc_RAW_PDU_132(i) == o)and((dec_RAW_PDU_132(o) == i & '00'O))) {setverdict(pass);} + if ((enc_RAW_PDU_132(i) == o)and((dec_RAW_PDU_132(o) == '00'O & i))) {setverdict(pass);} else {setverdict(fail,"enc_RAW_PDU_132(i)= ", enc_RAW_PDU_132(i), "; dec_RAW_PDU_132(o)= ", dec_RAW_PDU_132(o));} } @@ -2942,9 +2942,9 @@ external function dec_RAW_PDU_133(in octetstring stream) return RAW_PDU_133 with testcase TC_ALIGN_left_for_octetstring() runs on TempComp{ const RAW_PDU_133 i := '123456'O - const octetstring o := '00123456'O + const octetstring o := '12345600'O - if ((enc_RAW_PDU_133(i) == o)and((dec_RAW_PDU_133(o) == '00'O & i ))) {setverdict(pass);} + if ((enc_RAW_PDU_133(i) == o)and((dec_RAW_PDU_133(o) == i & '00'O))) {setverdict(pass);} else {setverdict(fail,"enc_RAW_PDU_133(i)= ", enc_RAW_PDU_133(i), "; dec_RAW_PDU_133(o)= ", dec_RAW_PDU_133(o));} } -- GitLab