Sha256: 3e80e06b6c1fc5c1f89e2683820017a8faeed37284eb76556c21819c7a2c9f24

Contents?: true

Size: 809 Bytes

Versions: 83

Compression:

Stored size: 809 Bytes

Contents

require File.dirname(File.join(__rhoGetCurrentDir(), __FILE__)) + '/../../spec_helper'
require File.dirname(File.join(__rhoGetCurrentDir(), __FILE__)) + '/fixtures/classes'

describe "Kernel.srand" do
  it "is a private method" do
    Kernel.should have_private_instance_method(:srand)
  end
  
  it "srand should return the previous seed value" do
    srand(10)
    srand(20).should == 10
  end

  it "srand should seed the RNG correctly and repeatably" do
    srand(10)
    x = rand
    srand(10)
    rand.should == x
  end

  it "defaults number to a random value" do
    lambda { srand }.should_not raise_error
    srand.should_not == 0
  end

  it "calls #to_i on number" do
    srand(3.8)
    srand.should == 3
  end
end

describe "Kernel#srand" do
  it "needs to be reviewed for spec completeness"
end

Version data entries

83 entries across 83 versions & 1 rubygems

Version Path
rhodes-3.1.1 spec/framework_spec/app/spec/core/kernel/srand_spec.rb
rhodes-3.1.1.beta spec/framework_spec/app/spec/core/kernel/srand_spec.rb
rhodes-3.1.0 spec/framework_spec/app/spec/core/kernel/srand_spec.rb
rhodes-3.1.0.beta.5 spec/framework_spec/app/spec/core/kernel/srand_spec.rb
rhodes-3.1.0.beta.4 spec/framework_spec/app/spec/core/kernel/srand_spec.rb
rhodes-3.1.0.beta.3 spec/framework_spec/app/spec/core/kernel/srand_spec.rb
rhodes-3.1.0.beta.2 spec/framework_spec/app/spec/core/kernel/srand_spec.rb
rhodes-3.1.0.beta.1 spec/framework_spec/app/spec/core/kernel/srand_spec.rb
rhodes-3.0.2 spec/framework_spec/app/spec/core/kernel/srand_spec.rb
rhodes-3.0.2.beta.1 spec/framework_spec/app/spec/core/kernel/srand_spec.rb
rhodes-3.0.1 spec/framework_spec/app/spec/core/kernel/srand_spec.rb
rhodes-3.0.1.beta.8 spec/framework_spec/app/spec/core/kernel/srand_spec.rb
rhodes-3.0.1.beta.7 spec/framework_spec/app/spec/core/kernel/srand_spec.rb
rhodes-3.0.1.beta.6 spec/framework_spec/app/spec/core/kernel/srand_spec.rb
rhodes-3.0.1.beta.5 spec/framework_spec/app/spec/core/kernel/srand_spec.rb
rhodes-3.0.1.beta.4 spec/framework_spec/app/spec/core/kernel/srand_spec.rb
rhodes-3.0.1.beta.3 spec/framework_spec/app/spec/core/kernel/srand_spec.rb
rhodes-3.0.1.beta.2 spec/framework_spec/app/spec/core/kernel/srand_spec.rb
rhodes-3.0.0 spec/framework_spec/app/spec/core/kernel/srand_spec.rb
rhodes-3.0.0.beta.7 spec/framework_spec/app/spec/core/kernel/srand_spec.rb