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-3.0.0.beta.6 spec/framework_spec/app/spec/core/bignum/comparison_spec.rb
rhodes-3.0.0.beta.5 spec/framework_spec/app/spec/core/bignum/comparison_spec.rb
rhodes-3.0.0.beta.4 spec/framework_spec/app/spec/core/bignum/comparison_spec.rb
rhodes-3.0.0.beta.3 spec/framework_spec/app/spec/core/bignum/comparison_spec.rb
rhodes-3.0.0.beta.2 spec/framework_spec/app/spec/core/bignum/comparison_spec.rb
rhodes-3.0.0.beta.1 spec/framework_spec/app/spec/core/bignum/comparison_spec.rb
rhodes-2.4.1 spec/framework_spec/app/spec/core/bignum/comparison_spec.rb
rhodes-2.4.1.beta.1 spec/framework_spec/app/spec/core/bignum/comparison_spec.rb
rhodes-2.4.0 spec/framework_spec/app/spec/core/bignum/comparison_spec.rb
rhodes-2.4.0.beta.2 spec/framework_spec/app/spec/core/bignum/comparison_spec.rb
rhodes-2.4.0.beta.1 spec/framework_spec/app/spec/core/bignum/comparison_spec.rb
rhodes-2.3.2 spec/framework_spec/app/spec/core/bignum/comparison_spec.rb
rhodes-2.3.2.beta.2 spec/framework_spec/app/spec/core/bignum/comparison_spec.rb
rhodes-2.3.2.beta.1 spec/framework_spec/app/spec/core/bignum/comparison_spec.rb
rhodes-2.3.1 spec/framework_spec/app/spec/core/bignum/comparison_spec.rb
rhodes-2.3.1.beta.1 spec/framework_spec/app/spec/core/bignum/comparison_spec.rb
rhodes-2.3.0 spec/framework_spec/app/spec/core/bignum/comparison_spec.rb
rhodes-2.3.0.beta.3 spec/framework_spec/app/spec/core/bignum/comparison_spec.rb
rhodes-2.3.0.beta.2 spec/framework_spec/app/spec/core/bignum/comparison_spec.rb
rhodes-2.3.0.beta.1 spec/framework_spec/app/spec/core/bignum/comparison_spec.rb