Sha256: bc5a82308271df3bac0db0b10789e597acf8210e2b8e430bfea1e9ce8b8e8af0

Contents?: true

Size: 1.02 KB

Versions: 1

Compression:

Stored size: 1.02 KB

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

1 entries across 1 versions & 1 rubygems

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