ruby-changes:30728
From: akr <ko1@a...>
Date: Tue, 3 Sep 2013 20:20:26 +0900 (JST)
Subject: [ruby-changes:30728] akr:r42807 (trunk): Add tests.
akr 2013-09-03 20:20:17 +0900 (Tue, 03 Sep 2013) New Revision: 42807 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=42807 Log: Add tests. Modified files: trunk/test/-ext-/bignum/test_big2str.rb trunk/test/-ext-/bignum/test_mul.rb Index: test/-ext-/bignum/test_big2str.rb =================================================================== --- test/-ext-/bignum/test_big2str.rb (revision 42806) +++ test/-ext-/bignum/test_big2str.rb (revision 42807) @@ -19,5 +19,11 @@ class TestBignum < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/-ext-/bignum/test_big2str.rb#L19 assert_equal("1" + "0" * e, x.big2str_poweroftwo(2)) end + def test_big2str_gmp + x = 10**1000 + assert_equal("1" + "0" * 1000, x.big2str_gmp(10)) + rescue NotImplementedError + end + end end Index: test/-ext-/bignum/test_mul.rb =================================================================== --- test/-ext-/bignum/test_mul.rb (revision 42806) +++ test/-ext-/bignum/test_mul.rb (revision 42807) @@ -126,5 +126,12 @@ class TestBignum < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/-ext-/bignum/test_mul.rb#L126 assert_equal(x.big_mul_normal(y), x.big_mul_toom3(y)) end + def test_mul_gmp + x = (1 << 2*BITSPERDIG) | (1 << BITSPERDIG) | 1 + y = (1 << 2*BITSPERDIG) | (1 << BITSPERDIG) | 1 + assert_equal(x.big_mul_normal(y), x.big_mul_gmp(y)) + rescue NotImplementedError + end + end end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/