lib/dither/test_case.rb in dither-0.0.6 vs lib/dither/test_case.rb in dither-0.0.7
- old
+ new
@@ -44,33 +44,22 @@
arr[param.i] = param.j unless param.unbound?
end
arr
end
- def self.from_array(arr)
- test_case = TestCase.new
- arr.each_with_index do |i, e|
- if e.nil?
- test_case << unbound_param_pool[i]
- else
- test_case << bound_param_pool[i][e]
- end
- end
- test_case
- end
-
# return nil if there is a conflict
# return self if no conflict
def merge_without_conflict(i, test_case, &block)
new_elements = []
self.to_ipog_array(i).zip(test_case.to_ipog_array(i))
.each_with_index do |arr, a|
first, second = arr
- next if (first == second) || second.nil?
if first.nil? && second.nil?
new_elements << unbound_param_pool[a]
+ elsif (first == second) || second.nil?
+ next
elsif first.nil?
new_elements << bound_param_pool[a][second]
else
return nil
end
@@ -79,10 +68,13 @@
new_self = self.clone
new_elements.each { |a| new_self << a }
return nil if block_given? && block.call(new_self)
- new_elements.each { |a| self << a }
+ new_elements.each do |a|
+ self.delete(unbound_param_pool[a.i]) unless a.unbound?
+ self << a
+ end
self
end
end # TestCase
end # Dither