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

Fixed OER decoding of missing default fields in RT2 (bug 534769)



Change-Id: I3643492d8df2ac997707983c0a81909f38fa9ed7
Signed-off-by: Botond Baranyi's avatarBotond Baranyi <botond.baranyi@ericsson.com>
parent 816843f2
......@@ -6814,7 +6814,9 @@ int Record_Type::OER_decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_bu
}
if (get_at(p_td.oer->p[i])->is_optional() || is_default_field) {
if (!(uc[0] & 1 << (7-act_pos))) {
get_at(p_td.oer->p[i])->set_to_omit();
if (get_at(p_td.oer->p[i])->is_optional()) {
get_at(p_td.oer->p[i])->set_to_omit();
}
} else {
get_at(p_td.oer->p[i])->OER_decode(*fld_descr(p_td.oer->p[i]), p_buf, p_oer);
}
......
......@@ -3571,6 +3571,20 @@
}
setverdict(pass);
}
external function dec_RecWithDefault(in octetstring stream) return RecWithDefault
with { extension "prototype (convert) decode(OER)" }
// Testing the decoding of a field with a default value (bug 534769)
testcase tc_default() runs on EmptyCT {
var octetstring enc := '000104'O;
var RecWithDefault dec := dec_RecWithDefault(enc);
var RecWithDefault dec_exp := { field2 := 4 }; // the default value is currently not set, the field remains unbound, but there should be no DTE
if (log2str(dec) != log2str(dec_exp)) {
setverdict(fail, "Decoding failed. Got: ", dec, ", expected: ", dec_exp);
}
setverdict(pass);
}
control {
execute(tc_boolean());
......@@ -3593,6 +3607,7 @@
execute(tc_example());
execute(tc_529017());
execute(tc_533061());
execute(tc_default());
}
}
......@@ -543,5 +543,11 @@ Rec533061 ::= SEQUENCE
field-ext2 REAL OPTIONAL
}
RecWithDefault ::= SEQUENCE
{
field1 INTEGER DEFAULT 1,
field2 INTEGER
}
END
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