1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/test/rubygems/test_gem_digest.rb
drbrain fbf59bdbea Import RubyGems trunk revision 1493.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13862 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-10 07:48:56 +00:00

44 lines
No EOL
1.3 KiB
Ruby
Executable file

#!/usr/bin/env ruby
#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
# All rights reserved.
# See LICENSE.txt for permissions.
#++
require "test/unit"
require "rubygems/digest/md5"
require "rubygems/digest/sha1"
require "rubygems/digest/sha2"
class TestRubygemsGemDigest < Test::Unit::TestCase
def test_sha256_hex_digest_works
digester = Gem::SHA256.new
assert_equal "b5d4045c3f466fa91fe2cc6abe79232a1a57cdf104f7a26e716e0a1e2789df78", digester.hexdigest("ABC")
end
def test_sha256_digest_works
digester = Gem::SHA256.new
assert_equal "\265\324\004\\?Fo\251\037\342\314j\276y#*\032W\315\361\004\367\242nqn\n\036'\211\337x",
digester.digest("ABC")
end
def test_sha1_hex_digest_works
digester = Gem::SHA1.new
assert_equal "3c01bdbb26f358bab27f267924aa2c9a03fcfdb8", digester.hexdigest("ABC")
end
def test_sha1_digest_works
digester = Gem::SHA1.new
assert_equal "<\001\275\273&\363X\272\262\177&y$\252,\232\003\374\375\270", digester.digest("ABC")
end
def test_md5_hex_digest_works
digester = Gem::MD5.new
assert_equal "902fbdd2b1df0c4f70b4a5d23525e932", digester.hexdigest("ABC")
end
def test_md5_digest_works
digester = Gem::MD5.new
assert_equal "\220/\275\322\261\337\fOp\264\245\3225%\3512", digester.digest("ABC")
end
end