1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

use assert_in_delta() for floating point comparisons in tests [#4871 state:resolved]

Signed-off-by: Carl Lerche <carllerche@mac.com>
This commit is contained in:
Aaron Patterson 2010-06-16 09:59:59 -07:00 committed by Carl Lerche
parent 07c6b7a6ad
commit 8e56085817

View file

@ -1032,7 +1032,7 @@ if ActiveRecord::Base.connection.supports_migrations?
elsif current_adapter?(:SQLiteAdapter)
# - SQLite3 stores a float, in violation of SQL
assert_kind_of BigDecimal, b.value_of_e
assert_equal BigDecimal("2.71828182845905"), b.value_of_e
assert_in_delta BigDecimal("2.71828182845905"), b.value_of_e, 0.00000000000001
else
# - SQL standard is an integer
assert_kind_of Fixnum, b.value_of_e