summaryrefslogtreecommitdiff
path: root/test/digest
diff options
context:
space:
mode:
authorknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-01-17 19:12:10 +0000
committerknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-01-17 19:12:10 +0000
commitd8f265b332506dcb7b9738247f0d895e51477ea6 (patch)
treef6d7b1b56021a7e518be15d2da9b3a84ad1b2999 /test/digest
parent7bfdad3b62eb19c216baed90d4da5c6a6545fe8c (diff)
* ext/digest/digest.c (rb_digest_instance_hexdigest_bang): Fix
rdoc. * ext/digest/lib/digest.rb (Digest::Class.base64digest) (Digest::Instance#base64digest{,!}): New methods. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26339 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/digest')
-rw-r--r--test/digest/test_digest.rb16
1 files changed, 12 insertions, 4 deletions
diff --git a/test/digest/test_digest.rb b/test/digest/test_digest.rb
index fa12086..1d1efa1 100644
--- a/test/digest/test_digest.rb
+++ b/test/digest/test_digest.rb
@@ -18,14 +18,22 @@ module TestDigest
Data2 = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"
def test_s_hexdigest
- self.class::DATA.each do |str, digest|
- assert_equal(digest, self.class::ALGO.hexdigest(str))
+ self.class::DATA.each do |str, hexdigest|
+ assert_equal(hexdigest, self.class::ALGO.hexdigest(str))
+ end
+ end
+
+ def test_s_base64digest
+ self.class::DATA.each do |str, hexdigest|
+ digest = [hexdigest].pack("H*")
+ assert_equal([digest].pack("m0"), self.class::ALGO.base64digest(str))
end
end
def test_s_digest
- self.class::DATA.each do |str, digest|
- assert_equal([digest].pack("H*"), self.class::ALGO.digest(str))
+ self.class::DATA.each do |str, hexdigest|
+ digest = [hexdigest].pack("H*")
+ assert_equal(digest, self.class::ALGO.digest(str))
end
end