aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_integer.rb
diff options
context:
space:
mode:
authorstomar <stomar@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-04-16 15:54:57 +0000
committerstomar <stomar@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-04-16 15:54:57 +0000
commite7ceed24230da40287c9edb76a64c2925df7c753 (patch)
treecb64af1971b85f195bfd2c72188cae8dac11b5f0 /test/ruby/test_integer.rb
parentad4fccdd3c10f2beb41524e1f6f58bd8c2e0f236 (diff)
downloadruby-e7ceed24230da40287c9edb76a64c2925df7c753.tar.gz
test_integer.rb: simplify test
* test/ruby/test_integer.rb: simplify test for Integer.sqrt. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58372 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_integer.rb')
-rw-r--r--test/ruby/test_integer.rb13
1 files changed, 5 insertions, 8 deletions
diff --git a/test/ruby/test_integer.rb b/test/ruby/test_integer.rb
index 963c6b75a4..db478276c5 100644
--- a/test/ruby/test_integer.rb
+++ b/test/ruby/test_integer.rb
@@ -490,15 +490,12 @@ class TestInteger < Test::Unit::TestCase
end
bug13440 = '[ruby-core:80696] [Bug #13440]'
- too_big = []
- too_small = []
- 0.step(to: 50, by: 0.001) do |i|
+ failures = []
+ 0.step(to: 50, by: 0.05) do |i|
n = (10**i).to_i
- int_root = Integer.sqrt(n)
- too_big << n if int_root*int_root > n
- too_small << n if (int_root+1)*(int_root+1) <= n
+ root = Integer.sqrt(n)
+ failures << n unless root*root <= n && (root+1)*(root+1) > n
end
- assert_empty(too_big, bug13440)
- assert_empty(too_small, bug13440)
+ assert_empty(failures, bug13440)
end
end