<commit_before>require File.dirname(__FILE__) + '/../../spec_helper'
require File.dirname(__FILE__) + '/fixtures/classes'

describe "Struct#hash" do
  
  it "returns the same fixnum for structs with the same content" do
    [Struct::Ruby.new("1.8.6", "PPC"), Struct::Car.new("Hugo", "Foo", "1972")].each do |stc|
      stc.hash.should == stc.dup.hash
      stc.hash.class.should == Fixnum
    end
  end
  
  it "returns the same value if structs are #eql?" do
    car = Struct::Car.new("Honda", "Accord", "1998")
    similar_car = Struct::Car.new("Honda", "Accord", "1998")
    car.should eql(similar_car)
    car.hash.should == similar_car.hash
  end
  
end<commit_msg>Struct#hash: test for recursive structs [redmine:1852]<commit_after>require File.dirname(__FILE__) + '/../../spec_helper'
require File.dirname(__FILE__) + '/fixtures/classes'

describe "Struct#hash" do
  
  it "returns the same fixnum for structs with the same content" do
    [Struct::Ruby.new("1.8.6", "PPC"), Struct::Car.new("Hugo", "Foo", "1972")].each do |stc|
      stc.hash.should == stc.dup.hash
      stc.hash.class.should == Fixnum
    end
  end
  
  it "returns the same value if structs are #eql?" do
    car = Struct::Car.new("Honda", "Accord", "1998")
    similar_car = Struct::Car.new("Honda", "Accord", "1998")
    car.should eql(similar_car)
    car.hash.should == similar_car.hash
  end
  
  ruby_bug "redmine #1852", "1.9.1" do
    it "returns the same hash for recursive structs" do
      car = Struct::Car.new("Honda", "Accord", "1998")
      similar_car = Struct::Car.new("Honda", "Accord", "1998")
      car[:make] = car
      similar_car[:make] = car
      car.hash.should == similar_car.hash
    end
  end

end
{'fraction_non_alphanumeric': 0.16304985337243402, 'fraction_numerical': 0.02873900293255132, 'mean_word_length': 3.431168831168831, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '7024025', 'n_tokens_mistral': 640, 'n_tokens_neox': 596, 'n_words': 150}