summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-09-30 19:50:25 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-09-30 19:50:25 +0000
commitf212df564a4e1025f9fb019ce727022a97bfff53 (patch)
treeee20315eac7d02ff68682223dc07250362809826 /test/ruby
parent7fe9a24a0d649bada6d58ceb7ed9368daf2dce43 (diff)
* test/ruby/test_bignum.rb (TestBignum#test_interrupt): fix for
faster CPU. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33365 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_bignum.rb10
1 files changed, 6 insertions, 4 deletions
diff --git a/test/ruby/test_bignum.rb b/test/ruby/test_bignum.rb
index af729a9de6..e32bb62a85 100644
--- a/test/ruby/test_bignum.rb
+++ b/test/ruby/test_bignum.rb
@@ -422,7 +422,7 @@ class TestBignum < Test::Unit::TestCase
assert_equal(true, (2**32).even?)
end
- def interrupt
+ def assert_interrupt
time = Time.now
start_flag = false
end_flag = false
@@ -431,14 +431,16 @@ class TestBignum < Test::Unit::TestCase
yield
end_flag = true
end
- sleep 1
+ Thread.pass until start_flag
thread.raise
thread.join rescue nil
- start_flag && !end_flag && Time.now - time < 10
+ time = Time.now - time
+ assert_equal([true, false], [start_flag, end_flag])
+ assert_operator(time, :<, 10)
end
def test_interrupt
- assert(interrupt { (65536 ** 65536).to_s })
+ assert_interrupt {(65536 ** 65536).to_s}
end
def test_too_big_to_s