diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-09-01 11:35:57 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-09-01 11:35:57 +0000 |
commit | 7dd16046034ca43dc555141b1d3a57da2a57f04d (patch) | |
tree | 834a3b47d610e7af335bba13f20c2cd9df50bd5b /test | |
parent | cec97f40f65bd5b7d775f6e1ec4ec425e6ae6095 (diff) | |
download | ruby-7dd16046034ca43dc555141b1d3a57da2a57f04d.tar.gz |
* bignum.c (big2str_base_poweroftwo): Renamed from
big2str_base_powerof2.
(rb_big2str_poweroftwo): New function for test.
(big2str_generic): Extracted from rb_big2str1.
(rb_big2str_generic): New function for test.
* internal.h (rb_big2str_poweroftwo): Declared.
(rb_big2str_generic): Ditto.
* ext/-test-/bignum/big2str.c: New file.
* test/-ext-/bignum/test_big2str.rb: New file.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42758 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/-ext-/bignum/test_big2str.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/-ext-/bignum/test_big2str.rb b/test/-ext-/bignum/test_big2str.rb new file mode 100644 index 0000000000..3e45232d6c --- /dev/null +++ b/test/-ext-/bignum/test_big2str.rb @@ -0,0 +1,23 @@ +require 'test/unit' +require "-test-/bignum" + +class TestBignum < Test::Unit::TestCase + class TestBig2str < Test::Unit::TestCase + + SIZEOF_BDIGITS = Bignum::SIZEOF_BDIGITS + BITSPERDIG = Bignum::BITSPERDIG + BDIGMAX = (1 << BITSPERDIG) - 1 + + def test_big2str_generic + x = 10**1000 + assert_equal("1" + "0" * 1000, x.big2str_generic(10)) + end + + def test_big2str_poweroftwo + e = BITSPERDIG*2 + x = 0b10**e + assert_equal("1" + "0" * e, x.big2str_poweroftwo(2)) + end + + end +end |