Sha256: 84f9bed86cdcc840e3874bba91c6fc82d872cad77b6abddfc5d237fbd9f627bb

Contents?: true

Size: 788 Bytes

Versions: 15

Compression:

Stored size: 788 Bytes

Contents

module ATP
  module Validators
    class DuplicateIDs < Validator
      def on_completion
        if @duplicate_ids
          @duplicate_ids.each do |id, nodes|
            Origen.log.error "Test ID #{id} is defined more than once in flow #{flow.name}:"
            nodes.each do |node|
              Origen.log.error "  #{node.source}"
            end
          end
          true
        end
      end

      def on_id(node)
        @existing_ids ||= {}
        id = node.value
        if @existing_ids[id]
          @duplicate_ids ||= {}
          if @duplicate_ids[id]
            @duplicate_ids[id] << node
          else
            @duplicate_ids[id] = [@existing_ids[id], node]
          end
        else
          @existing_ids[id] = node
        end
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
atp-0.8.0 lib/atp/validators/duplicate_ids.rb
atp-0.7.0 lib/atp/validators/duplicate_ids.rb
atp-0.6.0 lib/atp/validators/duplicate_ids.rb
atp-0.5.4 lib/atp/validators/duplicate_ids.rb
atp-0.5.3 lib/atp/validators/duplicate_ids.rb
atp-0.5.0 lib/atp/validators/duplicate_ids.rb
atp-0.4.3 lib/atp/validators/duplicate_ids.rb
atp-0.4.2 lib/atp/validators/duplicate_ids.rb
atp-0.4.1 lib/atp/validators/duplicate_ids.rb
atp-0.4.0 lib/atp/validators/duplicate_ids.rb
atp-0.3.3 lib/atp/validators/duplicate_ids.rb
atp-0.3.2 lib/atp/validators/duplicate_ids.rb
atp-0.3.1 lib/atp/validators/duplicate_ids.rb
atp-0.3.0 lib/atp/validators/duplicate_ids.rb
atp-0.2.1 lib/atp/validators/duplicate_ids.rb