1 /******************************************************************************
2 * Copyright (c) 2000-2016 Ericsson Telecom AB
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
12 ******************************************************************************/
15 // Omitted optional fields of union type (with the "untagged" coding instruction)
16 // are not handled by the XER decoder.
17 // The XER decoder reports a decoding error, if the decoded element does not match
18 // any of the union's alternatives. It does not consider the possibility, that the
19 // union might be an (omitted) optional field of a record or set, and decoded
20 // element might be meant for another field.
34 variant(uni) "untagged";
37 external function f_enc(in Rec x) return octetstring
38 with { extension "prototype(convert) encode(XER:XER_EXTENDED)" }
40 external function f_dec(in octetstring x) return Rec
41 with { extension "prototype(convert) decode(XER:XER_EXTENDED)" }
43 const Rec c_value := { 3, omit, -3 };
44 const octetstring c_value_enc := char2oct(
46 "\t<int1>3</int1>\n" &
47 "\t<int2>-3</int2>\n" &
50 testcase tc_HU13380() runs on CT {
51 var octetstring v_enc := f_enc(c_value);
52 if (v_enc != c_value_enc) {
53 setverdict(fail, "Expected: ", c_value_enc, ", got: ", v_enc);
55 var Rec v_dec := f_dec(c_value_enc);
56 if (v_dec != c_value) {
57 setverdict(fail, "Expected: ", c_value, ", got: ", v_dec);
63 execute(tc_HU13380());