Class Uttk::Strategies::Composite
In: lib/uttk/strategies/Composite.rb
lib/uttk/strategies/Composite/contents_eval.rb
Parent: Strategy

I‘m the super class of every strategy class that are composed by other strategies.

Methods

Included Modules

Abstract

Classes and Modules

Module Uttk::Strategies::Composite::Ordered
Class Uttk::Strategies::Composite::ContentsEval

Public Class methods

[Source]

# File lib/uttk/strategies/Composite.rb, line 18
      def initialize ( *a, &b )
        @contents = []
        @status_list = []
        super
      end

Public Instance methods

[Source]

# File lib/uttk/strategies/Composite.rb, line 47
      def << ( anObject )
        create(anObject)
        self
      end

[Source]

# File lib/uttk/strategies/Composite.rb, line 65
      def contents(other=nil, &block)
        if other.nil?
          if block.nil?
            internal_contents
          else
            self.contents = ContentsEval.new(&block).contents
          end
        else
          self.contents = other
        end
      end

[Source]

# File lib/uttk/strategies/Composite.rb, line 36
      def create ( anObject, &block )
        res = anObject.testify(new_symtbl.merge!(testify_options)) do |aTest|
          initialize_test(aTest)
          raise "nil symtbl" if aTest.symtbl.nil?
          block[aTest] if block
        end
        @contents << res
        res
      end

[Source]

# File lib/uttk/strategies/Composite.rb, line 25
      def initialize_copy ( aTest )
        super
        aTest.contents = @contents.dup
      end

[Source]

# File lib/uttk/strategies/Composite.rb, line 31
      def initialize_test ( aTest )
        aTest.wclass = @wclass
      end

Protected Instance methods

[Source]

# File lib/uttk/strategies/Composite.rb, line 100
      def assertion
        compute_final_weight
        fail @final_weight, @fatal_failure if defined? @fatal_failure
        skip if @tmp_weight.start?
        pass if @final_weight.pass?
        fail @final_weight
      end

[Source]

# File lib/uttk/strategies/Composite.rb, line 165
      def assign_at_last
        :contents
      end

[Source]

# File lib/uttk/strategies/Composite.rb, line 110
      def epilogue
        compute_final_weight
        super
      end

Do some tasks after a test of the composite has been run.

[Source]

# File lib/uttk/strategies/Composite.rb, line 131
      def epilogue_test ( test, log )
        st = test.status
        if test.fatal and
           not (st.pass? or (st.is_a? SkipStatus and st.weight.max?))
          @fatal_failure = "Last test was fatal (#{test.name})"
        end
      end

[Source]

# File lib/uttk/strategies/Composite.rb, line 78
      def internal_contents
        @contents
      end

[Source]

# File lib/uttk/strategies/Composite.rb, line 53
      def new_symtbl
        @symtbl.new_child
      end

Do some tasks before a test of the composite is run.

[Source]

# File lib/uttk/strategies/Composite.rb, line 118
      def prologue_test ( test, log )
      end

[Source]

# File lib/uttk/strategies/Composite.rb, line 149
      def run_composite
        @log.new_node :contents, :ordered => true do
          @contents.each do |t|
            if defined? @fatal_failure
              st = FailStatus.new
              st.weight *= t.weight
              @status_list << st
            else
              run_test(t, @log)
            end
          end
        end
      end

[Source]

# File lib/uttk/strategies/Composite.rb, line 84
      def run_impl
        skip if @contents.empty?
        run_composite()
      end

Do some tasks at the moment where a test of the composite is run.

[Source]

# File lib/uttk/strategies/Composite.rb, line 124
      def run_impl_test ( test, log )
        test.run(log)
      end

[Source]

# File lib/uttk/strategies/Composite.rb, line 141
      def run_test ( test, log )
        prologue_test(test, log)
        @status_list << run_impl_test(test, log)
        epilogue_test(test, log)
      end

[Source]

# File lib/uttk/strategies/Composite.rb, line 59
      def testify_options
        {}
      end

[Validate]