aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test/test_checksum.rb
blob: 80cd60d2da3f25063ae0ef7acf5b63ccba621a3f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
require 'testing_env'
require 'checksum'

class ChecksumTests < Test::Unit::TestCase
  def test_empty?
    assert_empty Checksum.new(:sha1, '')
  end

  def test_equality
    a = Checksum.new(:sha1, 'deadbeef'*5)
    b = Checksum.new(:sha1, 'deadbeef'*5)
    assert_equal a, b

    a = Checksum.new(:sha1, 'deadbeef'*5)
    b = Checksum.new(:sha1, 'feedface'*5)
    assert_not_equal a, b

    a = Checksum.new(:sha1, 'deadbeef'*5)
    b = Checksum.new(:sha256, 'deadbeef'*5)
    assert_not_equal a, b
  end
end