summaryrefslogtreecommitdiff
path: root/spec/ruby/core/fixnum/size_spec.rb
blob: f973d446edb6e8aa8847b6e8acabcc601129b5c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
require File.expand_path('../../../spec_helper', __FILE__)

describe "Fixnum#size" do
  platform_is wordsize: 32 do
    it "returns the number of bytes in the machine representation of self" do
      -1.size.should == 4
      0.size.should == 4
      4091.size.should == 4
    end
  end

  platform_is wordsize: 64 do
    it "returns the number of bytes in the machine representation of self" do
      -1.size.should == 8
      0.size.should == 8
      4091.size.should == 8
    end
  end
end