diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-07-05 07:45:02 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-07-05 07:45:02 +0000 |
commit | 42b4e02760c725e1a426b6845695ecdbc8fe3e3b (patch) | |
tree | f6e11bc65b797bc736b83f58841357ccefcdb6bc /test/ruby | |
parent | 890d25d46f30b5557c2cc1d66333fa48bdf76918 (diff) |
* numeric.c (int_pow): fix previous nubu's commit.
* test/ruby/test_fixnum.rb: new test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@12699 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_fixnum.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/ruby/test_fixnum.rb b/test/ruby/test_fixnum.rb new file mode 100644 index 0000000000..57999d4b03 --- /dev/null +++ b/test/ruby/test_fixnum.rb @@ -0,0 +1,26 @@ +require 'test/unit' + +class TestFixnum < Test::Unit::TestCase + def setup + @verbose = $VERBOSE + $VERBOSE = nil + end + + def teardown + $VERBOSE = @verbose + end + + def test_pow + [1, 2, 2**64, 2**63*3, 2**64*3].each do |y| + [1, 3].each do |x| + z1 = x**y + z2 = (-x)**y + if y % 2 == 1 + assert_equal(z2, -z1) + else + assert_equal(z2, z1) + end + end + end + end +end |