Sha256: 7c5c3ac0e5d775e2237cb68da0fe4501cf65abbd2171fea974ac171b47d0588d

Contents?: true

Size: 1.71 KB

Versions: 5

Compression:

Stored size: 1.71 KB

Contents

# Author::    Nicolas Despres  <nicolas.despres@gmail.com>.
# Copyright:: Copyright (c) 2004, 2005 TTK team. All rights reserved.
# License::   LGPL
# $Id: DistDuplicate.rb 567 2005-04-13 08:00:06Z polrop $


#FIXME: make me a Composite

module TTK

  module Strategies

    class DistDuplicate < Strategy
      include Concrete

      protected
      def prologue
        super
        @min, @max = 0, 0
        raise(ArgumentError, 'must be run within a tester') if @tester.nil?
      end

      protected
      def run_impl
        doc = Doc.new
        doc.update(@test)
        query_node = @tester.select_tester do |uri, config|
          eval(@select.to_s, binding, "(#@name:select)")
        end
        raise 'no tester selected' if query_node.nil?
        query_node.pre_depth_first do |node|
          node.set_query('run_strategy', doc, @symtbl) if node.leaf?
        end
        @tester.query_tester(query_node)
        @summary, @min, @max = query_node.to_ttk_log(@log,
                                                     @summary,
                                                     @min,
                                                     @max)
      end

      protected
      def pass # :nodoc:
      end

      protected
      def compute_summary
        unless @status == :ABORT
          @summary = @summary.normalize(@min, @max, @weight)
        end
        super
      end

      attribute :select,      'Block which return a boolean',
                              'true',
                              :invisible
      attribute :test,        'Test dispatched to all sub testers',
                              :mandatory, :invisible, :dont_expand

    end # class DistDuplicate

  end # module Strategies

end # module TTK

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ttk-0.1.576 lib/ttk/strategies/DistDuplicate.rb
ttk-0.1.579 lib/ttk/strategies/DistDuplicate.rb
ttk-0.2.0 lib/ttk/strategies/DistDuplicate.rb
ttk-0.1.580 lib/ttk/strategies/DistDuplicate.rb
ttk-0.2.1 lib/ttk/strategies/DistDuplicate.rb