<commit_before>require_relative '../../spec_helper'

describe "Hash" do
  it "includes Enumerable" do
    Hash.include?(Enumerable).should == true
  end
end

describe "Hash#hash" do
  it "returns a value which doesn't depend on the hash order" do
    { 0=>2, 11=>1 }.hash.should == { 11=>1, 0=>2 }.hash
  end

  it "generates a hash for recursive hash structures" do
    h = {}
    h[:a] = h
    (h.hash == h[:a].hash).should == true
  end

  it "returns the same hash for recursive hashes" do<commit_msg>Add specs for `Hash#hash` collisions.<commit_after>require_relative '../../spec_helper'

describe "Hash" do
  it "includes Enumerable" do
    Hash.include?(Enumerable).should == true
  end
end

describe "Hash#hash" do
  it "returns a value which doesn't depend on the hash order" do
    { 0=>2, 11=>1 }.hash.should == { 11=>1, 0=>2 }.hash
  end

  it "returns a value in which element values do not cancel each other out" do
    { a: 2, b: 2 }.hash.should_not == { a: 7, b: 7 }.hash
  end

  it "returns a value in which element keys and values do not cancel each other out" do
    { :a => :a }.hash.should_not == { :b => :b }.hash
  end

  it "generates a hash for recursive hash structures" do
    h = {}
    h[:a] = h
    (h.hash == h[:a].hash).should == true
  end

  it "returns the same hash for recursive hashes" do
{'fraction_non_alphanumeric': 0.1356443104747551, 'fraction_numerical': 0.01808590806330068, 'mean_word_length': 3.048780487804878, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '317084', 'n_tokens_mistral': 473, 'n_tokens_neox': 440, 'n_words': 173}