Add test/validation for is_float if created from an arithmetical operation

This commit is contained in:
stephen 2013-01-03 14:05:29 +00:00 committed by Jeff McCune
parent b86f5dc129
commit a773281760
2 changed files with 5 additions and 1 deletions

View file

@ -15,7 +15,7 @@ Returns true if the variable passed to this function is a float.
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
else
return true

View file

@ -26,4 +26,8 @@ describe "the is_float function" do
result = scope.function_is_float(["3"])
result.should(eq(false))
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