1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
This commit is contained in:
Benoit Daloze 2020-12-27 17:35:32 +01:00
parent 267bed0cd9
commit 727c97da19
108 changed files with 1325 additions and 270 deletions

View file

@ -49,18 +49,18 @@ describe "Random.rand" do
end
end
describe "Random#rand with Integer" do
describe "Random#rand with Fixnum" do
it "returns an Integer" do
Random.new.rand(20).should be_an_instance_of(Integer)
end
it "returns an Integer greater than or equal to 0" do
it "returns a Fixnum greater than or equal to 0" do
prng = Random.new
ints = 20.times.map { prng.rand(5) }
ints.min.should >= 0
end
it "returns an Integer less than the argument" do
it "returns a Fixnum less than the argument" do
prng = Random.new
ints = 20.times.map { prng.rand(5) }
ints.max.should <= 4
@ -92,19 +92,19 @@ describe "Random#rand with Integer" do
end
end
describe "Random#rand with Integer" do
it "typically returns an Integer" do
describe "Random#rand with Bignum" do
it "typically returns a Bignum" do
rnd = Random.new(1)
10.times.map{ rnd.rand(bignum_value*2) }.max.should be_an_instance_of(Integer)
end
it "returns an Integer greater than or equal to 0" do
it "returns a Bignum greater than or equal to 0" do
prng = Random.new
bigs = 20.times.map { prng.rand(bignum_value) }
bigs.min.should >= 0
end
it "returns an Integer less than the argument" do
it "returns a Bignum less than the argument" do
prng = Random.new
bigs = 20.times.map { prng.rand(bignum_value) }
bigs.max.should < bignum_value