Sha256: e50ab980dfb19e6740d8411eac9f52d0cae9debe11b33bdf727b408b612948bc

Contents?: true

Size: 730 Bytes

Versions: 1

Compression:

Stored size: 730 Bytes

Contents

# encoding: utf-8
require 'bundler'
Bundler.require(:default, :test)

require 'coveralls'
Coveralls.wear!

require 'test/unit'

class TestClass < Test::Unit::TestCase
  require 'URLcrypt'

  def assert_bytes_equal(string1, string2)
    bytes1 = string1.bytes.to_a.join(':')
    bytes2 = string2.bytes.to_a.join(':')
    assert_equal(bytes1, bytes2)
  end
  
  def assert_decoding(encoded, plain)
    decoded = URLcrypt.decode(encoded)
    assert_bytes_equal(plain, decoded)
  end

  def assert_encoding(encoded, plain)
    actual = URLcrypt.encode(plain)
    assert_bytes_equal(encoded, actual)
  end

  def assert_encode_and_decode(encoded, plain)
    assert_encoding(encoded, plain)
    assert_decoding(encoded, plain)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
urlcrypt-0.1.2 test/test_helper.rb