Commit 18965c20 authored by Botond Baranyi's avatar Botond Baranyi
Browse files

Fixed not_a_number float comparison with str2float return value



Change-Id: I438b8f13c2937140626cb21626a6377b24130934
Signed-off-by: Botond Baranyi's avatarBotond Baranyi <botond.baranyi@ericsson.com>
parent 49accd8b
......@@ -1403,7 +1403,9 @@ double operator/(double double_value, const FLOAT& other_value)
boolean operator==(double double_value, const FLOAT& other_value)
{
other_value.must_bound("Unbound right operand of float comparison.");
return double_value == other_value.float_value;
return double_value == other_value.float_value || // check if they're both NaN
(double_value != double_value &&
other_value.float_value != other_value.float_value);
}
boolean operator<(double double_value, const FLOAT& other_value)
......
......@@ -363,11 +363,22 @@ testcase str_to_float() runs on PDTestComponent{ //In testcase definition//
{setverdict(pass);}
else {setverdict(fail, __LINE__);}
if ((s2fmp16 == str2float(s2fmp16_str))
and (str2float(s2fmp16_str) == s2fmp16)
and (s2fmp16 == not_a_number))
{setverdict(pass);}
else {setverdict(fail, __LINE__);}
}
testcase str_to_float_var_nan() runs on PDTestComponent {
var charstring vl_cs := "not_a_number";
if(str2float(vl_cs) == not_a_number){
setverdict(pass)
} else {
setverdict(fail,"expected not_a_number got:", str2float(vl_cs));
}
}
/*--- STR2HEX --------------------------------------------------*/
......@@ -627,6 +638,7 @@ testcase str_to_oct() runs on PDTestComponent{
control {
execute (str_to_bit());
execute (str_to_float());
execute (str_to_float_var_nan());
execute (str_to_hex());
execute (str_to_int());
execute (str_to_oct());
......
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