mirror of
https://github.com/enso-org/enso.git
synced 2024-12-23 16:15:11 +03:00
tests for f/d conversion warnings
This commit is contained in:
parent
58913e7604
commit
d2f4e7e821
@ -130,6 +130,9 @@ add_specs suite_builder =
|
||||
Decimal.from 12345 . should_equal (Decimal.new 12345)
|
||||
Decimal.from 12345 . should_equal (Decimal.from_integer 12345)
|
||||
|
||||
group_builder.specify "should attach a Loss_Of_Numeric_Precision warning when converting float to decimal with .from" <|
|
||||
Problems.expect_only_warning Loss_Of_Numeric_Precision (Decimal.from 123.45)
|
||||
|
||||
group_builder.specify "constructor should respect Math_Context " <|
|
||||
Decimal.new 12000 (Math_Context.new 0) . should_equal 12000
|
||||
Decimal.new 12000 (Math_Context.new 1) . should_equal 10000
|
||||
@ -610,6 +613,9 @@ add_specs suite_builder =
|
||||
f.should_be_a Float
|
||||
f.should_equal 56.34
|
||||
|
||||
group_builder.specify "should attach a Loss_Of_Numeric_Precision warning when converting decimal to float with .from" <|
|
||||
Problems.expect_only_warning Loss_Of_Numeric_Precision (Float.from (Decimal.new "56.34"))
|
||||
|
||||
group_builder.specify "Decimal.to_float cannot compare correctly with the original Decimal" <|
|
||||
huge_a = Decimal.new "3.4E300"
|
||||
huge_a_float = Float.from huge_a
|
||||
|
Loading…
Reference in New Issue
Block a user