| 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.
# File lib/uttk/strategies/Composite.rb, line 18 def initialize ( *a, &b ) @contents = [] @status_list = [] super end
# 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
# 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
# File lib/uttk/strategies/Composite.rb, line 25 def initialize_copy ( aTest ) super aTest.contents = @contents.dup end
# File lib/uttk/strategies/Composite.rb, line 31 def initialize_test ( aTest ) aTest.wclass = @wclass end
# 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
Do some tasks after a test of the composite has been run.
# 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
Do some tasks before a test of the composite is run.
# File lib/uttk/strategies/Composite.rb, line 118 def prologue_test ( test, log ) end
# 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
# 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.
# File lib/uttk/strategies/Composite.rb, line 124 def run_impl_test ( test, log ) test.run(log) end
# 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