Sha256: f29935c9294e87cbbe35dc5f0ce4c47766875dcab83e12d3c21d0bf01cefae0d

Contents?: true

Size: 591 Bytes

Versions: 9

Compression:

Stored size: 591 Bytes

Contents

require 'spec_helper'

shared_examples_for "CRC" do
  it "should calculate a checksum for text" do
    expect(described_class.hexdigest(string)).to be == 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

    expect(crc.hexdigest).to be == expected
  end

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

    expect(crc.checksum).to be == expected.to_i(16)
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
digest-crc-0.6.4 spec/crc_examples.rb
digest-crc-0.6.3 spec/crc_examples.rb
digest-crc-0.6.2 spec/crc_examples.rb
digest-crc-0.6.1 spec/crc_examples.rb
digest-crc-0.6.0 spec/crc_examples.rb
digest-crc-0.6.0.rc1 spec/crc_examples.rb
digest-crc-0.5.1 spec/crc_examples.rb
digest-crc-0.5.0 spec/crc_examples.rb
digest-crc-0.4.2 spec/crc_examples.rb