Class TTK::Strategies::Composite
In: lib/ttk/strategies/Composite.rb
Parent: Strategy

Methods

Included Modules

Abstract

Classes and Modules

Module TTK::Strategies::Composite::Ordered

Public Class methods

[Source]

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

Public Instance methods

[Source]

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

[Source]

# File lib/ttk/strategies/Composite.rb, line 28
      def create ( anObject, &block )
        res = @symtbl[:loader].load(anObject) do |aTest|
          initialize_test(aTest)
          block[aTest] if block_given?
        end
        @contents << res
        res
      end

[Source]

# File lib/ttk/strategies/Composite.rb, line 22
      def initialize_test ( aTest )
        aTest.wclass = @wclass
        aTest.symtbl = new_symtbl
      end

[Source]

# File lib/ttk/strategies/Composite.rb, line 44
      def new_symtbl
        @symtbl.class.new(@symtbl)
      end

Protected Instance methods

[Source]

# File lib/ttk/strategies/Composite.rb, line 78
      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/ttk/strategies/Composite.rb, line 137
      def assign_at_last
        :contents
      end

[Source]

# File lib/ttk/strategies/Composite.rb, line 88
      def epilogue
        compute_final_weight
        (@log.path_size - @composite_saved_path_size).times { @log.up }
        super
      end

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

[Source]

# File lib/ttk/strategies/Composite.rb, line 110
      def epilogue_test ( test, log )
        if test.fatal and not test.status.pass?
          @fatal_failure = "Last test was fatal (#{test.name})"
        end
      end

[Source]

# File lib/ttk/strategies/Composite.rb, line 49
      def prologue
        begin
          super
        ensure
          @composite_saved_path_size = @log.path_size
        end
        # @contents.map! do |t|
          # t.testify
        # end
      end

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

[Source]

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

[Source]

# File lib/ttk/strategies/Composite.rb, line 126
      def run_composite
        @log.new_node :contents, :seq do
          @contents.each do |t|
            run_test(t, @log)
            break if defined? @fatal_failure
          end
        end
      end

[Source]

# File lib/ttk/strategies/Composite.rb, line 62
      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/ttk/strategies/Composite.rb, line 103
      def run_impl_test ( test, log )
        test.run(log)
      end

[Source]

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

[Validate]