Sha256: 647c00979e809a7b2fdb466ec7dd6ab703c35a2dd5da4f71e97769fe0fd321e7

Contents?: true

Size: 551 Bytes

Versions: 3

Compression:

Stored size: 551 Bytes

Contents

require "spec_helper"
require "hamster/list"

describe Hamster::List do
  describe "#hash" do
    context "on a really big list" do
      it "doesn't run out of stack" do
        -> { Hamster.interval(0, STACK_OVERFLOW_DEPTH).hash }.should_not raise_error
      end
    end

    context "on an empty list" do
      it "returns 0" do
        expect(L.empty.hash).to eq(0)
      end
    end

    it "values are sufficiently distributed" do
      (1..4000).each_slice(4).map { |a, b, c, d| L[a, b, c, d].hash }.uniq.size.should == 1000
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
files.com-1.0.55 docs/vendor/bundle/ruby/2.5.0/gems/hamster-3.0.0/spec/lib/hamster/list/hash_spec.rb
hamster-3.0.0 spec/lib/hamster/list/hash_spec.rb
hamster-2.0.0 spec/lib/hamster/list/hash_spec.rb