Add test/validation for is_float if created from an arithmetical operation
This commit is contained in:
parent
b86f5dc129
commit
a773281760
2 changed files with 5 additions and 1 deletions
|
@ -15,7 +15,7 @@ Returns true if the variable passed to this function is a float.
|
||||||
|
|
||||||
value = arguments[0]
|
value = arguments[0]
|
||||||
|
|
||||||
if value != value.to_f.to_s then
|
if value != value.to_f.to_s and !value.is_a? Float then
|
||||||
return false
|
return false
|
||||||
else
|
else
|
||||||
return true
|
return true
|
||||||
|
|
|
@ -26,4 +26,8 @@ describe "the is_float function" do
|
||||||
result = scope.function_is_float(["3"])
|
result = scope.function_is_float(["3"])
|
||||||
result.should(eq(false))
|
result.should(eq(false))
|
||||||
end
|
end
|
||||||
|
it "should return true if a float is created from an arithmetical operation" do
|
||||||
|
result = scope.function_is_float([3.2*2])
|
||||||
|
result.should(eq(true))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue