how to check whether test case has been passed or failed and to know its index value : regarding to the above subject i need to check test cases status like whether it is passed or failed and to know its index value how can i achieve this,i have tried with binary search but that is for key is found or not found,,can u help me out
here it is binary search code i have tried with 

class Array
  def binary_search(val, low=0, high=(length - 1))
    
return nil if high < low
    
mid = (low + high) >> 1
    
case val <=> self[mid]
      
when -1
       
 binary_search(val, low, mid - 1)
     
 when 1
       
 binary_search(val, mid + 1, high)
      else mid
    end
  end
end
 
ary = [0,1,4,5,6,7,8,9,12,26,45,67,78,90]
 
[0,42,45,24324,99999].each do |val|
 
 i = ary.binary_search(val)
  
if i
   
 puts "found #{val} at index #{i}: #{ary[i]}"
  
else
   
 puts "#{val} not found in array"
  
end

end
