title: Middle Of Three Using Minimum Comparisons
signature: function middle_of_three_using_minimum_comparisons(a, b, c)
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(56, 5, 82, 56)
      print(string.format("TEST-0...%s",result))
  
      result = driver(56, 60, 17, 56)
      print(string.format("TEST-1...%s",result))
  
      result = driver(36, 56, 51, 51)
      print(string.format("TEST-2...%s",result))
  
      result = driver(71, 54, 6, 54)
      print(string.format("TEST-3...%s",result))
  
      result = driver(3, 70, 81, 70)
      print(string.format("TEST-4...%s",result))
  
      result = driver(84, 57, 47, 57)
      print(string.format("TEST-5...%s",result))
  
      result = driver(30, 80, 85, 80)
      print(string.format("TEST-6...%s",result))
  
      result = driver(82, 54, 32, 54)
      print(string.format("TEST-7...%s",result))
  
      result = driver(90, 70, 55, 70)
      print(string.format("TEST-8...%s",result))
  
      result = driver(38, 4, 5, 5)
      print(string.format("TEST-9...%s",result))
  
  end
  
  main()
source_py: def middle_of_three_using_minimum_comparisons(a, b, c):
      if (((a < b) and (b < c)) or ((c < b) and (b < a))):
          return b
      if (((b < a) and (a < c)) or ((c < a) and (a < b))):
          return a
      else:
          return c
source_cpp: int middle_of_three_using_minimum_comparisons(int a, int b, int c) {
    if ( ( a < b && b < c ) || ( c < b && b < a ) ) return b;
    else if ( ( b < a && a < c ) || ( c < a && a < b ) ) return a;
    else return c;
  }