Sha256: 8aa9fb086583609caf68441cee9ea5cf45f47790660107c5fa7aa62db03151b0

Contents?: true

Size: 1.79 KB

Versions: 17

Compression:

Stored size: 1.79 KB

Contents

require 'pathname'
module OrigenTesters
  module SmartestBasedTester
    class Base
      class VariablesFile
        include OrigenTesters::Generator

        attr_reader :variables
        attr_accessor :filename, :id, :subdirectory

        def initialize(options = {})
        end

        def subdirectory
          @subdirectory ||= 'testflow/mfh.testflow.setup'
        end

        def add_variables(vars)
          if @variables
            vars.each do |k, v|
              if k == :empty?
                @variables[:empty?] ||= v
              else
                v.each do |k2, v2|
                  unless v2.empty?
                    @variables[k][k2] |= v2
                  end
                end
              end
            end
          else
            @variables = vars
          end
        end

        # What SMT7 calls a flag
        def flags
          if variables
            (variables[:all][:referenced_enables] + variables[:all][:set_enables]).uniq.sort do |x, y|
              x = x[0] if x.is_a?(Array)
              y = y[0] if y.is_a?(Array)
              # Need to use strings for the comparison as some flags can be a string and some a symbol
              x.to_s <=> y.to_s
            end
          end
        end

        # What SMT7 calls a declaration
        def declarations
          if variables
            (variables[:all][:jobs] + variables[:all][:referenced_flags] + variables[:all][:set_flags]).uniq.sort do |x, y|
              x = x[0] if x.is_a?(Array)
              y = y[0] if y.is_a?(Array)
              # Need to use strings for the comparison as some declarations can be a string and some a symbol
              x.to_s <=> y.to_s
            end
          end
        end

        def to_be_written?
          tester.smt7?
        end
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
origen_testers-0.51.5 lib/origen_testers/smartest_based_tester/base/variables_file.rb
origen_testers-0.51.4 lib/origen_testers/smartest_based_tester/base/variables_file.rb
origen_testers-0.51.3 lib/origen_testers/smartest_based_tester/base/variables_file.rb
origen_testers-0.51.2 lib/origen_testers/smartest_based_tester/base/variables_file.rb
origen_testers-0.51.1 lib/origen_testers/smartest_based_tester/base/variables_file.rb
origen_testers-0.51.0 lib/origen_testers/smartest_based_tester/base/variables_file.rb
origen_testers-0.50.0 lib/origen_testers/smartest_based_tester/base/variables_file.rb
origen_testers-0.49.4 lib/origen_testers/smartest_based_tester/base/variables_file.rb
origen_testers-0.49.3 lib/origen_testers/smartest_based_tester/base/variables_file.rb
origen_testers-0.49.2 lib/origen_testers/smartest_based_tester/base/variables_file.rb
origen_testers-0.49.1 lib/origen_testers/smartest_based_tester/base/variables_file.rb
origen_testers-0.49.0 lib/origen_testers/smartest_based_tester/base/variables_file.rb
origen_testers-0.48.3 lib/origen_testers/smartest_based_tester/base/variables_file.rb
origen_testers-0.48.2 lib/origen_testers/smartest_based_tester/base/variables_file.rb
origen_testers-0.48.1 lib/origen_testers/smartest_based_tester/base/variables_file.rb
origen_testers-0.48.0 lib/origen_testers/smartest_based_tester/base/variables_file.rb
origen_testers-0.47.0 lib/origen_testers/smartest_based_tester/base/variables_file.rb