Sha256: 8f33367688037d9eac6853a045d8db27d728a37f6b53a6a5ee467353733efb1f

Contents?: true

Size: 1.44 KB

Versions: 22

Compression:

Stored size: 1.44 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|
            if suite.pattern
              flow.pattern_master.add suite.pattern
              Origen.interface.pattern_master.add suite.pattern
            end
          end
        end

        private

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

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
origen_testers-0.4.1 lib/origen_testers/smartest_based_tester/base/test_suites.rb
origen_testers-0.4.0 lib/origen_testers/smartest_based_tester/base/test_suites.rb