Sha256: 9e21616afe8a8a4ad215633fa41880e91d11cc9c1b03919919a36fe32c281e92

Contents?: true

Size: 1.17 KB

Versions: 2

Compression:

Stored size: 1.17 KB

Contents

require 'spec_helper'

describe "Digest::MurmurHash" do
  it "update nil" do
    all_classes.each do |c|
      murmur = c.new
      expect{ murmur.update }.to raise_error(ArgumentError)
    end
  end

  it "rawdigest no arguments" do
    all_classes.each do |c|
      expect{ c.rawdigest }.to raise_error(ArgumentError)
    end
  end

  describe "seed digest" do
    all_classes.each do |c|
      it (c) do
        expect{ c.digest "", ""}.to raise_error(ArgumentError)
        expect{ c.digest "", "\x00" * (c::DEFAULT_SEED.length  )}.to_not raise_error
        expect{ c.digest "", "\x00" * (c::DEFAULT_SEED.length+1)}.to raise_error(ArgumentError)
        expect{ c.digest "", seed_str(c) }.to_not raise_error
      end
    end
  end

  describe "seed instance" do
    all_classes.each do |c|
      it (c) do
        murmur = c.new
        expect{ murmur.seed = "" }.to raise_error(ArgumentError)
        expect{ murmur.seed = "\x00" * (c::DEFAULT_SEED.length  ) }.to_not raise_error
        expect{ murmur.seed = "\x00" * (c::DEFAULT_SEED.length+1) }.to raise_error(ArgumentError)
        seed = seed_str(c)
        expect{ murmur.seed = seed }.to_not raise_error
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
digest-murmurhash-1.1.1 spec/exception_spec.rb
digest-murmurhash-1.1.0 spec/exception_spec.rb