title: Program Calculate Area Octagon
signature: function program_calculate_area_octagon(side)
source_py: def program_calculate_area_octagon(side):
      return (((2 * (1 + math.sqrt(2))) * side) * side)
source_cpp: double program_calculate_area_octagon(double side) {
    return ( float ) ( 2 * ( 1 + sqrt ( 2 ) ) * side * side );
  }
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 math.abs(actual - expected) < 1e-09
  end
  
  function driver(side, expected)
      local exec_result;
      local status, error_msg = pcall(function () 
          exec_result=PLACEHOLDER_FN_NAME(side) 
      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(5859.798616323926, 165794860.15449765)
      print(string.format("TEST-0...%s",result))
  
      result = driver(-6381.210375893524, 196612808.27272156)
      print(string.format("TEST-1...%s",result))
  
      result = driver(2442.246292006922, 28799476.852711495)
      print(string.format("TEST-2...%s",result))
  
      result = driver(-9624.81536339737, 447291345.3087225)
      print(string.format("TEST-3...%s",result))
  
      result = driver(8679.436805247444, 363738081.5089271)
      print(string.format("TEST-4...%s",result))
  
      result = driver(-2682.3245401089525, 34739881.027797274)
      print(string.format("TEST-5...%s",result))
  
      result = driver(7216.9161613024435, 251483213.5426547)
      print(string.format("TEST-6...%s",result))
  
      result = driver(-5881.789859815442, 167041618.6125096)
      print(string.format("TEST-7...%s",result))
  
      result = driver(2497.776395789202, 30124010.84898392)
      print(string.format("TEST-8...%s",result))
  
      result = driver(-9598.912195459263, 444887003.7391194)
      print(string.format("TEST-9...%s",result))
  
  end
  
  main()
question_info.entry_cls_name: Solution
question_info.test_list: [{"idx": 0, "outputs": 165794860.15449765, "inputs": {"side": 5859.798616323926}}, {"idx": 1, "outputs": 196612808.27272156, "inputs": {"side": -6381.210375893524}}, {"idx": 2, "outputs": 28799476.852711495, "inputs": {"side": 2442.246292006922}}, {"idx": 3, "outputs": 447291345.3087225, "inputs": {"side": -9624.81536339737}}, {"idx": 4, "outputs": 363738081.5089271, "inputs": {"side": 8679.436805247444}}, {"idx": 5, "outputs": 34739881.027797274, "inputs": {"side": -2682.3245401089525}}, {"idx": 6, "outputs": 251483213.5426547, "inputs": {"side": 7216.9161613024435}}, {"idx": 7, "outputs": 167041618.6125096, "inputs": {"side": -5881.789859815442}}, {"idx": 8, "outputs": 30124010.84898392, "inputs": {"side": 2497.776395789202}}, {"idx": 9, "outputs": 444887003.7391194, "inputs": {"side": -9598.912195459263}}]
question_info.extension: lua
question_info.entry_fn_name: program_calculate_area_octagon
question_info.test_case_ids: 0 1 2 3 4 5 6 7 8 9
question_info.commands: lua __FILENAME__