From 8f8bf8243d810d49a98dcb2713b14de3bf3716e0 Mon Sep 17 00:00:00 2001 From: akr Date: Wed, 4 Sep 2013 16:10:06 +0000 Subject: * 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 --- test/-ext-/bignum/test_div.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 test/-ext-/bignum/test_div.rb (limited to 'test/-ext-/bignum/test_div.rb') 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 -- cgit v1.2.3