summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorkazu <kazu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-12-06 15:02:31 +0000
committerkazu <kazu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-12-06 15:02:31 +0000
commit49dc86649202a87c71442a6e127ea04b87300b4c (patch)
treed3b5dd3f4c01ae9b4dbd593d47bad2c4f16627eb /test
parent956cfb974f3620c4517dd7740cbcbdfaf50ab572 (diff)
`Integer#pow(b)` accepts numeric
instead of integer only and returns numeric instead of integer only same as `Integer#**` git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61058 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_numeric.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/test/ruby/test_numeric.rb b/test/ruby/test_numeric.rb
index 9b17fbb2a5..02a6b8f4a8 100644
--- a/test/ruby/test_numeric.rb
+++ b/test/ruby/test_numeric.rb
@@ -386,6 +386,10 @@ class TestNumeric < Test::Unit::TestCase
end
def test_pow
+ assert_equal(2**3, 2.pow(3))
+ assert_equal(2**-1, 2.pow(-1))
+ assert_equal(2**0.5, 2.pow(0.5))
+ assert_equal((-1)**0.5, -1.pow(0.5))
assert_equal(3**3 % 8, 3.pow(3, 8))
assert_equal(3**3 % -8, 3.pow(3,-8))
assert_equal(3**2 % -2, 3.pow(2,-2))