mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 08:33:58 +02:00
Add version to the interface of Random extensions
This commit is contained in:
parent
0ae5de1a5d
commit
6eaed20e14
5 changed files with 356 additions and 4 deletions
|
@ -1,11 +1,13 @@
|
|||
require 'test/unit'
|
||||
|
||||
module TestRandomExt
|
||||
def setup
|
||||
super
|
||||
assert_nothing_raised(LoadError) {require '-test-/random'}
|
||||
end
|
||||
|
||||
class TestLoop < Test::Unit::TestCase
|
||||
def setup
|
||||
super
|
||||
assert_nothing_raised(LoadError) {require '-test-/random'}
|
||||
end
|
||||
include TestRandomExt
|
||||
|
||||
def test_bytes
|
||||
rnd = Bug::Random::Loop.new(1)
|
||||
|
@ -24,4 +26,20 @@ module TestRandomExt
|
|||
assert_equal(1.00, Bug::Random::Loop.new(4<<14).rand)
|
||||
end
|
||||
end
|
||||
|
||||
class TestVersionZero < Test::Unit::TestCase
|
||||
include TestRandomExt
|
||||
|
||||
def test_bad_version
|
||||
assert_raise(TypeError) {Bug::Random::VersionZero.new}
|
||||
end
|
||||
end
|
||||
|
||||
class TestVersionMax < Test::Unit::TestCase
|
||||
include TestRandomExt
|
||||
|
||||
def test_bad_version
|
||||
assert_raise(TypeError) {Bug::Random::VersionMax.new}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue