summaryrefslogtreecommitdiff
path: root/test/-ext-/bignum/test_div.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/-ext-/bignum/test_div.rb')
-rw-r--r--test/-ext-/bignum/test_div.rb19
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 00000000000..ec12e88c912
--- /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