diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-09-04 16:10:06 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-09-04 16:10:06 +0000 |
commit | 8f8bf8243d810d49a98dcb2713b14de3bf3716e0 (patch) | |
tree | c6abe5461a6b3c784d613a9284ca9a583170d8fd /test | |
parent | ff5a4c998340eff7c3d6867836d387d7a5159dec (diff) | |
download | ruby-8f8bf8243d810d49a98dcb2713b14de3bf3716e0.tar.gz |
* bignum.c (rb_big_divrem_normal): New function.
* internal.h (rb_big_divrem_normal): Declared.
* ext/-test-/bignum/div.c: New file.
* test/-ext-/bignum/test_div.rb: New file.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42834 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/-ext-/bignum/test_div.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/-ext-/bignum/test_div.rb b/test/-ext-/bignum/test_div.rb new file mode 100644 index 0000000000..ec12e88c91 --- /dev/null +++ b/test/-ext-/bignum/test_div.rb @@ -0,0 +1,19 @@ +require 'test/unit' +require "-test-/bignum" + +class TestBignum < Test::Unit::TestCase + class TestDiv < Test::Unit::TestCase + + SIZEOF_BDIGITS = Bignum::SIZEOF_BDIGITS + BITSPERDIG = Bignum::BITSPERDIG + BDIGMAX = (1 << BITSPERDIG) - 1 + + def test_divrem_normal + x = (1 << (BITSPERDIG*2)) | (2 << BITSPERDIG) | 3 + y = (1 << BITSPERDIG) | 1 + q = (1 << BITSPERDIG) | 1 + r = 2 + assert_equal([q, r], x.big_divrem_normal(y)) + end + end +end |