summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-10-25 08:54:05 +0000
committerknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-10-25 08:54:05 +0000
commit817afbd987d35e4d65f599270f3b42777698556f (patch)
tree05c2adf01a163a7014589d6479cf1e4a1ac9198f /test
parent0bdf887afc78fb049295d78a9018701da094b8c3 (diff)
* ext/digest, test/digest/test_digest.rb: Merge from trunk:
- Introduce versioning in Digest::Base API, and prefix C constants with RUBY_ and C type names with rb_ to avoid name clash in writing extensions. - Introduce Digest::Class and Digest::Instance for ease of implementing subclasses and add-ons. - Digest::Instance module requires and assumes that any instance be resettable and clonable. An instance method #new() is added so digest instances work just like digest classes. - The constructor does no longer take an initial string to feed; digest() and hexdigest() now do, instead. This allows digest classes to take their own hashing parameters. - Make some changes to digest() and hexdigest() class methods, which now take extra arguments, which are passed through to the constructor in an internal call. - Add #digest_length/size/length() and #block_length(), - Add the Digest::SHA2 class to wrap up SHA2 variants: SHA256, SHA384 and SHA512, hoping this module would make a decent example of a digest subclass written in Ruby. - Rip BubbleBabble support out of the base class and have a separate module named digest/bubblebabble. - Remove RD documents in favor of newly written and embedded RDoc documentation. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@11223 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/digest/test_digest.rb28
1 files changed, 14 insertions, 14 deletions
diff --git a/test/digest/test_digest.rb b/test/digest/test_digest.rb
index 62f0aa2cd7..fa12086300 100644
--- a/test/digest/test_digest.rb
+++ b/test/digest/test_digest.rb
@@ -12,7 +12,6 @@ require 'digest'
rescue LoadError
end
end
-include Digest
module TestDigest
Data1 = "abc"
@@ -44,7 +43,8 @@ module TestDigest
def test_eq
# This test is also for clone()
- md1 = self.class::ALGO.new("ABC")
+ md1 = self.class::ALGO.new
+ md1 << "ABC"
assert_equal(md1, md1.clone, self.class::ALGO)
@@ -66,55 +66,55 @@ module TestDigest
class TestMD5 < Test::Unit::TestCase
include TestDigest
- ALGO = MD5
+ ALGO = Digest::MD5
DATA = {
Data1 => "900150983cd24fb0d6963f7d28e17f72",
Data2 => "8215ef0796a20bcaaae116d3876c664a",
}
- end if defined?(MD5)
+ end if defined?(Digest::MD5)
class TestSHA1 < Test::Unit::TestCase
include TestDigest
- ALGO = SHA1
+ ALGO = Digest::SHA1
DATA = {
Data1 => "a9993e364706816aba3e25717850c26c9cd0d89d",
Data2 => "84983e441c3bd26ebaae4aa1f95129e5e54670f1",
}
- end if defined?(SHA1)
+ end if defined?(Digest::SHA1)
class TestSHA256 < Test::Unit::TestCase
include TestDigest
- ALGO = SHA256
+ ALGO = Digest::SHA256
DATA = {
Data1 => "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad",
Data2 => "248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1",
}
- end if defined?(SHA256)
+ end if defined?(Digest::SHA256)
class TestSHA384 < Test::Unit::TestCase
include TestDigest
- ALGO = SHA384
+ ALGO = Digest::SHA384
DATA = {
Data1 => "cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7",
Data2 => "3391fdddfc8dc7393707a65b1b4709397cf8b1d162af05abfe8f450de5f36bc6b0455a8520bc4e6f5fe95b1fe3c8452b",
}
- end if defined?(SHA384)
+ end if defined?(Digest::SHA384)
class TestSHA512 < Test::Unit::TestCase
include TestDigest
- ALGO = SHA512
+ ALGO = Digest::SHA512
DATA = {
Data1 => "ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f",
Data2 => "204a8fc6dda82f0a0ced7beb8e08a41657c16ef468b228a8279be331a703c33596fd15c13b1b07f9aa1d3bea57789ca031ad85c7a71dd70354ec631238ca3445",
}
- end if defined?(SHA512)
+ end if defined?(Digest::SHA512)
class TestRMD160 < Test::Unit::TestCase
include TestDigest
- ALGO = RMD160
+ ALGO = Digest::RMD160
DATA = {
Data1 => "8eb208f7e05d987a9b044a8e98c6b087f15a0bfc",
Data2 => "12a053384a9c0c88e405a06c27dcf49ada62eb2b",
}
- end if defined?(RMD160)
+ end if defined?(Digest::RMD160)
end