summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorcryptogopher <cryptogopher@noreply.me>2023-07-01 16:24:53 +0200
committergit <svn-admin@ruby-lang.org>2023-07-05 20:15:52 +0000
commit10f59dcbcd21807887ea0ebb1d0732f0fa32d416 (patch)
tree74d00240919bc2e4ef913f9541069eaf30557cda /test
parent1dde9d726099fc4e4b06b8c848c85eac195c521b (diff)
[ruby/bigdecimal] Add .to_s('F') digit grouping for integer part
https://github.com/ruby/bigdecimal/commit/f63544d465
Diffstat (limited to 'test')
-rw-r--r--test/bigdecimal/test_bigdecimal.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/test/bigdecimal/test_bigdecimal.rb b/test/bigdecimal/test_bigdecimal.rb
index 2fc22d224f..b1557619a8 100644
--- a/test/bigdecimal/test_bigdecimal.rb
+++ b/test/bigdecimal/test_bigdecimal.rb
@@ -1415,9 +1415,13 @@ class TestBigDecimal < Test::Unit::TestCase
end
def test_to_s
- assert_equal('-123.45678 90123 45678 9', BigDecimal('-123.45678901234567890').to_s('5F'))
- assert_equal('+123.45678901 23456789', BigDecimal('123.45678901234567890').to_s('+8F'))
- assert_equal(' 123.4567890123456789', BigDecimal('123.45678901234567890').to_s(' F'))
+ assert_equal('0.0', BigDecimal('0').to_s)
+ assert_equal('-123 45678 90123.45678 90123 45678 9', BigDecimal('-1234567890123.45678901234567890').to_s('5F'))
+ assert_equal('+12345 67890123.45678901 23456789', BigDecimal('1234567890123.45678901234567890').to_s('+8F'))
+ assert_equal(' 1234567890123.4567890123456789', BigDecimal('1234567890123.45678901234567890').to_s(' F'))
+ assert_equal('100 000 000 000.000 000 000 01', BigDecimal('100000000000.00000000001').to_s('3F'))
+ assert_equal('0.0 0 0 0 0 0 0 0 0 0 0 0 1', BigDecimal('0.0000000000001').to_s('1F'))
+ assert_equal('+1000000 0000000.0', BigDecimal('10000000000000').to_s('+7F'))
assert_equal('0.1234567890123456789e3', BigDecimal('123.45678901234567890').to_s)
assert_equal('0.12345 67890 12345 6789e3', BigDecimal('123.45678901234567890').to_s(5))
end