title: Middle Of Three Using Minimum Comparisons 2
signature: function middle_of_three_using_minimum_comparisons_2(a, b, c)
source_py: def middle_of_three_using_minimum_comparisons_2(a, b, c):
      x = (a - b)
      y = (b - c)
      z = (a - c)
      if ((x * y) > 0):
          return b
      elif ((x * z) > 0):
          return
      else:
          return a
source_cpp: int middle_of_three_using_minimum_comparisons_2(int a, int b, int c) {
    int x = a - b;
    int y = b - c;
    int z = a - c;
    if ( x * y > 0 ) return b;
    else if ( x * z > 0 ) return c;
    else return a;
  }
question_info.entry_fn_name: middle_of_three_using_minimum_comparisons_2
question_info.entry_cls_name: Solution
question_info.test_case_ids: ['0', '1', '2', '3']
question_info.test_code: 
  
  -- SOLUTION CODE
  -- ============================================
  PLACEHOLDER_CODE_BODY
  
  -- TESTING CODE 
  -- ============================================
  function isCorrect(actual, expected)
      if type(expected) ~= type(actual) then
          return false
      end
      
      if type(expected) == 'table' then
          for k,v_expected in pairs(expected) do
              
              if actual[k] == nil then
                  return false
              end
              local v_actual = actual[k]
              if not isCorrect(v_actual, v_expected) then
                  return false
              end
              actual[k]=nil
          end
      
          if next(actual) then 
              return false
          end
          return true
      else
          return actual == expected
      end
  end
  
  function validateSolution(actual, expected)
      return isCorrect(actual,expected)
  end
  
  function driver(a, b, c, expected)
      local exec_result;
      local status, error_msg = pcall(function () 
          exec_result=PLACEHOLDER_FN_NAME(a, b, c) 
      end)
      if status then
          if validateSolution(exec_result,expected) then
              return "PASSED"
          end
          return "FAILED"
      else
          return string.format("ERROR=%s",string.gsub(error_msg,".*:[%d]+: ",""))
      end
  end
      
  function main()
      result = driver(48, 46, 38, 46)
      print(string.format("TEST-0...%s",result))
  
      result = driver(93, 34, 11, 34)
      print(string.format("TEST-1...%s",result))
  
      result = driver(58, 78, 6, 58)
      print(string.format("TEST-2...%s",result))
  
      result = driver(13, 3, 23, 13)
      print(string.format("TEST-3...%s",result))
  
  end
  
  main()
question_info.test_list: [{"idx": 0, "outputs": 46, "inputs": {"a": 48, "b": 46, "c": 38}}, {"idx": 1, "outputs": 34, "inputs": {"a": 93, "b": 34, "c": 11}}, {"idx": 2, "outputs": 58, "inputs": {"a": 58, "b": 78, "c": 6}}, {"idx": 3, "outputs": 13, "inputs": {"a": 13, "b": 3, "c": 23}}]