Sha256: d5b67fda1eec0f01795aa5f6df3cf69210b4146f6f3c0802b66cf8acdc096648

Contents?: true

Size: 1011 Bytes

Versions: 2

Compression:

Stored size: 1011 Bytes

Contents

module OrigenTesters
  module SmartestBasedTester
    class Base
      module Processors
        # Processes the AST and tabulates occurrences of unique set_run_flag nodes
        class ExtractRunFlagTable < ATP::Processor
          # Hash table of run_flag name with number of times used
          attr_reader :run_flag_table

          # Reset hash table
          def initialize
            @run_flag_table = {}.with_indifferent_access
          end

          # For run_flag nodes, increment # of occurrences for specified flag
          def on_run_flag(node)
            children = node.children.dup
            names = children.shift
            state = children.shift
            Array(names).each do |name|
              if @run_flag_table[name.to_sym].nil?
                @run_flag_table[name.to_sym] = 1
              else
                @run_flag_table[name.to_sym] += 1
              end
            end
            process_all(node.children)
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
origen_testers-0.13.1 lib/origen_testers/smartest_based_tester/base/processors/extract_run_flag_table.rb
origen_testers-0.13.0 lib/origen_testers/smartest_based_tester/base/processors/extract_run_flag_table.rb