Class: TestCaseGenerator::Utils
- Inherits:
-
Object
- Object
- TestCaseGenerator::Utils
- Defined in:
- lib/test_case_generator/utils.rb
Class Method Summary collapse
- .concat!(out_items, other_list) ⇒ Object
- .make_method_name(label) ⇒ Object
- .para!(out_items, other_list) ⇒ Object
Class Method Details
.concat!(out_items, other_list) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/test_case_generator/utils.rb', line 9 def self.concat!(out_items, other_list) if out_items.size == 0 out_items.concat other_list else return out_items if other_list.empty? tmp_list = [] out_items.each do |item1| other_list.each do |item2| tmp_list << item1 + item2 end end out_items.clear out_items.concat tmp_list end out_items end |
.make_method_name(label) ⇒ Object
3 4 5 6 7 |
# File 'lib/test_case_generator/utils.rb', line 3 def self.make_method_name(label) label.to_s.split('_').inject([]) do |buffer, e| buffer << (buffer.empty? ? e : e.capitalize) end.join end |
.para!(out_items, other_list) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/test_case_generator/utils.rb', line 29 def self.para!(out_items, other_list) if out_items.size == 0 out_items.concat other_list else return out_items if other_list.empty? tmp_list = [] out_items.each do |item1| other_list.each do |item2| (0...(item1.size + item2.size)).to_a.combination(item1.size) do |index_arr| idx_item1 = 0 idx_item2 = 0 tmp_list << (0...(item1.size + item2.size)).to_a.map do |x| if index_arr.include?(x) picked = item1[idx_item1] idx_item1 += 1 else picked = item2[idx_item2] idx_item2 += 1 end picked end end end end out_items.clear out_items.concat tmp_list end out_items end |