require_relative "signals/signal_list_comparison" require_relative "labels/label_list_comparison" require_relative "combined_list" class Ecu class CombinedListComparison def initialize(left, right) # TODO: This could/should be more leaniant and convert # {Signal/Label}Lists on the fly to allow for comparison unless left.is_a?(CombinedList) && right.is_a?(CombinedList) fail "Can only merge CombinedList (left: #{left.class}, right: #{right.class})!" end @signal_comparison = SignalListComparison.new(left.signals, right.signals) @label_comparison = LabelListComparison.new(left.labels, right.labels) end def names(spec) signal_comparison.names(spec) + label_comparison.names(spec) end def left_exclusive signal_comparison.left_exclusive + label_comparison.left_exclusive end def right_exclusive signal_comparison.right_exclusive + label_comparison.right_exclusive end def differences signal_comparison.differences + label_comparison.differences end def merge(priority: :right) CombinedList.new \ signal_comparison.merge(priority: priority), label_comparison.merge(priority: priority), signal_comparison.headers, # Both should merge headers the same signal_comparison.subheaders # way, so it doesn't matter end private attr_reader :signal_comparison, :label_comparison end end