Sha256: 35e83bed8956f9e7f03bcec5051c1b688a3dcbc5556e6f9e6d09f970b964f8ff
Contents?: true
Size: 932 Bytes
Versions: 1
Compression:
Stored size: 932 Bytes
Contents
require 'test/unit' require 'URLcrypt' class TestURLcrypt < Test::Unit::TestCase def assert_decoding(encoded, plain) decoded = URLcrypt.decode(encoded) assert_equal(plain, decoded) end def assert_encoding(encoded, plain) actual = URLcrypt.encode(plain) assert_equal(encoded, actual) end def assert_encode_and_decode(encoded, plain) assert_encoding(encoded, plain) assert_decoding(encoded, plain) end def test_empty_string assert_encode_and_decode('', '') end def test_encode assert_encode_and_decode( '111gc86f4nxw5zj1b3qmhpb14n5h25l4m7111', "\0\0awesome \n ΓΌ string\0\0") end def test_invalid_encoding assert_decoding('ZZZZZ', '') end def test_arbitrary_byte_strings 0.step(1500,17) do |n| original = (0..n).map{rand(256).chr}.join encoded = URLcrypt::encode(original) assert_decoding(encoded, original) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
urlcrypt-0.0.1 | test/URLcrypt_test.rb |