title: Detect If Two Integers Have Opposite Signs
signature: function detect_if_two_integers_have_opposite_signs(x, y)
source_py: def detect_if_two_integers_have_opposite_signs(x, y):
      return ((x ^ y) < 0)
source_cpp: bool detect_if_two_integers_have_opposite_signs(int x, int y) {
    return ( ( x ^ y ) < 0 );
  }
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(x, y, expected)
      local exec_result;
      local status, error_msg = pcall(function () 
          exec_result=PLACEHOLDER_FN_NAME(x, y) 
      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(59, -99, true)
      print(string.format("TEST-0...%s",result))
  
      result = driver(-20, -21, false)
      print(string.format("TEST-1...%s",result))
  
      result = driver(-100, 79, true)
      print(string.format("TEST-2...%s",result))
  
      result = driver(54, -49, true)
      print(string.format("TEST-3...%s",result))
  
      result = driver(-16, 16, true)
      print(string.format("TEST-4...%s",result))
  
      result = driver(-23, -68, false)
      print(string.format("TEST-5...%s",result))
  
      result = driver(93, 37, false)
      print(string.format("TEST-6...%s",result))
  
      result = driver(24, -61, true)
      print(string.format("TEST-7...%s",result))
  
      result = driver(-8, 69, true)
      print(string.format("TEST-8...%s",result))
  
      result = driver(29, 10, false)
      print(string.format("TEST-9...%s",result))
  
  end
  
  main()
question_info.entry_cls_name: Solution
question_info.test_list: [{"idx": 0, "outputs": true, "inputs": {"x": 59, "y": -99}}, {"idx": 1, "outputs": false, "inputs": {"x": -20, "y": -21}}, {"idx": 2, "outputs": true, "inputs": {"x": -100, "y": 79}}, {"idx": 3, "outputs": true, "inputs": {"x": 54, "y": -49}}, {"idx": 4, "outputs": true, "inputs": {"x": -16, "y": 16}}, {"idx": 5, "outputs": false, "inputs": {"x": -23, "y": -68}}, {"idx": 6, "outputs": false, "inputs": {"x": 93, "y": 37}}, {"idx": 7, "outputs": true, "inputs": {"x": 24, "y": -61}}, {"idx": 8, "outputs": true, "inputs": {"x": -8, "y": 69}}, {"idx": 9, "outputs": false, "inputs": {"x": 29, "y": 10}}]
question_info.extension: lua
question_info.entry_fn_name: detect_if_two_integers_have_opposite_signs
question_info.test_case_ids: 0 1 2 3 4 5 6 7 8 9
question_info.commands: lua __FILENAME__