Sha256: 84457cf0dfc417488c6342782a72d171f9354550e29b137128160b1b01e64ea2

Contents?: true

Size: 1.46 KB

Versions: 1

Compression:

Stored size: 1.46 KB

Contents

module OrigenTesters
  module SmartestBasedTester
    class Base
      class TestSuites
        # Origen::Tester::Generator not included since test suites do not have their
        # own top-level sheet, they will be incorporated within the flow sheet

        attr_accessor :flow, :collection

        def initialize(flow)
          @flow = flow
          @collection = []
        end

        def filename
          flow.filename
        end

        def add(name, options = {})
          name = make_unique(name)
          suite = platform::TestSuite.new(name, options)
          @collection << suite
          # c = Origen.interface.consume_comments
          # Origen.interface.descriptions.add_for_test_definition(name, c)
          suite
        end
        alias_method :run, :add
        alias_method :run_and_branch, :add

        def platform
          Origen.interface.platform
        end

        def finalize
          # collection.each do |suite|
          # end
        end

        def sorted_collection
          @collection.sort_by { |ts| ts.name.to_s }
        end

        private

        def make_unique(name)
          @existing_names ||= {}
          if @existing_names[name.to_sym]
            @existing_names[name.to_sym] += 1
            "#{name}_#{@existing_names[name.to_sym]}"
          else
            @existing_names[name.to_sym] = 0
            name
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
origen_testers-0.13.2 lib/origen_testers/smartest_based_tester/base/test_suites.rb