Commit bb8261cc authored by Adam Knapp's avatar Adam Knapp
Browse files

RAW CROSSTAG OTHERWISE correction (issue #431)


Signed-off-by: Adam Knapp's avatarAdam Knapp <adam.knapp@ericsson.com>
parent eb45b962
......@@ -261,6 +261,8 @@ IntX.control #ok! 6 pass
Issue555.control
#RAW/Issue557
Issue557.control
#RAW/Issue560
Issue560.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 Issue560 {
type union R_Union {
octetstring other
} with { variant "" };
type record R_container {
integer msg_type,
R_Union u
} with {
variant (u) "CROSSTAG(
other, OTHERWISE)"
};
type component CT{}
testcase tc_issue560() runs on CT {
// Compile test. If compiled then pass.
setverdict(pass)
}
control {
execute(tc_issue560());
}
} 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 := "Issue560.log"
FileMask := LOG_ALL
ConsoleMask := TTCN_ERROR | TTCN_TESTCASE | TTCN_STATISTICS
LogSourceInfo := Yes
[EXECUTE]
Issue560.control
[TESTPORT_PARAMETERS]
......@@ -5185,14 +5185,20 @@ public final class RecordSetCodeGenerator {
}
source.append("\t\t\t}");
}
source.append(" else {\n");
source.append(MessageFormat.format("\t\t\t\tselected_field = {0,number,#};\n", other));
source.append("\t\t\t}\n");
if (commonFirstCheck.size() > 0) {
source.append(" else {\n");
source.append(MessageFormat.format("\t\t\t\tselected_field = {0,number,#};\n", other));
source.append("\t\t\t}\n");
} else {
source.append(MessageFormat.format("\t\t\tselected_field = {0,number,#};\n", other));
}
} else {
boolean first_value = true;
boolean if_added = false;
for (int j = 0; j < crosstagsize; j++) {
final rawAST_coding_taglist cur_choice = fieldInfo.raw.crosstaglist.list.get(j);
if (cur_choice.fields != null && cur_choice.fields.size() > 0) {
if_added = true;
if (first_value) {
source.append("\t\t\tif (");
first_value = false;
......@@ -5207,9 +5213,13 @@ public final class RecordSetCodeGenerator {
other = cur_choice.fieldnum;//TODO no longer needed
}
}
source.append(" else {\n");
source.append(MessageFormat.format("\t\t\t\tselected_field = {0,number,#};\n", other));
source.append("\t\t\t}\n");
if (if_added) {
source.append(" else {\n");
source.append(MessageFormat.format("\t\t\t\tselected_field = {0,number,#};\n", other));
source.append("\t\t\t}\n");
} else {
source.append(MessageFormat.format("\t\t\tselected_field = {0,number,#};\n", other));
}
}
}
/* check the presence of optional field*/
......
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