未验证 提交 ce03e7d9 编写于 作者: B bogdanvlviv
上级 7d5a7b30
......@@ -141,10 +141,10 @@ def test_distance_in_words_with_mixed_argument_types
end
def test_distance_in_words_doesnt_use_the_quotient_operator
rubinius_skip "Date is written in Ruby and relies on Fixnum#/"
jruby_skip "Date is written in Ruby and relies on Fixnum#/"
rubinius_skip "Date is written in Ruby and relies on Integer#/"
jruby_skip "Date is written in Ruby and relies on Integer#/"
# Make sure that we avoid {Integer,Fixnum}#/ (redefined by mathn)
# Make sure that we avoid Integer#/ (redefined by mathn)
Integer.send :private, :/
from = Time.utc(2004, 6, 6, 21, 45, 0)
......
......@@ -177,7 +177,7 @@ def test_add_table_with_decimals
assert BigNumber.create(
bank_balance: 1586.43,
big_bank_balance: BigDecimal("1000234000567.95"),
world_population: 6000000000,
world_population: 2**62,
my_house_population: 3,
value_of_e: BigDecimal("2.7182818284590452353602875")
)
......@@ -191,10 +191,8 @@ def test_add_table_with_decimals
assert_not_nil b.my_house_population
assert_not_nil b.value_of_e
# TODO: set world_population >= 2**62 to cover 64-bit platforms and test
# is_a?(Bignum)
assert_kind_of Integer, b.world_population
assert_equal 6000000000, b.world_population
assert_equal 2**62, b.world_population
assert_kind_of Integer, b.my_house_population
assert_equal 3, b.my_house_population
assert_kind_of BigDecimal, b.bank_balance
......
......@@ -19,7 +19,7 @@ def test_numeric_fields
m = NumericData.new(
bank_balance: 1586.43,
big_bank_balance: BigDecimal("1000234000567.95"),
world_population: 6000000000,
world_population: 2**62,
my_house_population: 3
)
assert m.save
......@@ -27,11 +27,8 @@ def test_numeric_fields
m1 = NumericData.find(m.id)
assert_not_nil m1
# As with migration_test.rb, we should make world_population >= 2**62
# to cover 64-bit platforms and test it is a Bignum, but the main thing
# is that it's an Integer.
assert_kind_of Integer, m1.world_population
assert_equal 6000000000, m1.world_population
assert_equal 2**62, m1.world_population
assert_kind_of Integer, m1.my_house_population
assert_equal 3, m1.my_house_population
......@@ -47,7 +44,7 @@ def test_numeric_fields_with_scale
m = NumericData.new(
bank_balance: 1586.43122334,
big_bank_balance: BigDecimal("234000567.952344"),
world_population: 6000000000,
world_population: 2**62,
my_house_population: 3
)
assert m.save
......@@ -55,11 +52,8 @@ def test_numeric_fields_with_scale
m1 = NumericData.find(m.id)
assert_not_nil m1
# As with migration_test.rb, we should make world_population >= 2**62
# to cover 64-bit platforms and test it is a Bignum, but the main thing
# is that it's an Integer.
assert_kind_of Integer, m1.world_population
assert_equal 6000000000, m1.world_population
assert_equal 2**62, m1.world_population
assert_kind_of Integer, m1.my_house_population
assert_equal 3, m1.my_house_population
......
......@@ -5,7 +5,7 @@ def self.up
create_table :big_numbers do |table|
table.column :bank_balance, :decimal, precision: 10, scale: 2
table.column :big_bank_balance, :decimal, precision: 15, scale: 2
table.column :world_population, :decimal, precision: 10
table.column :world_population, :decimal, precision: 20
table.column :my_house_population, :decimal, precision: 2
table.column :value_of_e, :decimal
end
......
......@@ -547,7 +547,7 @@
create_table :numeric_data, force: true do |t|
t.decimal :bank_balance, precision: 10, scale: 2
t.decimal :big_bank_balance, precision: 15, scale: 2
t.decimal :world_population, precision: 10, scale: 0
t.decimal :world_population, precision: 20, scale: 0
t.decimal :my_house_population, precision: 2, scale: 0
t.decimal :decimal_number_with_default, precision: 3, scale: 2, default: 2.78
t.float :temperature
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册