Sha256: 1140f26e9aeb8859f4cb36685b1681986900bed7ae5ef78c9d330c92ae996696

Contents?: true

Size: 729 Bytes

Versions: 1

Compression:

Stored size: 729 Bytes

Contents

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

require 'simplecov'
SimpleCov.start

require "minitest/autorun"

class TestClass < Minitest::Test
  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.2.0 test/test_helper.rb