From 6eaed20e145c1ab4c9c4ccf669d0ebea934f4d36 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Tue, 8 Nov 2022 09:06:21 +0900 Subject: Add version to the interface of Random extensions --- test/-ext-/test_random.rb | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/-ext-/test_random.rb b/test/-ext-/test_random.rb index 838e5d2f14..e5cebcc871 100644 --- a/test/-ext-/test_random.rb +++ b/test/-ext-/test_random.rb @@ -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 -- cgit v1.2.3