diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-09-30 19:50:25 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-09-30 19:50:25 +0000 |
commit | f212df564a4e1025f9fb019ce727022a97bfff53 (patch) | |
tree | ee20315eac7d02ff68682223dc07250362809826 | |
parent | 7fe9a24a0d649bada6d58ceb7ed9368daf2dce43 (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
-rw-r--r-- | test/ruby/test_bignum.rb | 10 |
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 |