Sha256: 6ec7de19241f31fa6de681023a0a69c0a6e5fcbcba2fc9f3d83c1259e9961658

Contents?: true

Size: 475 Bytes

Versions: 5

Compression:

Stored size: 475 Bytes

Contents

require 'dirge'
require ~'spec_helper'

describe Anybase, "to" do
  it "should translate base to a number from a string " do
    Anybase.new("012345678").to_native(1827).should == "2450"
  end

  it "should never return an empty string for 0" do
    Anybase.new("012345678").to_native(0).should == "0"
  end

  it "should zeropad" do
    result = Anybase.new("012345678").to_native(1234, :zero_pad => 8)
    result.size.should == 8
    result.should == '00001621'
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
anybase-0.0.7 spec/to_spec.rb
anybase-0.0.6 spec/to_spec.rb
anybase-0.0.5 spec/to_spec.rb
anybase-0.0.4 spec/to_spec.rb
anybase-0.0.3 spec/to_spec.rb