Skip to content
Snippets Groups Projects
Commit bef321bb authored by Botond Baranyi's avatar Botond Baranyi
Browse files

Added missing tests (issue #585)


Signed-off-by: default avatarBotond Baranyi <botond.baranyi@ericsson.com>
parent debacc08
No related branches found
No related tags found
10 merge requests!258OOP: classes embedded in structures - part 1 (issue #601),!243OOP: added semantic checks for overriding/shadowing object methods (issue #596),!242OOP: updated presence checking operators and object methods (issue #596),!241OOP: fixed super-constructor call parameter code generation for structured values and templates (issue #591),!239Fixed an issue with the parameter default value location change (issue #581),!238OOP: fixed name clash in the constructor and improved previous modifications...,!237Made location information for parameter default value assignments more accurate (issue #581),!236Fixed 'implicit omit' inside optional fields that are present (issue #588),!234Added location information to formal parameter default value assignments (issue #581),!233XER: fixed untagged optional union decoding error (issue #585)
Issue585
Issue585.exe
Issue585*.cc
Issue585*.hh
Issue585*.d
compile
Issue585*.log
/******************************************************************************
* 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:
* Baranyi, Botond
*
******************************************************************************/
module Issue585 {
type record Rec {
integer num,
Uni1 u1 optional,
Uni2 u2
}
type union Uni1 {
charstring x1,
octetstring x2
}
with {
variant "untagged";
}
type union Uni2 {
charstring y1,
octetstring y2
}
with {
variant "untagged";
}
type component CT {}
testcase tc_issue585() runs on CT {
var Rec val := { 4, omit, { y2 := 'ABCD'O } };
var universal charstring enc := encvalue_unichar(val);
var universal charstring enc_exp := "<ns:Rec xmlns:ns='www.somewhere.com/xml2'>\n\t<ns:num>4</ns:num>\n\t<ns:y2>ABCD</ns:y2>\n</ns:Rec>\n\n";
if (enc != enc_exp) {
setverdict(fail, "Encoding failed. Expected: ", enc_exp, ", got: ", enc);
}
var Rec dec;
var integer res := decvalue_unichar(enc, dec);
if (res != 0 or dec != val) {
setverdict(fail, "Decoding failed. Expected: ", val, ", got: ", dec, " (result: ", res, ")");
}
setverdict(pass);
}
control {
execute(tc_issue585());
}
}
with {
encode "XML";
variant "elementFormQualified";
variant "namespace as 'www.somewhere.com/xml2' prefix 'ns'";
variant "controlNamespace 'http://www.w3.org/2001/XMLSchema-instance' prefix 'xsi'";
}
##############################################################################
# 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:
# Baranyi, Botond
#
##############################################################################
TOPDIR = ../..
include $(TOPDIR)/Makefile.regression
# WARNING! This Makefile can be used with GNU make only.
# Other versions of make may report syntax errors in it.
#
# Do NOT touch this line...
#
.PHONY: all archive check clean dep objects
.SUFFIXES: .d
#
# Set these variables...
#
# Flags for the C++ preprocessor (and makedepend as well):
#CPPFLAGS +=
# Flags for dependency generation
CXXDEPFLAGS = -MM
# Flags for the C++ compiler:
CXXFLAGS += -Wall
# Flags for the linker:
#LDFLAGS +=
# Flags for the TTCN-3 and ASN.1 compiler:
#COMPILER_FLAGS +=
# Execution mode: (either ttcn3 or ttcn3-parallel)
TTCN3_LIB = ttcn3$(RT2_SUFFIX)$(DYNAMIC_SUFFIX)
#
# You may change these variables. Add your files if necessary...
#
# TTCN-3 modules of this project:
TTCN3_MODULES = Issue585.ttcn
# ASN.1 modules of this project:
ASN1_MODULES =
# C++ source & header files generated from the TTCN-3 & ASN.1 modules of
# this project:
GENERATED_SOURCES = $(TTCN3_MODULES:.ttcn=.cc) $(ASN1_MODULES:.asn=.cc)
GENERATED_HEADERS = $(GENERATED_SOURCES:.cc=.hh)
ifdef SPLIT_TO_SLICES
POSTFIXES := $(foreach file, $(SPLIT_TO_SLICES), $(addsuffix $(file), _part_))
POSTFIXES := $(foreach file, $(POSTFIXES), $(addprefix $(file), .cc))
GENERATED_SOURCES2 := $(foreach file, $(GENERATED_SOURCES:.cc=), $(addprefix $(file), $(POSTFIXES)))
GENERATED_SOURCES += $(GENERATED_SOURCES2)
endif
# C/C++ Source & header files of Test Ports, external functions and
# other modules:
USER_SOURCES =
USER_HEADERS = $(USER_SOURCES:.cc=.hh)
# Object files of this project that are needed for the executable test suite:
OBJECTS = $(GENERATED_OBJECTS) $(USER_OBJECTS)
GENERATED_OBJECTS = $(GENERATED_SOURCES:.cc=.o)
USER_OBJECTS = $(USER_SOURCES:.cc=.o)
DEPFILES = $(USER_OBJECTS:.o=.d) $(GENERATED_OBJECTS:.o=.d)
# Other files of the project (Makefile, configuration files, etc.)
# that will be added to the archived source files:
OTHER_FILES = Makefile
# The name of the executable test suite:
TARGET = Issue585$(EXESUFFIX)
#
# Rules for building the executable...
#
all: $(TARGET) ;
objects: $(OBJECTS) compile;
$(TARGET): $(OBJECTS)
if $(CXX) $(LDFLAGS) -o $@ $^ \
-L$(TTCN3_DIR)/lib -l$(TTCN3_LIB) \
-L$(OPENSSL_DIR)/lib -lcrypto \
-L$(XMLDIR)/lib $($(PLATFORM)_LIBS); \
then : ; else $(TTCN3_DIR)/bin/titanver $(OBJECTS); exit 1; fi
.cc.o .c.o:
$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) -o $@ $<
.cc.d .c.d:
@echo Creating dependency file for '$<'; set -e; \
$(CXX) $(CXXDEPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $< \
| sed 's/\($*\)\.o[ :]*/\1.o $@ : /g' > $@; \
[ -s $@ ] || rm -f $@
$(GENERATED_SOURCES) $(GENERATED_HEADERS): compile
@if [ ! -f $@ ]; then $(RM) compile; $(MAKE) compile; fi
compile: $(TTCN3_MODULES) $(ASN1_MODULES)
$(TTCN3_COMPILER) $(COMPILER_FLAGS) $^ - $?
touch $@
clean distclean:
-$(RM) $(TARGET) $(OBJECTS) $(GENERATED_HEADERS) \
$(GENERATED_SOURCES) compile $(DEPFILES) \
tags *.log
dep: $(GENERATED_SOURCES) $(USER_SOURCES) ;
ifeq ($(findstring n,$(MAKEFLAGS)),)
ifeq ($(filter clean distclean check compile archive diag,$(MAKECMDGOALS)),)
-include $(DEPFILES)
endif
endif
diag:
$(TTCN3_COMPILER) -v 2>&1
$(TTCN3_DIR)/bin/mctr_cli -v 2>&1
$(CXX) -v 2>&1
@echo TTCN3_DIR=$(TTCN3_DIR)
@echo OPENSSL_DIR=$(OPENSSL_DIR)
@echo XMLDIR=$(XMLDIR)
@echo PLATFORM=$(PLATFORM)
#
# Add your rules here if necessary...
#
run: $(TARGET)
./$^
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment