283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
|
# File 'lib/threading_test_tools.rb', line 283
def data_equal?(obj, message = nil, recursive_check = {}, no_brackets = false)
return true if data_equal_ignore
if not self.class.data_equal?(obj.class, message, recursive_check)
!message.nil? and message.unshift '.class'
return false
end
if not self.size.data_equal?(obj.size, message, recursive_check)
!message.nil? and message.unshift '.size'
return false
end
return recursive_check[[self, obj]] if recursive_check.has_key?([self, obj])
recursive_check[[self, obj]] = true
other_keys = obj.keys
self.each do |key, value|
catch :match_found do
other_keys.each_index do |index|
if key.data_equal?(other_keys[index], nil, recursive_check)
if value.data_equal?(obj[other_keys[index]], message, recursive_check)
other_keys.delete_at(index)
throw :match_found
else
!message.nil? and message.unshift(no_brackets ? key.to_s : "[#{key.to_s}]")
recursive_check[[self, obj]] = false
return false
end
end
end
!message.nil? and message.unshift " has no corresponding key for #{key.to_s}."
recursive_check[[self, obj]] = false
return false
end
end
true
end
|