Sha256: c6b8e03511a6ca58fd4347b430fa0b2717a423cfe526db83628efe2d884a480e

Contents?: true

Size: 838 Bytes

Versions: 83

Compression:

Stored size: 838 Bytes

Contents

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

describe "Bignum#<=>" do
  before(:each) do
    @bignum = bignum_value(96)
  end
  
  it "returns -1 when self is less than the given argument" do
    (-@bignum <=> @bignum).should == -1
    (-@bignum <=> -1).should == -1
    (-@bignum <=> -4.5).should == -1
  end
  
  it "returns 0 when self is equal to the given argument" do
    (@bignum <=> @bignum).should == 0
    (-@bignum <=> -@bignum).should == 0
  end
  
  it "returns 1 when self is greater than the given argument" do
    (@bignum <=> -@bignum).should == 1
    (@bignum <=> 1).should == 1
    (@bignum <=> 4.5).should == 1
  end

  it "returns nil when the given argument is not an Integer" do
    (@bignum <=> mock('str')).should == nil
    (@bignum <=> 'test').should == nil
  end
end

Version data entries

83 entries across 83 versions & 1 rubygems

Version Path
rhodes-2.2.6 spec/framework_spec/app/spec/core/bignum/comparison_spec.rb
rhodes-2.2.6.beta.1 spec/framework_spec/app/spec/core/bignum/comparison_spec.rb
rhodes-2.2.5 spec/framework_spec/app/spec/core/bignum/comparison_spec.rb
rhodes-2.2.5.beta.3 spec/framework_spec/app/spec/core/bignum/comparison_spec.rb
rhodes-2.2.5.beta.2 spec/framework_spec/app/spec/core/bignum/comparison_spec.rb
rhodes-2.2.5.beta.1 spec/framework_spec/app/spec/core/bignum/comparison_spec.rb
rhodes-2.2.4.beta.1 spec/framework_spec/app/spec/core/bignum/comparison_spec.rb
rhodes-2.2.3 spec/framework_spec/app/spec/core/bignum/comparison_spec.rb
rhodes-2.2.3.beta.1 spec/framework_spec/app/spec/core/bignum/comparison_spec.rb
rhodes-2.2.2 spec/framework_spec/app/spec/core/bignum/comparison_spec.rb
rhodes-2.2.2.beta.1 spec/framework_spec/app/spec/core/bignum/comparison_spec.rb
rhodes-2.2.1 spec/framework_spec/app/spec/core/bignum/comparison_spec.rb
rhodes-2.2.1.beta.2 spec/framework_spec/app/spec/core/bignum/comparison_spec.rb
rhodes-2.2.1.beta.1 spec/framework_spec/app/spec/core/bignum/comparison_spec.rb
rhodes-2.2.0 spec/framework_spec/app/spec/core/bignum/comparison_spec.rb
rhodes-2.2.0.beta.3 spec/framework_spec/app/spec/core/bignum/comparison_spec.rb
rhodes-2.2.0.beta.2 spec/framework_spec/app/spec/core/bignum/comparison_spec.rb
rhodes-2.2.0.beta.1 spec/framework_spec/app/spec/core/bignum/comparison_spec.rb
rhodes-2.1.0 spec/framework_spec/app/spec/core/bignum/comparison_spec.rb
rhodes-2.0.3 spec/framework_spec/app/spec/core/bignum/comparison_spec.rb