Project

General

Profile

Bug #13612 ยป segf_test.rb

rovf (Ronald Fischer), 05/30/2017 01:40 PM

 
1
class EXPERT
2
    
3
    FIND_CHAIN_FOR_POS_FILTER_PIPELINE = 
4
      [ 
5
        :no_filter,
6
        :filter_by_etkz_e,
7
        :filter_chain_in_chain,
8
      ].each
9
    
10
    def find_chain_for_pos(sw_lines_for_module)
11

    
12
      br = '4711'
13

    
14
      FIND_CHAIN_FOR_POS_FILTER_PIPELINE.rewind        
15

    
16
      begin
17
        
18
        while true
19
          
20
          filter_method_symb = FIND_CHAIN_FOR_POS_FILTER_PIPELINE.next
21
          
22
          sw_lines_for_module = NVP.send(filter_method_symb, br, sw_lines_for_module) 
23
          
24
          # LOG.trace { "SW Lines left after filter #{filter_method_symb}:\n#{SwRec.show_array(sw_lines_for_module)}"}
25
          
26
        end
27
        
28
      rescue StopIteration
29
        
30
        puts "done...."
31
        # LOG.trace "Could not find unique GRPID"
32
        
33
      end
34
      
35
                                                                                          
36
      nil                                                                                             
37
      
38
    end
39
end
40

    
41
class Cnt
42
  def initalize(n)
43
    @c=n
44
  end
45
  def decr
46
    @c -= 1
47
  end
48
  def to_s
49
    @c.to_s
50
  end
51
end
52

    
53
module NVP
54
  extend self
55
  def no_filter(b,a)
56
    [[a.size, b.nil?]] * (a.size)
57
  end
58
  def filter_by_etkz_e(x,y)
59
    no_filter(x,y)
60
  end
61
  def filter_chain_in_chain(x,y)
62
    filter_by_etkz_e(x,y)
63
  end
64
  def mu?(cn)
65
    cn.decr > 0
66
  end
67
end
68

    
69
newc = (ARGV[0]||1).to_i
70

    
71
c = EXPERT.new
72

    
73
newc.times do |cnt| 
74
  # puts "#{cnt} out of #{newc}"
75
  puts cnt
76
  c.find_chain_for_pos(%w(a b c d e))  
77
end