Commit 284c5813 authored by Botond Baranyi's avatar Botond Baranyi
Browse files

XER dec: fixed 'anyElement' decoding in record of record (bug 539956)



Change-Id: I883d854db022bcccfef98b66e173043919c13882
Signed-off-by: Botond Baranyi's avatarBotond Baranyi <botond.baranyi@ericsson.com>
parent 5836daf9
......@@ -891,6 +891,15 @@ void UNIVERSAL_CHARSTRING::dump() const
}
}
boolean UNIVERSAL_CHARSTRING::can_start(const char *name, const char *uri,
XERdescriptor_t const& xd, unsigned int flavor, unsigned int flavor2)
{
if (is_exer(flavor) && (xd.xer_bits & ANY_ELEMENT)) {
return TRUE;
}
return Base_Type::can_start(name, uri, xd, flavor, flavor2);
}
void UNIVERSAL_CHARSTRING::log() const
{
if (charstring) {
......
......@@ -272,6 +272,9 @@ public:
void dump() const;
static boolean can_start(const char *name, const char *uri,
XERdescriptor_t const& xd, unsigned int flavor, unsigned int flavor2);
private:
// convert this string to character string for pattern matching: ([A-P]{8})*
char* convert_to_regexp_form() const;
......
......@@ -434,6 +434,58 @@ testcase decode_ae_emb() runs on AE
CHECK_DECODE(exer_dec_ae, str_ae_emb, AEProduct, aep_emb);
}
// testing 'anyElement' in a record of record (bug 539956)
type record Main
{
record of AnyElem anyElem_list
}
with {
variant "name as uncapitalized";
variant (anyElem_list) "untagged";
};
type record AnyElem
{
universal charstring elem
}
with {
variant "untagged";
variant (elem) "anyElement";
};
DECLARE_XER_ENCODERS(Main, main);
DECLARE_EXER_ENCODERS(Main, main);
const Main ae_rorec := {
anyElem_list := { { elem := "<something/>" } }
};
const universal charstring str_ae_rorec_b :=
"<Main>\n" &
"\t<anyElem_list>\n" &
"\t\t<AnyElem>\n" &
"\t\t\t<elem>&lt;something/&gt;</elem>\n" &
"\t\t</AnyElem>\n" &
"\t</anyElem_list>\n" &
"</Main>\n\n";
const universal charstring str_ae_rorec_e :=
"<main>\n" &
"\t<something/>\n" &
"</main>\n\n";
testcase encode_ae_rorec() runs on AE
{
CHECK_METHOD(bxer_enc_main, ae_rorec, str_ae_rorec_b);
CHECK_METHOD(exer_enc_main, ae_rorec, str_ae_rorec_e);
}
testcase decode_ae_rorec() runs on AE
{
CHECK_DECODE(bxer_dec_main, str_ae_rorec_b, Main, ae_rorec);
CHECK_DECODE(exer_dec_main, str_ae_rorec_e, Main, ae_rorec);
}
control
{
......@@ -457,6 +509,9 @@ control
execute(encode_ae_emb())
execute(decode_ae_emb())
execute(encode_ae_rorec())
execute(decode_ae_rorec())
}
}
......
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