Sha256: d87716aba784155d891d8651d8b9d1f00a2395378d17a8ca92de3e5b6dc3f0eb

Contents?: true

Size: 587 Bytes

Versions: 2

Compression:

Stored size: 587 Bytes

Contents

require 'spec_helper'

shared_examples_for "CRC" do
  it "should calculate a checksum for text" do
    @crc_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 = @crc_class.new
    crc << chunk1
    crc << chunk2

    crc.hexdigest.should == @expected
  end

  it "should provide direct access to the checksum value" do
    crc = @crc_class.new
    crc << @string

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
digest-crc-0.2.0 spec/crc_examples.rb
digest-crc-0.1.0 spec/crc_examples.rb