Sha256: 7f68f675a5518ba8f2507adf52dffe9f3ea82ac6cb3f71c3196c74c68522e644

Contents?: true

Size: 1.81 KB

Versions: 38

Compression:

Stored size: 1.81 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 = []
          @existing_names = {}
          # Test names also have to be unique vs. the current flow name
          if tester.smt8?
            @existing_names[flow.filename.sub('.flow', '').to_s] = true
          end
        end

        def filename
          flow.filename
        end

        def add(name, options = {})
          symbol = name.is_a?(Symbol)
          name = make_unique(name)
          # Ensure names given as a symbol stay as a symbol, this is more for
          # alignment to existing test cases than anything else
          name = name.to_sym if symbol
          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)
          name = name.to_s
          tempname = name
          i = 0
          while @existing_names[tempname]
            i += 1
            tempname = "#{name}_#{i}"
          end
          @existing_names[tempname] = true
          tempname
        end
      end
    end
  end
end

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
origen_testers-0.52.8 lib/origen_testers/smartest_based_tester/base/test_suites.rb
origen_testers-0.52.7 lib/origen_testers/smartest_based_tester/base/test_suites.rb
origen_testers-0.52.6 lib/origen_testers/smartest_based_tester/base/test_suites.rb
origen_testers-0.52.5 lib/origen_testers/smartest_based_tester/base/test_suites.rb
origen_testers-0.52.4 lib/origen_testers/smartest_based_tester/base/test_suites.rb
origen_testers-0.52.3 lib/origen_testers/smartest_based_tester/base/test_suites.rb
origen_testers-0.52.1 lib/origen_testers/smartest_based_tester/base/test_suites.rb
origen_testers-0.52.0 lib/origen_testers/smartest_based_tester/base/test_suites.rb
origen_testers-0.51.5 lib/origen_testers/smartest_based_tester/base/test_suites.rb
origen_testers-0.51.4 lib/origen_testers/smartest_based_tester/base/test_suites.rb
origen_testers-0.51.3 lib/origen_testers/smartest_based_tester/base/test_suites.rb
origen_testers-0.51.2 lib/origen_testers/smartest_based_tester/base/test_suites.rb
origen_testers-0.51.1 lib/origen_testers/smartest_based_tester/base/test_suites.rb
origen_testers-0.51.0 lib/origen_testers/smartest_based_tester/base/test_suites.rb
origen_testers-0.50.0 lib/origen_testers/smartest_based_tester/base/test_suites.rb
origen_testers-0.49.4 lib/origen_testers/smartest_based_tester/base/test_suites.rb
origen_testers-0.49.3 lib/origen_testers/smartest_based_tester/base/test_suites.rb
origen_testers-0.49.2 lib/origen_testers/smartest_based_tester/base/test_suites.rb
origen_testers-0.49.1 lib/origen_testers/smartest_based_tester/base/test_suites.rb
origen_testers-0.49.0 lib/origen_testers/smartest_based_tester/base/test_suites.rb