Sha256: cc8f03927e6099db562541fc9521fcc8dd191014dd9c9b6441b673eba060ea69

Contents?: true

Size: 669 Bytes

Versions: 3

Compression:

Stored size: 669 Bytes

Contents

require './spec/spec_helper.rb'
require './lib/simplehasher.rb'

describe SimpleHasher do
  describe "encode" do
    it 'should encode a single digit integer' do
      num = 1
      SimpleHasher.encode(num).should== SimpleHasher.allowed_chars[num]
    end

    it 'should encode an integer into a multi-character string' do
      SimpleHasher.encode(5779).should== "LQv"
    end
  end

  describe 'decode' do
    it 'should decode a string to a single digit integer' do
      num = 1
      SimpleHasher.decode('L').should== num
    end

    it 'should encode an integer into a multi-character string' do
      SimpleHasher.decode("LQv").should== 5779
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
simple-hasher-0.0.7 spec/simple-hasher_spec.rb
simple-hasher-0.0.6 spec/simple-hasher_spec.rb
simple-hasher-0.0.5 spec/simple-hasher_spec.rb