aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test/test_checksum.rb
blob: 6212417b8b3b50472d130c51ec728ff22a2c2fad (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 < Homebrew::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