77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
# File 'lib/oddb2xml/compare.rb', line 77
def compare
("Start comparing #{@left.filename} with #{@right.filename}")
(@left.components & @right.components).each do |name|
begin
puts "\n#{Time.now.strftime("%H:%M:%S")}: Comparing #{name} in #{@left.basename} with #{@right.basename}"
key = StammXML.get_component_key_name(name)
left_items = @left.get_items(name)
next unless left_items
right_items = @right.get_items(name)
next unless right_items
@diff_stat[name] = {}
@occurrences[name] = {}
@diff_stat[name][NR_COMPARED] = 0
l_names = get_names(left_items)
r_names = get_names(right_items)
compare_names = l_names & r_names
l_keys = get_keys(left_items, key)
r_keys = get_keys(right_items, key)
(l_keys & r_keys).each do |id|
compare_details(name, compare_names, id)
end
key_results_details(name, compare_names, l_keys, r_keys)
rescue => error
puts "Execution failed with #{error}"
end
end
("Summary comparing #{@left.filename} with #{@right.filename}")
puts "Ignored differences in #{@options[:fields_to_ignore]}. Signaled when differences in #{@options[:fields_as_floats]} were bigger than #{@options[:min_diff_for_floats]}"
puts @report.join("\n")
@diff_stat.each do |component, stats|
puts "\nFor #{stats[NR_COMPARED]} #{component} we have the following number of differences per field"
stats.each do |name, nr|
next if name.eql?(NR_COMPARED)
next if @options[:fields_to_ignore].index(name)
puts " #{name.ljust(20)} #{nr} of #{@occurrences[component][name]}"
end
end
@diff_stat
rescue => error
puts "Execution failed with #{error}"
raise error
end
|