Commit d5f9c1f0 authored by balaskoa's avatar balaskoa
Browse files

Regression_Test_java/floatOper mapped from titan.core


Signed-off-by: default avatarbalaskoa <Jeno.Balasko@ericsson.com>
parent 73ed0d00
......@@ -16,13 +16,14 @@
#"src/cfgFile/ordered_include/oi_after_list1.cfg" #Error while setting parameter field 'tsp_c' to '0': Type mismatch: charstring value was expected instead of null.
#!!!! "src/cfgFile/testport_parameters/array_index.cfg" #compiled, not runnining, it shall be excluded anyway!!!
"src/cfg_list_concat/everything.cfg"
"src/ucharstrOper/config.cfg"
"src/floatOper/config.cfg" #25 pass
"src/hexstrOper/config.cfg" #TODO: one testase is commented out (send())
"src/implicitOmit/config.cfg" #ok, 18 pass
"src/text2ttcn_nolegacy/text2ttcn_1.cfg"
#"src/text2ttcn/text2ttcn_1.cfg" #legacy mode
"src/recofOper/config.cfg" #62 pass + 2 tc moved to single_bugs.cfg
"src/templateRecof/config.cfg" #ok 38 pass
"src/ucharstrOper/config.cfg"
[EXECUTE]
#==acceptance_test==
......
......@@ -15,8 +15,13 @@
*
******************************************************************************/
module TfloatOper
{const float TfloatOper_const1:=2.0;
{
const float TfloatOper_const1:=2.0;
type component floatOper_comptype { };
modulepar float tsp_f_unchanged := 1.2+3.6/2.0;
modulepar float tsp_f_changed1 := 1.2+3.6/2.0;
modulepar float tsp_f_changed2;
modulepar float tsp_f_uninit_notchanged;
testcase floatAssign() runs on floatOper_comptype
{ var float x1:=12E3;
......@@ -284,6 +289,15 @@ testcase floatDiv() runs on floatOper_comptype
else {setverdict(fail);}
if (((x6+4.0)<1E-12)and((-4.0-x6)>-1E-12)) {setverdict(pass);} //value_value
else {setverdict(fail);}
//Divide by zero:
x1 := 1.0;
x2 := 0.0;
@try {
if (x1/x2 == infinity) {log(x1/x1) } else {log(x1/x2)}
setverdict(fail, "This line should not be reached, DTE expected")
} @catch(e){
setverdict(pass, "DTE expected: ", e);
}
}
type component floatOperSubtypes_comptype { }
......@@ -433,7 +447,7 @@ testcase floatComparison() runs on floatOper_comptype {
if (NaN > NaN) { setverdict(fail, __LINE__, ": not_a_number<not_a_number:NotOK") }
}
testcase constFloatComparison() runs on floatOper_comptype {
testcase tc_floatComparison_const() runs on floatOper_comptype {
//
const float minus_zero := -0.0;
const float plus_zero := 0.0;
......@@ -481,6 +495,107 @@ testcase constFloatComparison() runs on floatOper_comptype {
if (NaN > NaN) { setverdict(fail, __LINE__, ": not_a_number<not_a_number:NotOK") }
}
//runtime evaluation
testcase tc_floatComparison_var() runs on floatOper_comptype {
//
var float minus_zero := -0.0;
var float plus_zero := 0.0;
//----------------
if (minus_zero == -0.0) { setverdict(pass); } else { setverdict(fail, __LINE__, ": -0.0 NOT == -0.0") }
if (minus_zero <= 0.0) { setverdict(pass); } else { setverdict(fail, __LINE__, ": -0.0 NOT <= 0.0") }
if (minus_zero < 0.0) { setverdict(pass); } else { setverdict(fail, __LINE__, ": -0.0 NOT < 0.0") }
if (minus_zero <= plus_zero) { setverdict(pass); } else { setverdict(fail, __LINE__, ": -0.0 NOT <= 0.0") }
if (minus_zero < plus_zero) { setverdict(pass); } else { setverdict(fail, __LINE__, ": -0.0 NOT < 0.0") }
if (plus_zero >= minus_zero) { setverdict(pass); } else { setverdict(fail, __LINE__, ": 0.0 NOT >= -0.0") }
if (plus_zero > minus_zero) { setverdict(pass); } else { setverdict(fail, __LINE__, ": 0.0 NOT > -0.0") }
if (-infinity < minus_zero ) { setverdict(pass); } else { setverdict(fail, __LINE__, ": -infinity NOT < -0.0") }
if (-infinity <= minus_zero ) { setverdict(pass); } else { setverdict(fail, __LINE__, ": -infinity NOT <= -0.0") }
if (minus_zero < infinity) { setverdict(pass); } else { setverdict(fail, __LINE__, ": -0.0 NOT < infinity") }
if (minus_zero <= infinity) { setverdict(pass); } else { setverdict(fail, __LINE__, ": -0.0 NOT <= infinity") }
if (minus_zero < not_a_number) { setverdict(pass); } else { setverdict(fail, __LINE__, ": -0.0 NOT < not_a_number") }
if (minus_zero <= not_a_number) { setverdict(pass); } else { setverdict(fail, __LINE__, ": -0.0 NOT <= not_a_number") }
if (not_a_number > minus_zero) { setverdict(pass); } else { setverdict(fail, __LINE__, ": not_a_number NOT > -0.0") }
if (not_a_number >= minus_zero) { setverdict(pass); } else { setverdict(fail, __LINE__, ": notc_floatComparison_const.0") }
//----------------
var float plus_inf := infinity;
if (plus_inf == infinity) { setverdict(pass); } else { setverdict(fail, __LINE__, ": infinity==infinity:NotOK") }
if (-infinity < plus_inf ) { setverdict(pass); } else { setverdict(fail, __LINE__, ": -infinity<infinity:NotOK") }
if (-infinity <= plus_inf ) { setverdict(pass); } else { setverdict(fail, __LINE__, ": -infinity<=infinity:NotOK") }
if (plus_inf < not_a_number) { setverdict(pass); } else { setverdict(fail, __LINE__, ": infinity<not_a_number:NotOK") }
if (plus_inf <= not_a_number) { setverdict(pass); } else { setverdict(fail, __LINE__, ": infinity<=not_a_number:NotOK") }
//----------------
var float minus_inf := -infinity;
if (minus_inf == -infinity) { setverdict(pass); } else { setverdict(fail, __LINE__, ": -infinity==-infinity:NotOK") }
if (minus_inf < not_a_number) { setverdict(pass); } else { setverdict(fail, __LINE__, ": -infinity<not_a_number:NotOK") }
if (minus_inf <= not_a_number) { setverdict(pass); } else { setverdict(fail, __LINE__, ": -infinity<=not_a_number:NotOK") }
//----------------
var float NaN := not_a_number;
if (NaN == NaN) { setverdict(pass); } else { setverdict(fail, __LINE__, ": not_a_number != not_a_number:NotOK") }
if (NaN != NaN) { setverdict(fail, __LINE__, ": not_a_number==not_a_number:NotOK") }
if (NaN != not_a_number) { setverdict(fail, __LINE__, ": not_a_number==not_a_number:NotOK") }
if (NaN < NaN) { setverdict(fail, __LINE__, ": not_a_number<not_a_number:NotOK") }
if (NaN > NaN) { setverdict(fail, __LINE__, ": not_a_number<not_a_number:NotOK") }
if (minus_inf < NaN) { setverdict(pass); } else { setverdict(fail, __LINE__, ": -infinity<not_a_number:NotOK") }
if (minus_inf <= NaN) { setverdict(pass); } else { setverdict(fail, __LINE__, ": -infinity<=not_a_number:NotOK") }
if (NaN > minus_inf) { setverdict(pass); } else { setverdict(fail, __LINE__, ": -infinity<not_a_number:NotOK") }
if (NaN >= minus_inf) { setverdict(pass); } else { setverdict(fail, __LINE__, ": -infinity<not_a_number:NotOK") }
if (NaN < minus_inf) { setverdict(fail, __LINE__, ": -infinity>not_a_number:NotOK") } else { setverdict(pass); }
if (NaN <= minus_inf) { setverdict(fail, __LINE__, ": -infinity<not_a_number:NotOK") } else { setverdict(pass); }
if (plus_inf < NaN) { setverdict(pass); } else { setverdict(fail, __LINE__, ": infinity<not_a_number failed") }
if (plus_inf <= NaN) { setverdict(pass); } else { setverdict(fail, __LINE__, ": infinity<=not_a_number failed") }
if (plus_inf > NaN) { setverdict(fail, __LINE__, ": infinity>not_a_number failed") } else { setverdict(pass); }
if (plus_inf >= NaN) { setverdict(fail, __LINE__, ": infinity>=not_a_number failed") } else { setverdict(pass); }
}
testcase tc_float_modulepars() runs on floatOper_comptype {
if (tsp_f_unchanged == 3.0 ) {
setverdict(pass)
} else {
setverdict(fail, "Expected: 3.0, got ",tsp_f_unchanged);
}
if (tsp_f_changed1 == 3.0 ) {
setverdict(pass, tsp_f_changed1)
} else {
setverdict(fail, "Expected: 3.0, got ",tsp_f_changed1);
}
if (tsp_f_changed2 == -1.3 ) {
setverdict(pass, tsp_f_changed2)
} else {
setverdict(fail, "Expected: -1.3, got ",tsp_f_changed2);
}
}
testcase tc_float_log2str() runs on floatOper_comptype {
var float f1, f2, f3;
f1 := 1.0;
if( log2str(f1) == "1.000000") {setverdict(pass)} else { setverdict(fail,f1)}
f1 := -1.0;
if( log2str(f1) == "-1.000000") {setverdict(pass)} else { setverdict(fail,f1)}
f1 := -1.0e+3;
if( log2str(f1) == "-1000.000000") {setverdict(pass)} else { setverdict(fail,f1)}
f1 := -1.0e+30;
if( log2str(f1) == "-1.000000e+30") {setverdict(pass)} else { setverdict(fail,f1)}
f1 := infinity;
if( log2str(f1) == "infinity") {setverdict(pass)} else { setverdict(fail,f1)}
f1 := -infinity;
if( log2str(f1) == "-infinity") {setverdict(pass)} else { setverdict(fail,f1)}
f1 := infinity/infinity;
if( log2str(f1) == "not_a_number") {setverdict(pass)} else { setverdict(fail,log2str(f1)) }
if( log2str(f2) == "<unbound>") {setverdict(pass)} else { setverdict(fail,f2)}
}
control {
const float cl_1:=2.0;
var float vl_1;
......@@ -501,7 +616,10 @@ control {
execute(floatIsvalue());
execute(floatIsbound());
execute(floatComparison());
execute(constFloatComparison());
execute(tc_floatComparison_const());
execute(tc_floatComparison_var());
execute(tc_float_modulepars());
execute(tc_float_log2str());
}
}
/******************************************************************************
* Copyright (c) 2000-2019 Ericsson Telecom AB
* Copyright (c) 2000-2017 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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Szabo, Bence Janos
......
###############################################################################
# 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:
# Balasko, Jeno
# Szabo, Janos Zoltan – initial implementation
# Szabo, Bence Janos
#
###############################################################################
[MODULE_PARAMETERS]
tsp_f_changed1 := 1.2 + 3.6 / 2.0
#Stops at reading cfg file:
#Error while setting parameter field 'tsp_f_changed2' to '3.600000 / 0.000000': Floating point division by zero
#tsp_f_changed2 := 1.2+3.8/0.0; //division zero
tsp_f_changed2 := -tsp_f_changed1+ 2.0*1.5- 1.3
[LOGGING]
Logfile := "floatOper.log"
FileMask := LOG_ALL
ConsoleMask := TTCN_WARNING | TTCN_ERROR | TTCN_TESTCASE | TTCN_STATISTICS
[EXECUTE]
TfloatOper
TfloatOperSpecial
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