Commit 0997ce5a authored by Adam Knapp's avatar Adam Knapp Committed by Miklos Magyari
Browse files

JSON CROSSTAG OTHERWISE correction (issue #431)


Signed-off-by: Adam Knapp's avatarAdam Knapp <adam.knapp@ericsson.com>
parent 30804441
...@@ -153,6 +153,7 @@ AttributeTestcases.control #27 pass, 3 commented out ...@@ -153,6 +153,7 @@ AttributeTestcases.control #27 pass, 3 commented out
#AttributeTestcases.tc_attribute_chosen # fail #AttributeTestcases.tc_attribute_chosen # fail
#AttributeTestcases.tc_attribute_chosen_negtest # fail #AttributeTestcases.tc_attribute_chosen_negtest # fail
#AttributeTestcases.tc_attribute_chosen_default # error #AttributeTestcases.tc_attribute_chosen_default # error
Issue560withJSON.control
#Bson #Bson
#Cbor #Cbor
......
/******************************************************************************
* 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 Issue560withJSON {
type union PCUIF_ContainerMsgUnion {
octetstring other
}
type record PCUIF_container {
integer msg_type,
PCUIF_ContainerMsgUnion u
} with {
variant (u) "chosen (
other, otherwise)"
};
type component CT{}
testcase tc_issue560_with_json() runs on CT {
// Compile test. If compiled then pass.
setverdict(pass)
}
control {
execute(tc_issue560_with_json());
}
} with {
encode "JSON"
}
###############################################################################
# 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 := "Issue560withJSON.log"
FileMask := LOG_ALL
ConsoleMask := TTCN_ERROR | TTCN_TESTCASE | TTCN_STATISTICS
LogSourceInfo := Yes
[EXECUTE]
Issue560withJSON.control
[TESTPORT_PARAMETERS]
...@@ -2251,11 +2251,13 @@ public final class RecordSetCodeGenerator { ...@@ -2251,11 +2251,13 @@ public final class RecordSetCodeGenerator {
otherwise_str = cur_choice.fieldnum != -2 ? "" + cur_choice.fieldnum : "JSON.CHOSEN_FIELD_OMITTED"; otherwise_str = cur_choice.fieldnum != -2 ? "" + cur_choice.fieldnum : "JSON.CHOSEN_FIELD_OMITTED";
} }
} }
if (otherwise_str != null) { if (otherwise_str != null && !first_value) {
/* set chosen_field to the field index of the otherwise rule or -1 */ /* set chosen_field to the field index of the otherwise rule or -1 */
source.append("\t\t\t\t\t\t\telse {\n"); source.append("\t\t\t\t\t\t\telse {\n");
source.append(MessageFormat.format("\t\t\t\t\t\t\t\tchosen_field = {0};\n", otherwise_str)); source.append(MessageFormat.format("\t\t\t\t\t\t\t\tchosen_field = {0};\n", otherwise_str));
source.append("\t\t\t\t\t\t\t}\n"); source.append("\t\t\t\t\t\t\t}\n");
} else if (otherwise_str != null && first_value) {
source.append(MessageFormat.format("\t\t\t\t\t\t\tchosen_field = {0};\n", otherwise_str));
} }
} }
source.append(MessageFormat.format("\t\t\t\t\t\t\tfinal int ret_val = get_field_{0}().JSON_decode({1}_descr_, p_tok, p_silent, false{2});\n", source.append(MessageFormat.format("\t\t\t\t\t\t\tfinal int ret_val = get_field_{0}().JSON_decode({1}_descr_, p_tok, p_silent, false{2});\n",
......
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