Sha256: bfb58c0f608e01d029e841cf71e1579f9f2e23a3a843f5076a850fb1a85a8e6f

Contents?: true

Size: 1.31 KB

Versions: 9

Compression:

Stored size: 1.31 KB

Contents

#!/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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
rubygems-update-0.9.4 test/test_gem_digest.rb
rubygems-update-0.9.5 test/test_gem_digest.rb
rubygems-update-1.1.0 test/test_gem_digest.rb
rubygems-update-1.0.1 test/test_gem_digest.rb
rubygems-update-0.9.3 test/test_gem_digest.rb
rubygems-update-1.0.0 test/test_gem_digest.rb
rubygems-update-1.1.1 test/test_gem_digest.rb
rubygems-update-1.2.0 test/test_gem_digest.rb
rubygems-update-1.3.0 test/test_gem_digest.rb