Commit 2e8bb7ec authored by Adam Knapp's avatar Adam Knapp
Browse files

RAW encoder: wrong value if FIELDORDER msb with PADDING (issue #446)


Signed-off-by: Adam Knapp's avatarAdam Knapp <adam.knapp@ericsson.com>
parent 0515bee1
......@@ -266,6 +266,8 @@ Issue557.control
Issue560.control
#RAW/Issue574
Issue574.control
#RAW/Issue575
Issue575.control
#RAW/Lengthto_Offset:
Lengthto_Offset
#RAW/RAW_bitstring_test:
......
/******************************************************************************
* Copyright (c) 2000-2021 Ericsson Telecom AB
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
*
* Contributors:
* Gabor, Szalai – initial implementation
*
******************************************************************************/
module Issue575 {
type component CT {};
type record my_rec{
bitstring f1 length(6)
} with {
variant "FIELDORDER(msb)"
variant "PADDING(dword32)"
}
template my_rec t_expected:={f1:='111111'B}
testcase tc_issue575() runs on CT {
var bitstring vl_encoded
var my_rec vl_pdu:={f1:='111111'B}
var integer vl_res
vl_encoded:=encvalue(vl_pdu)
log(vl_encoded)
if(vl_encoded == '11111100000000000000000000000000'B){
setverdict(pass)
} else {
setverdict(fail)
}
vl_res:=decvalue(vl_encoded,vl_pdu)
log(vl_pdu)
if(vl_res == 0 and match(vl_pdu,t_expected)){
setverdict(pass)
} else {
setverdict(fail)
}
}
control {
execute(tc_issue575());
}
} with {
encode "RAW"
}
###############################################################################
# Copyright (c) 2000-2021 Ericsson Telecom AB
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v2.0
# which accompanies this distribution, and is available at
# https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
#
# Contributors:
# Botond, Baranyi
#
###############################################################################
[LOGGING]
LogFile := "Issue575.log"
FileMask := LOG_ALL
ConsoleMask := TTCN_ERROR | TTCN_TESTCASE | TTCN_STATISTICS
LogSourceInfo := Yes
[EXECUTE]
Issue575.control
[TESTPORT_PARAMETERS]
......@@ -1184,7 +1184,7 @@ public final class TTCN_Buffer {
if (fieldorder == raw_order_t.ORDER_LSB) {
data_ptr[offset] &= mask1;
} else {
data_ptr[offset] &= ~mask1;
data_ptr[offset] &= RAW.REVERSE_BITS(mask1);
}
for (int i = 1; i < (len - 1 + bit_pos) / 8; i++) {
......
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