Sha256: 2068f5d2dad7d934f0e6730cd1c5bd604400baa033aad6370dc3dcccde7e5b03

Contents?: true

Size: 570 Bytes

Versions: 3

Compression:

Stored size: 570 Bytes

Contents

require 'spec_helper'

shared_examples_for "CRC" do
  it "should calculate a checksum for text" do
    described_class.hexdigest(string).should == expected
  end

  it "should calculate a checksum for multiple data" do
    middle = (string.length / 2)

    chunk1 = string[0...middle]
    chunk2 = string[middle..-1]

    crc = subject
    crc << chunk1
    crc << chunk2

    crc.hexdigest.should == expected
  end

  it "should provide direct access to the checksum value" do
    crc = subject
    crc << string

    crc.checksum.should == expected.to_i(16)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
digest-crc-0.4.1 spec/crc_examples.rb
digest-crc-0.4.0 spec/crc_examples.rb
digest-crc-0.3.0 spec/crc_examples.rb