Commit af63c8fc authored by Kristof Szabados's avatar Kristof Szabados
Browse files

first (experimental/study) version of a regression test siute for the Java code generator.


Signed-off-by: Kristof Szabados's avatarKristof Szabados <Kristof.Szabados@ericsson.com>
parent 2a609f3c
<?xml version="1.0" encoding="UTF-8"?>
<TITAN_Designer_Properties>
<ActiveConfiguration>Default</ActiveConfiguration>
<ProjectProperties>
<MakefileSettings>
<GNUMake>true</GNUMake>
<incrementalDependencyRefresh>true</incrementalDependencyRefresh>
<targetExecutable>bin/regressionTestSmall</targetExecutable>
<omitInValueList>true</omitInValueList>
</MakefileSettings>
<LocalBuildSettings>
<MakefileScript/>
<workingDirectory>java_src</workingDirectory>
</LocalBuildSettings>
</ProjectProperties>
<FileProperties>
<FileResource>
<FilePath>src/TverdictOper.ttcn</FilePath>
<FileProperties>
<ExcludeFromBuild>true</ExcludeFromBuild>
</FileProperties>
</FileResource>
</FileProperties>
</TITAN_Designer_Properties>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="java_src"/>
<classpathentry kind="src" path="src2"/>
<classpathentry kind="output" path="java_bin"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Regression_Test_java</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.titan.designer.core.TITANJavaBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.titan.designer.core.TITANNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.pde.PluginNature</nature>
</natures>
</projectDescription>
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Regression_Test_java
Bundle-SymbolicName: Regression_Test_java;singleton:=true
Bundle-Version: 1.0.0
Require-Bundle: org.eclipse.titan.runtime;bundle-version="1.0.0",
org.antlr.runtime;bundle-version="4.3.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Export-Package: org.eclipse.titan.Regression_Test_java.generated,
org.eclipse.titan.Regression_Test_java.user_provided
source.. = java_src/
output.. = java_bin/
bin.includes = META-INF/,\
.,\
java_src/,\
src2/,\
.classpath
[MODULE_PARAMETERS]
# This section shall contain the values of all parameters that are defined in your TTCN-3 modules.
[LOGGING]
# In this section you can specify the name of the log file and the classes of events
# you want to log into the file or display on console (standard error).
LogFile := "logs/%e.%h-%r.%s"
FileMask := LOG_ALL #|TESTCASE | STATISTICS #|LOG_ALL #| DEBUG | MATCHING
ConsoleMask := ERROR | WARNING | TESTCASE | STATISTICS #| PORTEVENT | USER
LogSourceInfo := Yes
AppendFile := No
TimeStampFormat := Time
LogEventTypes := No
SourceInfoFormat := Single
LogEntityName := Yes
[EXECUTE]
all_from_subrefs.control
hex_to_OK.control
#functions.control
TtemplateAnytype.control
TtemplateInt.control
replacer_OK.control
TintOper.control
TtemplateFloat.control
TbasicStatem.control
hex_to_SW.control
TtemplateChar.control
#tryCatch_Functions.control
TtemplateBool.control
float_to_OK.control
int_to_SW.control
all_from_subtype.control
all_from_with_functions.control
TcharOper.control
all_from_var.control
float_to_SW.control
TcontrolTimer.control
TrecofOper.control
int_to_OK.control
SelectUnion.control
TtemplateEnum.control
TcharstrOper.control
TtemplateRec.control
rotter_SW.control
TassignmentNotation.control
IsTemplateKind.control
rotter_OK.control
ExclusiveRangeTemplate.control
size_of_SW.control
TtemplateBitstr.control
all_from_subset.control
size_of_OK.control
TucharstrOper.control
TsetofMatch.control
ThexstrOper.control
bit_to_SW.control
TunionOper.control
TrecordOper.control
TenumOper.control
tcname_SW.control
TanytypeOper.control
TfloatOper.control
TbitstrOper.control
all_from_superset.control
bit_to_OK.control
TobjidOper.control
#imported_templates.control
TsetOper.control
tcname_OK.control
char_to_OK.control
TtemplateSetof.control
TboolOper.control
enum_to_OK.control
shifty_SW.control
ToctetstrOper.control
TfloatOperSpecial.control
char_to_SW.control
FuncRef.control
isprecho_OK.control
shifty_OK.control
TtemplateUnion.control
TarrayOper.control
#everything.control
#types.control
sub_str_SW.control
TdefaultOper.control
str_to_SW.control
all_from_complement.control
TlostTimer.control
RAWCodingAttributes.control
#TtemplateRecAsn.control
enum_to_SW.control
all_from_permutation.control
TtemplateSet.control
oct_to_SW.control
sapc.control
TtemplateRecof.control
#ASN_Definitions.control
oct_to_OK.control
sub_str_OK.control
TanytypeWrapOper.control
#ImportedTemplates.control
TsetofOper.control
all_from.control
str_to_OK.control
replacer_SW.control
/******************************************************************************
* Copyright (c) 2000-2019 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:
* Szabo, Bence Janos
*
******************************************************************************/
module ExclusiveRangeTemplate {
type component EmptyCT {}
testcase tc_integer() runs on EmptyCT {
template integer positive_templ:= (!1 .. !10);
var integer f := 10;
if (match(f, positive_templ)) {
setverdict(fail, match(f, positive_templ));
}
f := 1;
if (match(f, positive_templ)) {
setverdict(fail, match(f, positive_templ));
}
f := 0;
if (match(f, positive_templ)) {
setverdict(fail, match(f, positive_templ));
}
f := 2;
if (match(f, positive_templ) == false) {
setverdict(fail, match(f, positive_templ));
}
f := 9;
if (match(f, positive_templ) == false) {
setverdict(fail, match(f, positive_templ));
}
if ("(!1 .. !10)" != log2str(positive_templ)) {
setverdict(fail, match("(!1 .. !10)", log2str(positive_templ)));
}
template integer copy_positive_templ := positive_templ;
if (log2str(positive_templ) != log2str(copy_positive_templ)) {
setverdict(fail, match(log2str(positive_templ), log2str(copy_positive_templ)));
}
var template integer tmp;
// string2ttcn(ttcn2string(positive_templ), tmp);
// if (log2str(positive_templ) != log2str(tmp)) {
// setverdict(fail, "Expected: ", positive_templ, " Got: ", tmp);
// }
template integer negative_templ:= (!-10 .. !-1);
f := -10;
if (match(f, negative_templ)) {
setverdict(fail, match(f, negative_templ));
}
f := -1;
if (match(f, negative_templ)) {
setverdict(fail, match(f, negative_templ));
}
f := 0;
if (match(f, negative_templ)) {
setverdict(fail, match(f, negative_templ));
}
f := -1;
if (match(f, negative_templ)) {
setverdict(fail, match(f, negative_templ));
}
f := -2;
if (match(f, negative_templ) == false) {
setverdict(fail, match(f, negative_templ));
}
f := -9;
if (match(f, negative_templ) == false) {
setverdict(fail, match(f, negative_templ));
}
if ("(!-10 .. !-1)" != log2str(negative_templ)) {
setverdict(fail, match("(!-10 .. !-1)", log2str(negative_templ)));
}
template integer copy_negative_templ := negative_templ;
if (log2str(negative_templ) != log2str(copy_negative_templ)) {
setverdict(fail, match(log2str(negative_templ), log2str(copy_negative_templ)));
}
setverdict(pass);
}
testcase tc_float() runs on EmptyCT {
template float positive_templ:= (!1.0 .. !10.0);
var float f := 10.0;
if (match(f, positive_templ)) {
setverdict(fail, match(f, positive_templ));
}
f := 1.0;
if (match(f, positive_templ)) {
setverdict(fail, match(f, positive_templ));
}
f := 0.0;
if (match(f, positive_templ)) {
setverdict(fail, match(f, positive_templ));
}
f := 1.0;
if (match(f, 11.0)) {
setverdict(fail, match(f, positive_templ));
}
f := 2.0;
if (match(f, positive_templ) == false) {
setverdict(fail, match(f, positive_templ));
}
f := 9.0;
if (match(f, positive_templ) == false) {
setverdict(fail, match(f, positive_templ));
}
if ("(!1.000000 .. !10.000000)" != log2str(positive_templ)) {
setverdict(fail, match("(!1.000000 .. !10.000000)", log2str(positive_templ)));
}
template float copy_positive_templ := positive_templ;
if (log2str(positive_templ) != log2str(copy_positive_templ)) {
setverdict(fail, match(log2str(positive_templ), log2str(copy_positive_templ)));
}
var template float tmp;
// string2ttcn(ttcn2string(positive_templ), tmp);
// if (log2str(positive_templ) != log2str(tmp)) {
// setverdict(fail, "Expected: ", positive_templ, " Got: ", tmp);
// }
template float negative_templ := (!-10.0 .. !-1.0);
f := -10.0;
if (match(f, negative_templ)) {
setverdict(fail, match(f, negative_templ));
}
f := -1.0;
if (match(f, negative_templ)) {
setverdict(fail, match(f, negative_templ));
}
f := -0.0;
if (match(f, negative_templ)) {
setverdict(fail, match(f, negative_templ));
}
f := -11.0;
if (match(f, negative_templ)) {
setverdict(fail, match(f, negative_templ));
}
f := -2.0;
if (match(f, negative_templ) == false) {
setverdict(fail, match(f, negative_templ));
}
f := -9.0;
if (match(f, negative_templ) == false) {
setverdict(fail, match(f, negative_templ));
}
f := -5.0;
if (match(f, negative_templ) == false) {
setverdict(fail, match(f, negative_templ));
}
if ("(!-10.000000 .. !-1.000000)" != log2str(negative_templ)) {
setverdict(fail, match("(!-10.000000 .. !-1.000000)", log2str(negative_templ)));
}
template float copy_negative_templ := negative_templ;
if (log2str(negative_templ) != log2str(copy_negative_templ)) {
setverdict(fail, match(log2str(negative_templ), log2str(copy_negative_templ)));
}
// string2ttcn(ttcn2string(negative_templ), tmp);
// if (log2str(negative_templ) != log2str(tmp)) {
// setverdict(fail, "Expected: ", negative_templ, " Got: ", tmp);
// }
template float infinity_templ := (!-infinity .. !infinity);
if (match(f, infinity_templ) == false) {
setverdict(fail, match(f, infinity_templ));
}
f := -infinity;
if (match(f, infinity_templ)) {
setverdict(fail, match(f, infinity_templ));
}
f := infinity;
if (match(f, infinity_templ)) {
setverdict(fail, match(f, infinity_templ));
}
if ("(!-infinity .. !infinity)" != log2str(infinity_templ)) {
setverdict(fail, match("(!-infinity .. !infinity)", log2str(infinity_templ)));
}
template float copy_infinity_templ := infinity_templ;
if (log2str(infinity_templ) != log2str(copy_infinity_templ)) {
setverdict(fail, match(log2str(infinity_templ), log2str(copy_infinity_templ)));
}
setverdict(pass);
}
testcase tc_charstring() runs on EmptyCT {
template charstring templ:= (!"d" .. !"g");
var charstring f := "d";
if (match(f, templ)) {
setverdict(fail, match(f, templ));
}
f := "g";
if (match(f, templ)) {
setverdict(fail, match(f, templ));
}
f := "f";
if (match(f, templ) == false) {
setverdict(fail, match(f, templ));
}
f := "j";
if (match(f, templ)) {
setverdict(fail, match(f, templ));
}
f := "eeefff";
if (match(f, templ) == false) {
setverdict(fail, match(f, templ));
}
f := "dddeeefff";
if (match(f, templ)) {
setverdict(fail, match(f, templ));
}
f := "eeefffggg";
if (match(f, templ)) {
setverdict(fail, match(f, templ));
}
if ("(!\"d\" .. !\"g\")" != log2str(templ)) {
setverdict(fail, match("(!\"d\" .. !\"g\")", log2str(templ)));
}
template charstring copy_templ := templ;
if (log2str(templ) != log2str(copy_templ)) {
setverdict(fail, match(log2str(templ), log2str(copy_templ)));
}
// var template charstring tmp;
// string2ttcn(ttcn2string(templ), tmp);
// if (log2str(templ) != log2str(tmp)) {
// setverdict(fail, "Expected: ", templ, " Got: ", tmp);
// }
setverdict(pass);
}
testcase tc_universal_charstring() runs on EmptyCT {
template universal charstring charstr_templ:= (!"d" .. !"g");
var universal charstring f := "d";
if (match(f, charstr_templ)) {
setverdict(fail, match(f, charstr_templ));
}
f := "g";
if (match(f, charstr_templ)) {
setverdict(fail, match(f, charstr_templ));
}
f := "f";
if (match(f, charstr_templ) == false) {
setverdict(fail, match(f, charstr_templ));
}
f := "j";
if (match(f, charstr_templ)) {
setverdict(fail, match(f, charstr_templ));
}
f := "eeefff";
if (match(f, charstr_templ) == false) {
setverdict(fail, match(f, charstr_templ));
}
f := "dddeeefff";
if (match(f, charstr_templ)) {
setverdict(fail, match(f, charstr_templ));
}
f := "eeefffggg";
if (match(f, charstr_templ)) {
setverdict(fail, match(f, charstr_templ));
}
if ("(!\"d\" .. !\"g\")" != log2str(charstr_templ)) {
setverdict(fail, match("(!\"d\" .. !\"g\")", log2str(charstr_templ)));
}
template universal charstring copy_charstr_templ := charstr_templ;
if (log2str(charstr_templ) != log2str(copy_charstr_templ)) {
setverdict(fail, match(log2str(charstr_templ), log2str(copy_charstr_templ)));
}
var template universal charstring tmp;
// string2ttcn(ttcn2string(charstr_templ), tmp);
// if (log2str(charstr_templ) != log2str(tmp)) {
// setverdict(fail, "Expected: ", charstr_templ, " Got: ", tmp);
// }
template universal charstring unicharstr_templ:= (!char(1,2,3,4) .. !char(1,2,4,5));
f := char(1,2,3,4);
if (match(f, unicharstr_templ)) {
setverdict(fail, match(f, unicharstr_templ));
}
f := char(1,2,4,5);
if (match(f, unicharstr_templ)) {
setverdict(fail, match(f, unicharstr_templ));
}
f := char(1,2,3,5);
if (match(f, unicharstr_templ) == false) {
setverdict(fail, match(f, unicharstr_templ));
}
f := char(1,2,4,4);
if (match(f, unicharstr_templ) == false) {
setverdict(fail, match(f, unicharstr_templ));
}
if ("(!char(1, 2, 3, 4) .. !char(1, 2, 4, 5))" != log2str(unicharstr_templ)) {
setverdict(fail, match("(!char(1, 2, 3, 4) .. !char(1, 2, 4, 5))", log2str(unicharstr_templ)));
}
template universal charstring copy_unicharstr_templ := unicharstr_templ;
if (log2str(unicharstr_templ) != log2str(copy_unicharstr_templ)) {
setverdict(fail, match(log2str(unicharstr_templ), log2str(copy_unicharstr_templ)));
}
// string2ttcn(ttcn2string(unicharstr_templ), tmp);
// if (log2str(unicharstr_templ) != log2str(tmp)) {
// setverdict(fail, "Expected: ", unicharstr_templ, " Got: ", tmp);
// }
setverdict(pass);
}
template integer positive_templ_glob:= (!1 .. !10);
// Test that is works with global const template
testcase tc_global_template_integer() runs on EmptyCT {
var integer f := 10;
if (match(f, positive_templ_glob)) {
setverdict(fail, match(f, positive_templ_glob));
}
f := 1;
if (match(f, positive_templ_glob)) {
setverdict(fail, match(f, positive_templ_glob));
}
f := 0;
if (match(f, positive_templ_glob)) {
setverdict(fail, match(f, positive_templ_glob));
}
f := 2;
if (match(f, positive_templ_glob) == false) {
setverdict(fail, match(f, positive_templ_glob));
}
f := 9;
if (match(f, positive_templ_glob) == false) {
setverdict(fail, match(f, positive_templ_glob));
}
if ("(!1 .. !10)" != log2str(positive_templ_glob)) {
setverdict(fail, match("(!1 .. !10)", log2str(positive_templ_glob)));
}
template integer copy_positive_templ := positive_templ_glob;
if (log2str(positive_templ_glob) != log2str(copy_positive_templ)) {
setverdict(fail, match(log2str(positive_templ_glob), log2str(copy_positive_templ)));
}
setverdict(pass);
}
// Test that it works with testcase local var template
testcase tc_testcase_var_template_integer() runs on EmptyCT {
var template integer positive_templ:= (!1 .. !10);
var integer f := 10;
if (match(f, positive_templ)) {
setverdict(fail, match(f, positive_templ));
}
f := 1;
if (match(f, positive_templ)) {
setverdict(fail, match(f, positive_templ));
}
f := 0;
if (match(f, positive_templ)) {
setverdict(fail, match(f, positive_templ));
}
f := 2;
if (match(f, positive_templ) == false) {
setverdict(fail, match(f, positive_templ));
}
f := 9;
if (match(f, positive_templ) == false) {
setverdict(fail, match(f, positive_templ));
}
if ("(!1 .. !10)" != log2str(positive_templ)) {
setverdict(fail, match("(!1 .. !10)", log2str(positive_templ)));
}
template integer copy_positive_templ := positive_templ;
if (log2str(positive_templ) != log2str(copy_positive_templ)) {
setverdict(fail, match(log2str(positive_templ), log2str(copy_positive_templ)));
}