Sha256: 4a907c2c241a881a29beb4f5bdf22df087871279a704ef56b8a8c96f6c6e963a

Contents?: true

Size: 973 Bytes

Versions: 2

Compression:

Stored size: 973 Bytes

Contents

require 'test_helper'

class HTest < MiniTest::Unit::TestCase
  def setup
    @h = H::Generator.new({ 'encryption' => 'SHA1',
                            'static_key' => 'foobar',
                            'max_length' => 15,
                            'radix'      => 36 })
    @my_h = H::Generator.new({ 'encryption' => 'SHA2',
                               'static_key' => 'sun',
                               'max_length' => 15,
                               'radix'      => 36 })
    @sha1 = H::Generator.new({ 'encryption' => 'SHA1',
                               'static_key' => '',
                               'max_length' => 40,
                               'radix'      => 16 })
  end

  def test_h
    assert_equal    @h.input('secret'), 't3dpe24xie3y74t'
    assert_equal @my_h.input('secret'), '5gumh4smv1iit23'
    assert_equal @sha1.input('The quick brown fox jumps over the lazy dog'),
      '2fd4e1c67a2d28fced849ee1bb76e7391b93eb12'
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
h-1.1.2 test/h_test.rb
h-1.1.1 test/h_test.rb