diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-02-24 09:39:17 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-02-24 09:39:17 +0000 |
commit | 8c440619289b4e20c7b6b0e1b1a5a5c9a4252530 (patch) | |
tree | 294becc336406e7bc13844d9acde8dc8341bf36e /test | |
parent | bdd6b995f91277a258db8614371be08e3fe9988d (diff) | |
download | ruby-8c440619289b4e20c7b6b0e1b1a5a5c9a4252530.tar.gz |
Integer.sqrt argument check
* numeric.c (rb_int_s_isqrt): check if the argument is an integer.
[Feature #13219]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57706 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_integer.rb | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/test/ruby/test_integer.rb b/test/ruby/test_integer.rb index 05b0b68ccc..e0927c9ffe 100644 --- a/test/ruby/test_integer.rb +++ b/test/ruby/test_integer.rb @@ -466,6 +466,7 @@ class TestInteger < Test::Unit::TestCase end def test_square_root + assert_raise(TypeError) {Integer.sqrt("x")} assert_raise(Math::DomainError) {Integer.sqrt(-1)} assert_equal(0, Integer.sqrt(0)) (1...4).each {|i| assert_equal(1, Integer.sqrt(i))} |