Commit 0515bee1 authored by Gergo Ujhelyi's avatar Gergo Ujhelyi
Browse files

RAW enum decoder bug (issue #574)


Signed-off-by: Gergo Ujhelyi's avatarGergo Ujhelyi <ujhelyi.gergo@ericsson.com>
parent a1f21e11
......@@ -264,6 +264,8 @@ Issue555.control
Issue557.control
#RAW/Issue560
Issue560.control
#RAW/Issue574
Issue574.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 Issue574 {
type component CT {};
type enumerated my_enum{ a(0), b(1)} with {variant "FIELDLENGTH(32)"}
type union my_union{
my_enum f1,
octetstring f2
}
template my_union t_expected:={f2:='FFFFFFFF'O}
testcase tc_issue574() runs on CT {
var bitstring vl_encoded:='11111111111111111111111111111111'B
var my_union vl_pdu
var integer vl_res:=decvalue(vl_encoded,vl_pdu)
log(vl_res)
log(vl_pdu)
if(vl_res == 0 and match(vl_pdu,t_expected)){
setverdict(pass)
} else {
setverdict(fail)
}
}
control {
execute(tc_issue574());
}
} 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 := "Issue574.log"
FileMask := LOG_ALL
ConsoleMask := TTCN_ERROR | TTCN_TESTCASE | TTCN_STATISTICS
LogSourceInfo := Yes
[EXECUTE]
Issue574.control
[TESTPORT_PARAMETERS]
......@@ -674,8 +674,8 @@ public class RAW {
final TTCN_Typedescriptor my_descr = new TTCN_Typedescriptor(p_td.name, null, my_raw, null, null);
final TitanInteger i = new TitanInteger();
final int fl = i.RAW_decode(my_descr, buff, limit, top_bit_ord, no_err, -1, true, null);
if(fl < 0) {
return fl;
if (fl < 0 || !i.is_native()) {
return -1;
}
value.set(i.get_int());
......@@ -684,8 +684,8 @@ public class RAW {
} else {
final TitanInteger i = new TitanInteger();
final int fl = i.RAW_decode(p_td, buff, limit, top_bit_ord, no_err, -1, true, null);
if(fl < 0) {
return fl;
if (fl < 0 || !i.is_native()) {
return -1;
}
value.set(i.get_int());
......
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