Refactor code structure for improved readability and maintainability
This commit is contained in:
parent
cd656b08a8
commit
8f501d3e52
|
|
@ -1,628 +0,0 @@
|
|||
[
|
||||
{
|
||||
"task_id": 1,
|
||||
"text": "Crea un microservicio AVAP que procese múltiples proveedores de servicios financieros. El servicio debe: 1) Obtener parámetros de consulta desde la URL, 2) Conectar con diferentes proveedores usando avapConnector, 3) Procesar cada proveedor en un bucle usando startLoop, 4) Validar y filtrar resultados usando condicionales, 5) Retornar datos consolidados con código de estado HTTP apropiado.",
|
||||
"code": "addParam(\"providers\", providers_param)\naddParam(\"user_id\", user_id)\naddParam(\"account_type\", account_type)\nif(providers_param, None, \"==\")\n _status = 400\n addResult(error_msg)\nelse()\n getQueryParamList(\"providers\", provider_list)\n getListLen(provider_list, total_providers)\n variableToList({}, consolidated_data)\n processed_count = 0\n startLoop(i, 0, total_providers)\n itemFromList(provider_list, i, current_provider)\n if(current_provider, \"belvo\", \"==\")\n belvo_connector = avapConnector(\"20908e93260147acb2636967021fbf5d\")\n accounts_data = belvo_connector.list_accounts(user_id, account_type)\n if(None, None, `accounts_data is not None and len(accounts_data) > 0`)\n variableFromJSON(accounts_data, \"balance\", balance)\n variableFromJSON(accounts_data, \"currency\", currency)\n AddVariableToJSON(\"provider\", current_provider, account_info)\n AddVariableToJSON(\"balance\", balance, account_info)\n AddVariableToJSON(\"currency\", currency, account_info)\n consolidated_data.append(account_info)\n processed_count = processed_count + 1\n end()\n else()\n if(current_provider, \"plaid\", \"==\")\n plaid_connector = avapConnector(\"8f4e2a1b5c6d7e8f9a0b1c2d3e4f5a6b\")\n balances_result = plaid_connector.get_balances(user_id)\n if(None, None, `balances_result is not None`)\n variableFromJSON(balances_result, \"available\", available_balance)\n if(available_balance, 0, \">\")\n AddVariableToJSON(\"provider\", current_provider, plaid_info)\n AddVariableToJSON(\"balance\", available_balance, plaid_info)\n AddVariableToJSON(\"currency\", \"USD\", plaid_info)\n consolidated_data.append(plaid_info)\n processed_count = processed_count + 1\n end()\n end()\n end()\n end()\n endLoop()\n if(processed_count, 0, \">\")\n _status = 200\n AddVariableToJSON(\"total_providers_processed\", processed_count, response_data)\n AddVariableToJSON(\"accounts\", consolidated_data, response_data)\n addResult(response_data)\n else()\n _status = 404\n AddVariableToJSON(\"error\", \"No valid account data found\", error_response)\n addResult(error_response)\n end()\nend()",
|
||||
"test_inputs": {
|
||||
"providers": "belvo,plaid",
|
||||
"user_id": "12345",
|
||||
"account_type": "checking"
|
||||
},
|
||||
"test_list": [
|
||||
"re.match(r'200|404', str(_status))",
|
||||
"re.match(r'\\d+', str(processed_count))",
|
||||
"re.match(r'.*accounts.*', str(response_data))"
|
||||
],
|
||||
"_cell": [
|
||||
"avapConnector",
|
||||
"startLoop"
|
||||
],
|
||||
"_quality": {
|
||||
"fidelity": 1.0,
|
||||
"bonus_ratio": 0.333,
|
||||
"test_quality": 1.0,
|
||||
"richness": 1.0,
|
||||
"quality": 1.4,
|
||||
"detected": [
|
||||
"AddVariableToJSON",
|
||||
"_status",
|
||||
"addParam",
|
||||
"addResult",
|
||||
"avapConnector",
|
||||
"else",
|
||||
"end",
|
||||
"endLoop",
|
||||
"getListLen",
|
||||
"getQueryParamList",
|
||||
"if_mode2",
|
||||
"itemFromList",
|
||||
"startLoop",
|
||||
"variableFromJSON"
|
||||
],
|
||||
"cell": [
|
||||
"avapConnector",
|
||||
"startLoop"
|
||||
],
|
||||
"extra": [
|
||||
"AddVariableToJSON",
|
||||
"_status",
|
||||
"addParam",
|
||||
"addResult",
|
||||
"else",
|
||||
"end",
|
||||
"endLoop",
|
||||
"getListLen",
|
||||
"getQueryParamList",
|
||||
"if_mode2",
|
||||
"itemFromList",
|
||||
"variableFromJSON"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"task_id": 2,
|
||||
"text": "Implementa un microservicio AVAP que actualice múltiples registros de usuario de forma asíncrona. El servicio debe: 1) Obtener una lista de IDs de usuario desde parámetros de consulta, 2) Procesar cada actualización en paralelo usando goroutines, 3) Esperar a que todas las actualizaciones concurrentes terminen, 4) Retornar un resumen con el número total de registros actualizados y el estado de la operación.",
|
||||
"code": "addParam(\"operation_type\", op_type)\ngetQueryParamList(\"user_ids\", user_list)\ngetListLen(user_list, total_users)\nif(total_users, 0, \"==\")\n_status = 400\naddVar(error_msg, \"No user IDs provided\")\naddResult(error_msg)\nelse()\naddVar(updated_count, 0)\naddVar(concurrent_tasks, [])\naddVar(counter, 0)\nstartLoop(counter, 0, total_users)\nitemFromList(user_list, counter, current_user_id)\ntask_id = go updateUserRecord(current_user_id)\nvariableToList(task_id, temp_list)\nif(counter, 0, \"==\")\naddVar(concurrent_tasks, temp_list)\nelse()\ngetListLen(concurrent_tasks, current_len)\nitemFromList(temp_list, 0, new_task)\nAddVariableToJSON(current_len, new_task, task_dict)\nvariableFromJSON(task_dict, current_len, retrieved_task)\nvariableToList(retrieved_task, single_task)\naddVar(concurrent_tasks, single_task)\nend()\nendLoop()\ngetListLen(concurrent_tasks, task_count)\naddVar(results_collected, 0)\nstartLoop(results_collected, 0, task_count)\nitemFromList(concurrent_tasks, results_collected, current_task)\nupdate_result = gather(current_task, 5000)\nif(update_result, \"success\", \"==\")\naddVar(updated_count, updated_count + 1)\nend()\nendLoop()\naddVar(success_rate, updated_count / total_users * 100)\nif(success_rate, 80.0, \">=\")\n_status = 200\naddVar(status_msg, \"Bulk update completed successfully\")\nelse()\n_status = 206\naddVar(status_msg, \"Partial update completed with some failures\")\nend()\naddResult(updated_count)\naddResult(total_users)\naddResult(success_rate)\naddResult(status_msg)\nend()\n\nfunction updateUserRecord(user_id)\n{\naddVar(table_name, \"users\")\naddVar(update_fields, [\"last_updated\", \"status\"])\ngetDateTime(\"%Y-%m-%d %H:%M:%S\", 0, \"UTC\", current_time)\naddVar(field_values, [current_time, \"active\"])\naddVar(selector, \"id = \" + user_id)\normAccessUpdate(update_fields, field_values, table_name, selector, update_status)\nif(update_status, \"error\", \"!=\")\nreturn(\"success\")\nelse()\nreturn(\"failed\")\nend()\n}",
|
||||
"test_inputs": {
|
||||
"user_ids": [
|
||||
"123",
|
||||
"456",
|
||||
"789"
|
||||
]
|
||||
},
|
||||
"test_list": [
|
||||
"re.match(r'\\d+', str(updated_count))",
|
||||
"re.match(r'(200|206|400)', str(_status))",
|
||||
"re.match(r'\\d+\\.\\d+', str(success_rate))"
|
||||
],
|
||||
"_cell": [
|
||||
"gather",
|
||||
"getQueryParamList",
|
||||
"ormAccessUpdate"
|
||||
],
|
||||
"_quality": {
|
||||
"fidelity": 1.0,
|
||||
"bonus_ratio": 0.457,
|
||||
"test_quality": 1.0,
|
||||
"richness": 1.0,
|
||||
"quality": 1.437,
|
||||
"detected": [
|
||||
"AddVariableToJSON",
|
||||
"_status",
|
||||
"addParam",
|
||||
"addResult",
|
||||
"addVar",
|
||||
"else",
|
||||
"end",
|
||||
"endLoop",
|
||||
"function",
|
||||
"gather",
|
||||
"getDateTime",
|
||||
"getListLen",
|
||||
"getQueryParamList",
|
||||
"if_mode1",
|
||||
"itemFromList",
|
||||
"ormAccessUpdate",
|
||||
"return",
|
||||
"startLoop",
|
||||
"variableFromJSON"
|
||||
],
|
||||
"cell": [
|
||||
"gather",
|
||||
"getQueryParamList",
|
||||
"ormAccessUpdate"
|
||||
],
|
||||
"extra": [
|
||||
"AddVariableToJSON",
|
||||
"_status",
|
||||
"addParam",
|
||||
"addResult",
|
||||
"addVar",
|
||||
"else",
|
||||
"end",
|
||||
"endLoop",
|
||||
"function",
|
||||
"getDateTime",
|
||||
"getListLen",
|
||||
"if_mode1",
|
||||
"itemFromList",
|
||||
"return",
|
||||
"startLoop",
|
||||
"variableFromJSON"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"task_id": 3,
|
||||
"text": "Escribe una función AVAP que procese una lista de eventos con timestamps, calcule métricas temporales y envíe un reporte POST a una API externa. La función debe: 1) Recibir una lista de eventos con fechas en formato ISO, 2) Convertir las fechas a timestamps Unix, 3) Calcular la duración total en días, 4) Enviar los resultados via POST a una API de métricas con timeout de 5 segundos, y 5) Retornar el número total de eventos procesados.",
|
||||
"code": "addParam(\"eventos\", lista_eventos)\naddParam(\"api_url\", url_destino)\naddParam(\"formato_fecha\", formato)\ngetListLen(lista_eventos, total_eventos)\nif(total_eventos, 0, \">\")\n addVar(contador, 0)\n addVar(timestamp_minimo, 9999999999)\n addVar(timestamp_maximo, 0)\n startLoop(i, 0, total_eventos)\n itemFromList(lista_eventos, i, evento_actual)\n variableFromJSON(evento_actual, \"fecha\", fecha_str)\n getTimeStamp(fecha_str, formato, 0, timestamp_unix)\n if(timestamp_unix, timestamp_minimo, \"<\")\n addVar(timestamp_minimo, timestamp_unix)\n end()\n if(timestamp_unix, timestamp_maximo, \">\")\n addVar(timestamp_maximo, timestamp_unix)\n end()\n addVar(contador, contador + 1)\n endLoop()\n duracion_segundos = timestamp_maximo - timestamp_minimo\n duracion_dias = duracion_segundos / 86400\n addVar(payload, {})\n AddVariableToJSON(\"total_eventos\", contador, payload)\n AddVariableToJSON(\"duracion_dias\", duracion_dias, payload)\n AddVariableToJSON(\"timestamp_inicio\", timestamp_minimo, payload)\n AddVariableToJSON(\"timestamp_fin\", timestamp_maximo, payload)\n getDateTime(\"%Y-%m-%d %H:%M:%S\", 0, \"UTC\", fecha_reporte)\n AddVariableToJSON(\"fecha_reporte\", fecha_reporte, payload)\n headers = {\"Content-Type\": \"application/json\", \"User-Agent\": \"AVAP-Metrics/1.0\"}\n RequestPost(url_destino, \"\", headers, payload, respuesta_api, 5000)\n if(None, None, `respuesta_api is not None`)\n variableFromJSON(respuesta_api, \"status\", status_respuesta)\n if(status_respuesta, \"success\", \"==\")\n addVar(_status, 200)\n else()\n addVar(_status, 500)\n end()\n else()\n addVar(_status, 503)\n end()\n addResult(contador)\n addResult(duracion_dias)\nelse()\n addVar(_status, 400)\n addVar(mensaje_error, \"Lista de eventos vacia\")\n addResult(mensaje_error)\nend()",
|
||||
"test_inputs": {
|
||||
"eventos": "[{\"fecha\": \"2024-01-15 10:30:00\"}, {\"fecha\": \"2024-01-18 14:45:00\"}]",
|
||||
"api_url": "https://metrics.api.com/report",
|
||||
"formato_fecha": "%Y-%m-%d %H:%M:%S"
|
||||
},
|
||||
"test_list": [
|
||||
"re.match(r'^[0-9]+$', str(contador))",
|
||||
"re.match(r'^[0-9]+(\\.[0-9]+)?$', str(duracion_dias))",
|
||||
"re.match(r'^(200|400|500|503)$', str(_status))"
|
||||
],
|
||||
"_cell": [
|
||||
"RequestPost",
|
||||
"getListLen",
|
||||
"getTimeStamp"
|
||||
],
|
||||
"_quality": {
|
||||
"fidelity": 1.0,
|
||||
"bonus_ratio": 0.371,
|
||||
"test_quality": 1.0,
|
||||
"richness": 1.0,
|
||||
"quality": 1.411,
|
||||
"detected": [
|
||||
"AddVariableToJSON",
|
||||
"RequestPost",
|
||||
"_status",
|
||||
"addParam",
|
||||
"addResult",
|
||||
"addVar",
|
||||
"else",
|
||||
"end",
|
||||
"endLoop",
|
||||
"getDateTime",
|
||||
"getListLen",
|
||||
"getTimeStamp",
|
||||
"if_mode2",
|
||||
"itemFromList",
|
||||
"startLoop",
|
||||
"variableFromJSON"
|
||||
],
|
||||
"cell": [
|
||||
"RequestPost",
|
||||
"getListLen",
|
||||
"getTimeStamp"
|
||||
],
|
||||
"extra": [
|
||||
"AddVariableToJSON",
|
||||
"_status",
|
||||
"addParam",
|
||||
"addResult",
|
||||
"addVar",
|
||||
"else",
|
||||
"end",
|
||||
"endLoop",
|
||||
"getDateTime",
|
||||
"if_mode2",
|
||||
"itemFromList",
|
||||
"startLoop",
|
||||
"variableFromJSON"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"task_id": 4,
|
||||
"text": "Crear un endpoint que genere un reporte de actividad con timestamp actual. El endpoint debe validar un parámetro 'nivel_reporte', usar condiciones if/else para categorizar el reporte, aplicar operaciones matemáticas y devolver un JSON con información temporal detallada.",
|
||||
"code": "registerEndpoint(\"/reporte-actividad\", \"GET\", [], \"application/json\", \"generarReporte\", \"mainHandler\")\nfunction generarReporte() {\n addParam(\"nivel_reporte\", nivel)\n addVar(_status, 200)\n if(nivel, None, \"==\")\n addVar(_status, 400)\n addVar(error_msg, \"Parametro nivel_reporte requerido\")\n addResult(error_msg)\n return()\n else()\n getDateTime(\"%Y-%m-%d %H:%M:%S\", 0, \"UTC\", timestamp_actual)\n addVar(contador_base, 10)\n if(nivel, \"alto\", \"==\")\n addVar(multiplicador, 5)\n addVar(categoria, \"Reporte de Alto Nivel\")\n else()\n if(nivel, \"medio\", \"==\")\n addVar(multiplicador, 3)\n addVar(categoria, \"Reporte de Nivel Medio\")\n else()\n addVar(multiplicador, 1)\n addVar(categoria, \"Reporte Basico\")\n end()\n end()\n actividad_calculada = contador_base * multiplicador\n getTimeStamp(timestamp_actual, \"%Y-%m-%d %H:%M:%S\", 3600, epoch_futuro)\n addVar(resultado_final, {})\n AddVariableToJSON(\"categoria\", categoria, resultado_final)\n AddVariableToJSON(\"timestamp\", timestamp_actual, resultado_final)\n AddVariableToJSON(\"actividad_total\", actividad_calculada, resultado_final)\n AddVariableToJSON(\"epoch_futuro\", epoch_futuro, resultado_final)\n addResult(resultado_final)\n end()\n return()\n}",
|
||||
"test_inputs": {
|
||||
"nivel_reporte": "alto"
|
||||
},
|
||||
"test_list": [
|
||||
"re.match(r'Reporte de Alto Nivel', resultado_final)",
|
||||
"re.match(r'\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}', timestamp_actual)",
|
||||
"re.match(r'50', str(actividad_calculada))"
|
||||
],
|
||||
"_cell": [
|
||||
"addVar",
|
||||
"end",
|
||||
"getDateTime"
|
||||
],
|
||||
"_quality": {
|
||||
"fidelity": 1.0,
|
||||
"bonus_ratio": 0.257,
|
||||
"test_quality": 1.0,
|
||||
"richness": 1.0,
|
||||
"quality": 1.377,
|
||||
"detected": [
|
||||
"AddVariableToJSON",
|
||||
"_status",
|
||||
"addParam",
|
||||
"addResult",
|
||||
"addVar",
|
||||
"else",
|
||||
"end",
|
||||
"function",
|
||||
"getDateTime",
|
||||
"getTimeStamp",
|
||||
"if_mode1",
|
||||
"return"
|
||||
],
|
||||
"cell": [
|
||||
"addVar",
|
||||
"end",
|
||||
"getDateTime"
|
||||
],
|
||||
"extra": [
|
||||
"AddVariableToJSON",
|
||||
"_status",
|
||||
"addParam",
|
||||
"addResult",
|
||||
"else",
|
||||
"function",
|
||||
"getTimeStamp",
|
||||
"if_mode1",
|
||||
"return"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"task_id": 5,
|
||||
"text": "Crear un microservicio que procese múltiples solicitudes de validación de usuarios de forma concurrente. El servicio debe recibir una lista de IDs de usuario, validar cada uno usando una API externa de forma asíncrona, y retornar un reporte consolidado con los resultados. Si alguna validación falla, debe manejarse con bloques de control apropiados.",
|
||||
"code": "registerEndpoint(\"/validate-users\", \"POST\", [], \"application/json\", mainHandler, None)\nfunction mainHandler()\n{\n addParam(\"user_ids\", user_list)\n if(user_list, None, \"==\")\n _status = 400\n addVar(error_msg, \"Lista de usuarios requerida\")\n addResult(error_msg)\n return()\n end()\n \n getListLen(user_list, total_users)\n addVar(validated_users, [])\n addVar(failed_users, [])\n addVar(validation_tasks, [])\n \n startLoop(i, 0, total_users)\n itemFromList(user_list, i, current_user)\n task_id = go validateUser(current_user)\n variableToList(task_id, temp_task)\n if(validation_tasks, [], \"==\")\n addVar(validation_tasks, temp_task)\n else()\n AddVariableToJSON(\"task\", task_id, task_obj)\n variableToList(task_obj, new_task)\n validation_tasks = validation_tasks + new_task\n end()\n endLoop()\n \n getListLen(validation_tasks, total_tasks)\n startLoop(j, 0, total_tasks)\n itemFromList(validation_tasks, j, task)\n result = gather(task, 5000)\n if(result, None, \"!=\")\n variableFromJSON(result, \"status\", status_code)\n variableFromJSON(result, \"user_id\", validated_id)\n if(status_code, \"valid\", \"==\")\n AddVariableToJSON(\"user_id\", validated_id, valid_user)\n AddVariableToJSON(\"timestamp\", \"2024-01-01 00:00:00\", valid_user)\n variableToList(valid_user, temp_valid)\n validated_users = validated_users + temp_valid\n else()\n AddVariableToJSON(\"user_id\", validated_id, failed_user)\n AddVariableToJSON(\"reason\", \"validation_failed\", failed_user)\n variableToList(failed_user, temp_failed)\n failed_users = failed_users + temp_failed\n end()\n else()\n AddVariableToJSON(\"user_id\", \"unknown\", timeout_user)\n AddVariableToJSON(\"reason\", \"timeout\", timeout_user)\n variableToList(timeout_user, temp_timeout)\n failed_users = failed_users + temp_timeout\n end()\n endLoop()\n \n AddVariableToJSON(\"validated\", validated_users, final_result)\n AddVariableToJSON(\"failed\", failed_users, final_result)\n getListLen(validated_users, valid_count)\n getListLen(failed_users, failed_count)\n AddVariableToJSON(\"summary\", {\"valid\": valid_count, \"failed\": failed_count}, final_result)\n \n _status = 200\n addResult(final_result)\n return()\n}\n\nfunction validateUser(user_id)\n{\n try()\n url = \"https://api.validation.com/users/\" + str(user_id)\n headers = {\"Authorization\": \"Bearer token123\"}\n RequestGet(url, {}, headers, api_response, 3000)\n if(api_response, None, \"!=\")\n variableFromJSON(api_response, \"valid\", is_valid)\n if(is_valid, True, \"==\")\n result = {\"status\": \"valid\", \"user_id\": user_id}\n else()\n result = {\"status\": \"invalid\", \"user_id\": user_id}\n end()\n else()\n result = {\"status\": \"api_error\", \"user_id\": user_id}\n end()\n return(result)\n exception(error)\n error_result = {\"status\": \"exception\", \"user_id\": user_id, \"error\": error}\n return(error_result)\n end()\n}",
|
||||
"test_inputs": {
|
||||
"user_ids": [
|
||||
"123",
|
||||
"456",
|
||||
"789"
|
||||
]
|
||||
},
|
||||
"test_list": [
|
||||
"re.match(r'.*validated.*', str(final_result))",
|
||||
"re.match(r'.*failed.*', str(final_result))",
|
||||
"re.match(r'.*summary.*', str(final_result))"
|
||||
],
|
||||
"_cell": [
|
||||
"addResult",
|
||||
"end",
|
||||
"gather"
|
||||
],
|
||||
"_quality": {
|
||||
"fidelity": 1.0,
|
||||
"bonus_ratio": 0.429,
|
||||
"test_quality": 1.0,
|
||||
"richness": 1.0,
|
||||
"quality": 1.429,
|
||||
"detected": [
|
||||
"AddVariableToJSON",
|
||||
"RequestGet",
|
||||
"_status",
|
||||
"addParam",
|
||||
"addResult",
|
||||
"addVar",
|
||||
"else",
|
||||
"end",
|
||||
"endLoop",
|
||||
"function",
|
||||
"gather",
|
||||
"getListLen",
|
||||
"if_mode1",
|
||||
"itemFromList",
|
||||
"return",
|
||||
"startLoop",
|
||||
"try",
|
||||
"variableFromJSON"
|
||||
],
|
||||
"cell": [
|
||||
"addResult",
|
||||
"end",
|
||||
"gather"
|
||||
],
|
||||
"extra": [
|
||||
"AddVariableToJSON",
|
||||
"RequestGet",
|
||||
"_status",
|
||||
"addParam",
|
||||
"addVar",
|
||||
"else",
|
||||
"endLoop",
|
||||
"function",
|
||||
"getListLen",
|
||||
"if_mode1",
|
||||
"itemFromList",
|
||||
"return",
|
||||
"startLoop",
|
||||
"try",
|
||||
"variableFromJSON"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"task_id": 6,
|
||||
"text": "Crear un endpoint que procese un token JWT simulado (JSON), extraiga su timestamp de expiración, lo convierta a fecha legible, y genere un hash MD5 de la información del usuario para logging de seguridad.",
|
||||
"code": "registerEndpoint(\"/api/auth/validate\", \"POST\", [], \"\", mainHandler, None)\n\nfunction mainHandler()\n{\n addParam(\"token_data\", raw_token)\n addParam(\"user_context\", context_info)\n \n if(raw_token, None, \"==\")\n _status = 400\n addVar(error_msg, \"Token data required\")\n addResult(error_msg)\n return()\n end()\n \n variableFromJSON(raw_token, \"exp\", token_expiry)\n variableFromJSON(raw_token, \"user_id\", user_id)\n variableFromJSON(raw_token, \"email\", user_email)\n \n if(token_expiry, None, \"==\")\n _status = 422\n addVar(error_msg, \"Invalid token format - missing expiry\")\n addResult(error_msg)\n return()\n end()\n \n stampToDatetime(token_expiry, \"%Y-%m-%d %H:%M:%S\", 0, readable_expiry)\n \n addVar(user_info_raw, \"\")\n replace(user_email, \"@\", \"_at_\", sanitized_email)\n addVar(user_info_raw, user_id)\n addVar(temp_concat, user_info_raw)\n replace(temp_concat, \"\", sanitized_email, user_info_combined)\n \n encodeMD5(user_info_combined, security_hash)\n \n getDateTime(\"%Y-%m-%d %H:%M:%S\", 0, \"UTC\", current_time)\n \n if(None, None, `token_expiry < 1735689600`)\n _status = 401\n addVar(validation_result, \"expired\")\n else()\n _status = 200\n addVar(validation_result, \"valid\")\n end()\n \n addVar(log_entry, \"\")\n AddVariableToJSON(\"timestamp\", current_time, log_entry)\n AddVariableToJSON(\"user_hash\", security_hash, log_entry)\n AddVariableToJSON(\"expiry_readable\", readable_expiry, log_entry)\n AddVariableToJSON(\"status\", validation_result, log_entry)\n AddVariableToJSON(\"context\", context_info, log_entry)\n \n addResult(log_entry)\n addResult(validation_result)\n addResult(readable_expiry)\n return()\n}",
|
||||
"test_inputs": {
|
||||
"token_data": "{\"exp\": 1735689600, \"user_id\": \"usr_12345\", \"email\": \"test@example.com\"}",
|
||||
"user_context": "mobile_app"
|
||||
},
|
||||
"test_list": [
|
||||
"re.match(r'\\{.*\"timestamp\".*\"user_hash\".*\"expiry_readable\".*\\}', log_entry)",
|
||||
"re.match(r'[a-f0-9]{32}', security_hash)",
|
||||
"re.match(r'\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}', readable_expiry)"
|
||||
],
|
||||
"_cell": [
|
||||
"encodeMD5",
|
||||
"stampToDatetime",
|
||||
"variableFromJSON"
|
||||
],
|
||||
"_quality": {
|
||||
"fidelity": 1.0,
|
||||
"bonus_ratio": 0.343,
|
||||
"test_quality": 1.0,
|
||||
"richness": 1.0,
|
||||
"quality": 1.403,
|
||||
"detected": [
|
||||
"AddVariableToJSON",
|
||||
"_status",
|
||||
"addParam",
|
||||
"addResult",
|
||||
"addVar",
|
||||
"else",
|
||||
"encodeMD5",
|
||||
"end",
|
||||
"function",
|
||||
"getDateTime",
|
||||
"if_mode2",
|
||||
"replace",
|
||||
"return",
|
||||
"stampToDatetime",
|
||||
"variableFromJSON"
|
||||
],
|
||||
"cell": [
|
||||
"encodeMD5",
|
||||
"stampToDatetime",
|
||||
"variableFromJSON"
|
||||
],
|
||||
"extra": [
|
||||
"AddVariableToJSON",
|
||||
"_status",
|
||||
"addParam",
|
||||
"addResult",
|
||||
"addVar",
|
||||
"else",
|
||||
"end",
|
||||
"function",
|
||||
"getDateTime",
|
||||
"if_mode2",
|
||||
"replace",
|
||||
"return"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"task_id": 7,
|
||||
"text": "Crear un endpoint que actualice el estado de un pedido y devuelva el resultado con código HTTP personalizado. El endpoint debe: 1) Capturar el ID del pedido y nuevo estado desde parámetros, 2) Validar que el estado sea válido ('pendiente', 'procesando', 'completado'), 3) Actualizar el registro en la base de datos usando ORM, 4) Establecer código de respuesta HTTP según el resultado, 5) Devolver el pedido actualizado o mensaje de error.",
|
||||
"code": "addParam(\"pedido_id\", pedido_id)\naddParam(\"nuevo_estado\", nuevo_estado)\nif(pedido_id, None, \"==\")\n_status = 400\naddVar(mensaje, \"ID de pedido requerido\")\naddResult(mensaje)\nelse()\nif(nuevo_estado, None, \"==\")\n_status = 400\naddVar(mensaje, \"Estado requerido\")\naddResult(mensaje)\nelse()\nvariableToList(nuevo_estado, estados_validos)\naddVar(temp_estado, \"pendiente\")\nAddVariableToJSON(\"0\", temp_estado, estados_json)\naddVar(temp_estado, \"procesando\")\nAddVariableToJSON(\"1\", temp_estado, estados_json)\naddVar(temp_estado, \"completado\")\nAddVariableToJSON(\"2\", temp_estado, estados_json)\nif(None, None, `nuevo_estado not in ['pendiente', 'procesando', 'completado']`)\n_status = 422\naddVar(mensaje, \"Estado no válido\")\naddResult(mensaje)\nelse()\ngetDateTime(\"%Y-%m-%d %H:%M:%S\", 0, \"UTC\", fecha_actualizacion)\nvariableToList(\"estado\", campos_update)\nvariableToList(nuevo_estado, valores_update)\nAddVariableToJSON(\"fecha_actualizacion\", fecha_actualizacion, valores_json)\naddVar(selector_where, \"id = \" + pedido_id)\normAccessUpdate(campos_update, valores_update, \"pedidos\", selector_where, resultado_update)\nif(resultado_update, None, \"==\")\n_status = 404\naddVar(mensaje, \"Pedido no encontrado\")\naddResult(mensaje)\nelse()\n_status = 200\normAccessSelect(\"*\", \"pedidos\", selector_where, pedido_actualizado)\naddResult(pedido_actualizado)\nend()\nend()\nend()\nend()",
|
||||
"test_inputs": {
|
||||
"pedido_id": "123",
|
||||
"nuevo_estado": "procesando"
|
||||
},
|
||||
"test_list": [
|
||||
"re.match(r'procesando', nuevo_estado)",
|
||||
"re.match(r'200', str(_status))",
|
||||
"re.match(r'pedido_actualizado', 'pedido_actualizado')"
|
||||
],
|
||||
"_cell": [
|
||||
"_status",
|
||||
"addResult",
|
||||
"ormAccessUpdate"
|
||||
],
|
||||
"_quality": {
|
||||
"fidelity": 1.0,
|
||||
"bonus_ratio": 0.229,
|
||||
"test_quality": 1.0,
|
||||
"richness": 1.0,
|
||||
"quality": 1.369,
|
||||
"detected": [
|
||||
"AddVariableToJSON",
|
||||
"_status",
|
||||
"addParam",
|
||||
"addResult",
|
||||
"addVar",
|
||||
"else",
|
||||
"end",
|
||||
"getDateTime",
|
||||
"if_mode2",
|
||||
"ormAccessSelect",
|
||||
"ormAccessUpdate"
|
||||
],
|
||||
"cell": [
|
||||
"_status",
|
||||
"addResult",
|
||||
"ormAccessUpdate"
|
||||
],
|
||||
"extra": [
|
||||
"AddVariableToJSON",
|
||||
"addParam",
|
||||
"addVar",
|
||||
"else",
|
||||
"end",
|
||||
"getDateTime",
|
||||
"if_mode2",
|
||||
"ormAccessSelect"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"task_id": 8,
|
||||
"text": "Crear un endpoint que genere un reporte de logs de eventos del sistema con timestamps, donde cada evento contenga la fecha actual más un offset incremental de días. El sistema debe iterar por una lista de tipos de eventos y crear un JSON con timestamps formateados para cada uno.",
|
||||
"code": "registerEndpoint(\"/api/system/logs\", \"GET\", [], \"application/json\", generateLogReport, mainHandler)\n\nfunction generateLogReport()\n{\n addParam(\"days_back\", days_param)\n if(days_param, None, \"==\")\n addVar(days_back, 7)\n else()\n days_back = int(days_param)\n end()\n \n event_types = [\"login\", \"logout\", \"error\", \"warning\", \"info\"]\n getListLen(event_types, total_events)\n \n log_entries = {}\n counter = 0\n \n startLoop(i, 0, total_events)\n itemFromList(event_types, i, current_event)\n \n time_offset = counter * 86400\n getDateTime(\"%Y-%m-%d %H:%M:%S\", time_offset, \"UTC\", event_timestamp)\n \n entry_key = current_event + \"_\" + str(counter)\n AddVariableToJSON(\"event_type\", current_event, temp_entry)\n AddVariableToJSON(\"timestamp\", event_timestamp, temp_entry)\n AddVariableToJSON(\"severity\", getSeverityLevel(current_event), temp_entry)\n \n AddVariableToJSON(entry_key, temp_entry, log_entries)\n counter = counter + 1\n endLoop()\n \n AddVariableToJSON(\"total_entries\", total_events, log_entries)\n AddVariableToJSON(\"generated_at\", getCurrentTimestamp(), log_entries)\n \n _status = 200\n addResult(log_entries)\n return(log_entries)\n}\n\nfunction getSeverityLevel(event_type)\n{\n if(event_type, \"error\", \"==\")\n return(\"HIGH\")\n else()\n if(event_type, \"warning\", \"==\")\n return(\"MEDIUM\")\n else()\n return(\"LOW\")\n end()\n end()\n}\n\nfunction getCurrentTimestamp()\n{\n getDateTime(\"%Y-%m-%d %H:%M:%S\", 0, \"UTC\", current_time)\n return(current_time)\n}",
|
||||
"test_inputs": {
|
||||
"days_back": "5"
|
||||
},
|
||||
"test_list": [
|
||||
"re.match(r'\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}', log_entries)",
|
||||
"re.match(r'login_\\d+', str(log_entries))",
|
||||
"re.match(r'\"total_entries\":\\s*5', str(log_entries))"
|
||||
],
|
||||
"_cell": [
|
||||
"getDateTime",
|
||||
"return",
|
||||
"startLoop"
|
||||
],
|
||||
"_quality": {
|
||||
"fidelity": 1.0,
|
||||
"bonus_ratio": 0.343,
|
||||
"test_quality": 1.0,
|
||||
"richness": 1.0,
|
||||
"quality": 1.403,
|
||||
"detected": [
|
||||
"AddVariableToJSON",
|
||||
"_status",
|
||||
"addParam",
|
||||
"addResult",
|
||||
"addVar",
|
||||
"else",
|
||||
"end",
|
||||
"endLoop",
|
||||
"function",
|
||||
"getDateTime",
|
||||
"getListLen",
|
||||
"if_mode1",
|
||||
"itemFromList",
|
||||
"return",
|
||||
"startLoop"
|
||||
],
|
||||
"cell": [
|
||||
"getDateTime",
|
||||
"return",
|
||||
"startLoop"
|
||||
],
|
||||
"extra": [
|
||||
"AddVariableToJSON",
|
||||
"_status",
|
||||
"addParam",
|
||||
"addResult",
|
||||
"addVar",
|
||||
"else",
|
||||
"end",
|
||||
"endLoop",
|
||||
"function",
|
||||
"getListLen",
|
||||
"if_mode1",
|
||||
"itemFromList"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"task_id": 9,
|
||||
"text": "Crear un microservicio que valide un email de entrada, sanitice caracteres especiales del dominio, y retorne información de validación con diferentes códigos de respuesta según el resultado.",
|
||||
"code": "addParam(\"email\", userEmail)\naddParam(\"domain_filter\", filterPattern)\naddResult(validationResult)\nvalidationResult = {}\nif(userEmail, None, \"!=\")\n getRegex(userEmail, \"^[\\\\w\\\\.-]+@[\\\\w\\\\.-]+\\\\.[a-zA-Z]{2,}$\", emailMatch)\n if(emailMatch, None, \"!=\")\n variableFromJSON({\"email\": userEmail}, \"email\", extractedEmail)\n getRegex(extractedEmail, \"@(.+)$\", domainPart)\n if(domainPart, None, \"!=\")\n if(filterPattern, None, \"==\")\n filterPattern = \"[^a-zA-Z0-9.-]\"\n else()\n noop = 1\n end()\n replace(domainPart, filterPattern, \"\", sanitizedDomain)\n AddVariableToJSON(\"original_domain\", domainPart, validationResult)\n AddVariableToJSON(\"sanitized_domain\", sanitizedDomain, validationResult)\n AddVariableToJSON(\"is_valid\", \"true\", validationResult)\n AddVariableToJSON(\"status\", \"success\", validationResult)\n _status = 200\n else()\n AddVariableToJSON(\"error\", \"invalid_domain_format\", validationResult)\n AddVariableToJSON(\"is_valid\", \"false\", validationResult)\n AddVariableToJSON(\"status\", \"error\", validationResult)\n _status = 400\n end()\n else()\n AddVariableToJSON(\"error\", \"invalid_email_format\", validationResult)\n AddVariableToJSON(\"is_valid\", \"false\", validationResult)\n AddVariableToJSON(\"status\", \"error\", validationResult)\n _status = 400\n end()\nelse()\n AddVariableToJSON(\"error\", \"email_parameter_missing\", validationResult)\n AddVariableToJSON(\"is_valid\", \"false\", validationResult)\n AddVariableToJSON(\"status\", \"error\", validationResult)\n _status = 422\nend()",
|
||||
"test_inputs": {
|
||||
"email": "test.user@example-site.com",
|
||||
"domain_filter": "[^a-zA-Z0-9.-]"
|
||||
},
|
||||
"test_list": [
|
||||
"re.match(r'\\{.*\"original_domain\".*\\}', validationResult)",
|
||||
"re.match(r'\\{.*\"sanitized_domain\".*\\}', validationResult)",
|
||||
"re.match(r'\\{.*\"is_valid\".*\"true\".*\\}', validationResult)"
|
||||
],
|
||||
"_cell": [
|
||||
"addResult",
|
||||
"else",
|
||||
"replace"
|
||||
],
|
||||
"_quality": {
|
||||
"fidelity": 1.0,
|
||||
"bonus_ratio": 0.171,
|
||||
"test_quality": 1.0,
|
||||
"richness": 1.0,
|
||||
"quality": 1.351,
|
||||
"detected": [
|
||||
"AddVariableToJSON",
|
||||
"_status",
|
||||
"addParam",
|
||||
"addResult",
|
||||
"else",
|
||||
"end",
|
||||
"if_mode1",
|
||||
"replace",
|
||||
"variableFromJSON"
|
||||
],
|
||||
"cell": [
|
||||
"addResult",
|
||||
"else",
|
||||
"replace"
|
||||
],
|
||||
"extra": [
|
||||
"AddVariableToJSON",
|
||||
"_status",
|
||||
"addParam",
|
||||
"end",
|
||||
"if_mode1",
|
||||
"variableFromJSON"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"task_id": 10,
|
||||
"text": "Desarrolla un microservicio AVAP que consulte una API externa para obtener datos meteorológicos de múltiples ciudades, valide y procese las respuestas, luego almacene los resultados válidos en una base de datos. El servicio debe manejar errores de red, filtrar datos por temperatura mínima, y devolver estadísticas de las ciudades procesadas.",
|
||||
"code": "addParam(\"cities\", cities_param)\naddParam(\"min_temp\", min_temp_param)\naddParam(\"api_key\", api_key_param)\n\nif(cities_param, None, \"==\")\n addVar(_status, 400)\n addResult(\"error: cities parameter is required\")\n return()\nend()\n\nif(api_key_param, None, \"==\")\n addVar(_status, 401)\n addResult(\"error: api_key is required\")\n return()\nend()\n\nif(min_temp_param, None, \"==\")\n addVar(min_temp_param, 0)\nend()\n\nvariableToList(cities_param, cities_list)\ngetListLen(cities_list, total_cities)\n\nif(total_cities, 0, \"==\")\n addVar(_status, 400)\n addResult(\"error: no cities provided\")\n return()\nend()\n\ndb_connector = avapConnector(\"db-uuid-12345\")\normCheckTable(\"weather_data\", table_exists)\n\nif(table_exists, False, \"==\")\n fields = [\"city\", \"temperature\", \"humidity\", \"timestamp\"]\n types = [\"TEXT\", \"REAL\", \"REAL\", \"INTEGER\"]\n ormCreateTable(fields, types, \"weather_data\", create_result)\nend()\n\nvariableToList(\"\", processed_cities)\nvariableToList(\"\", valid_temperatures)\naddVar(total_processed, 0)\naddVar(total_valid, 0)\n\nstartLoop(i, 0, total_cities)\n itemFromList(cities_list, i, current_city)\n \n api_url = \"https://api.weather.com/v1/current?city=\" + current_city + \"&key=\" + api_key_param\n headers = {\"Accept\": \"application/json\"}\n \n try()\n RequestGet(api_url, \"\", headers, weather_response, 5000)\n \n if(weather_response, None, \"!=\")\n variableFromJSON(weather_response, \"temperature\", temp_value)\n variableFromJSON(weather_response, \"humidity\", humidity_value)\n \n if(temp_value, None, \"!=\")\n if(temp_value, min_temp_param, \">=\")\n getDateTime(\"%Y-%m-%d %H:%M:%S\", 0, \"UTC\", current_time)\n getTimeStamp(current_time, \"%Y-%m-%d %H:%M:%S\", 0, timestamp)\n \n insert_data = {\n \"city\": current_city,\n \"temperature\": temp_value,\n \"humidity\": humidity_value,\n \"timestamp\": timestamp\n }\n \n ormAccessInsert(insert_data, \"weather_data\", insert_result)\n \n variableToList(current_city, temp_city)\n processed_cities = processed_cities + temp_city\n \n variableToList(temp_value, temp_temp)\n valid_temperatures = valid_temperatures + temp_temp\n \n addVar(total_valid, total_valid + 1)\n end()\n addVar(total_processed, total_processed + 1)\n end()\n end()\n exception(api_error)\n addVar(error_msg, \"API error for city: \" + current_city)\n end()\nendLoop()\n\ngetListLen(processed_cities, cities_count)\ngetListLen(valid_temperatures, temps_count)\n\nif(temps_count, 0, \">\")\n addVar(sum_temp, 0)\n startLoop(j, 0, temps_count)\n itemFromList(valid_temperatures, j, temp_item)\n addVar(sum_temp, sum_temp + temp_item)\n endLoop()\n addVar(avg_temp, sum_temp / temps_count)\nelse()\n addVar(avg_temp, 0)\nend()\n\normAccessSelect(\"*\", \"weather_data\", \"temperature >= \" + str(min_temp_param), recent_data)\ngetListLen(recent_data, db_count)\n\nresponse_data = {\n \"cities_requested\": total_cities,\n \"cities_processed\": total_processed,\n \"cities_valid\": total_valid,\n \"average_temperature\": avg_temp,\n \"database_records\": db_count,\n \"processed_cities\": processed_cities\n}\n\naddResult(response_data)\naddVar(_status, 200)",
|
||||
"test_inputs": {
|
||||
"cities": "London,Paris,Madrid",
|
||||
"min_temp": "10",
|
||||
"api_key": "test-api-key-123"
|
||||
},
|
||||
"test_list": [
|
||||
"re.match(r'.*RequestGet.*weather.*', code)",
|
||||
"re.match(r'.*getListLen.*cities_list.*', code)",
|
||||
"re.match(r'.*ormAccessSelect.*weather_data.*', code)"
|
||||
],
|
||||
"_cell": [
|
||||
"RequestGet",
|
||||
"getListLen",
|
||||
"ormAccessSelect"
|
||||
],
|
||||
"_quality": {
|
||||
"fidelity": 1.0,
|
||||
"bonus_ratio": 0.514,
|
||||
"test_quality": 1.0,
|
||||
"richness": 1.0,
|
||||
"quality": 1.454,
|
||||
"detected": [
|
||||
"RequestGet",
|
||||
"_status",
|
||||
"addParam",
|
||||
"addResult",
|
||||
"addVar",
|
||||
"avapConnector",
|
||||
"else",
|
||||
"end",
|
||||
"endLoop",
|
||||
"getDateTime",
|
||||
"getListLen",
|
||||
"getTimeStamp",
|
||||
"if_mode1",
|
||||
"itemFromList",
|
||||
"ormAccessInsert",
|
||||
"ormAccessSelect",
|
||||
"ormCheckTable",
|
||||
"return",
|
||||
"startLoop",
|
||||
"try",
|
||||
"variableFromJSON"
|
||||
],
|
||||
"cell": [
|
||||
"RequestGet",
|
||||
"getListLen",
|
||||
"ormAccessSelect"
|
||||
],
|
||||
"extra": [
|
||||
"_status",
|
||||
"addParam",
|
||||
"addResult",
|
||||
"addVar",
|
||||
"avapConnector",
|
||||
"else",
|
||||
"end",
|
||||
"endLoop",
|
||||
"getDateTime",
|
||||
"getTimeStamp",
|
||||
"if_mode1",
|
||||
"itemFromList",
|
||||
"ormAccessInsert",
|
||||
"ormCheckTable",
|
||||
"return",
|
||||
"startLoop",
|
||||
"try",
|
||||
"variableFromJSON"
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
{
|
||||
"total_cells": 9139,
|
||||
"filled_cells": 10,
|
||||
"fill_rate": 0.0011,
|
||||
"distribution_entropy": 4.28,
|
||||
"node_type_frequency": {
|
||||
"startLoop": 2,
|
||||
"avapConnector": 1,
|
||||
"getQueryParamList": 1,
|
||||
"gather": 2,
|
||||
"ormAccessUpdate": 2,
|
||||
"getListLen": 2,
|
||||
"RequestPost": 1,
|
||||
"getTimeStamp": 1,
|
||||
"getDateTime": 2,
|
||||
"end": 2,
|
||||
"addVar": 1,
|
||||
"addResult": 3,
|
||||
"encodeMD5": 1,
|
||||
"variableFromJSON": 1,
|
||||
"stampToDatetime": 1,
|
||||
"_status": 1,
|
||||
"return": 1,
|
||||
"else": 1,
|
||||
"replace": 1,
|
||||
"RequestGet": 1,
|
||||
"ormAccessSelect": 1
|
||||
},
|
||||
"low_quality_cells": 0,
|
||||
"empty_cells": 9129
|
||||
}
|
||||
|
|
@ -1,601 +0,0 @@
|
|||
[
|
||||
{
|
||||
"task_id": 1,
|
||||
"text": "Crear un servicio de API que genere múltiples tokens de sesión aleatorios para diferentes tipos de usuarios utilizando patrones específicos y almacene los resultados en una base de datos. El servicio debe procesar una lista de tipos de usuario y generar tokens únicos para cada tipo usando iteraciones controladas.",
|
||||
"code": "import \"crypto_utils\"\naddParam(\"user_types\", user_types_param)\naddParam(\"token_length\", token_length_param)\ndb = avapConnector(\"db_token_12345\")\nif(user_types_param, None, \"==\")\n addVar(_status, 400)\n addResult(error_msg)\nelse()\n variableToList(user_types_param, user_types_list)\n getListLen(user_types_list, list_length)\n addVar(counter, 0)\n startLoop(i, 0, list_length)\n itemFromList(user_types_list, i, current_user_type)\n if(current_user_type, \"admin\", \"==\")\n randomString(\"[A-Z0-9]\", 16, admin_token)\n addVar(final_token, admin_token)\n else()\n randomString(\"[a-z0-9]\", 12, regular_token)\n addVar(final_token, regular_token)\n end()\n ormAccessInsert({\"user_type\": current_user_type, \"token\": final_token, \"created_at\": \"2024-01-01\"}, \"user_tokens\", insert_result)\n addVar(counter, counter + 1)\n endLoop()\n ormAccessSelect(\"*\", \"user_tokens\", \"\", all_tokens)\n addResult(all_tokens)\n addResult(counter)\n addVar(_status, 201)\nend()",
|
||||
"test_inputs": {
|
||||
"user_types": [
|
||||
"admin",
|
||||
"user",
|
||||
"guest"
|
||||
],
|
||||
"token_length": "12"
|
||||
},
|
||||
"test_list": [
|
||||
"re.match(r'\\[.*\\]', str(all_tokens))",
|
||||
"re.match(r'^[0-9]+$', str(counter))",
|
||||
"re.match(r'^20[0-9]$', str(_status))"
|
||||
],
|
||||
"_cell": [
|
||||
"import",
|
||||
"randomString",
|
||||
"startLoop"
|
||||
],
|
||||
"_prior_weight": 0.4182,
|
||||
"_quality": {
|
||||
"fidelity": 1.0,
|
||||
"bonus_ratio": 0.371,
|
||||
"test_quality": 1.0,
|
||||
"richness": 0.933,
|
||||
"quality": 1.405,
|
||||
"detected": [
|
||||
"_status",
|
||||
"addParam",
|
||||
"addResult",
|
||||
"addVar",
|
||||
"avapConnector",
|
||||
"else",
|
||||
"end",
|
||||
"endLoop",
|
||||
"getListLen",
|
||||
"if_mode1",
|
||||
"import",
|
||||
"itemFromList",
|
||||
"ormAccessInsert",
|
||||
"ormAccessSelect",
|
||||
"randomString",
|
||||
"startLoop"
|
||||
],
|
||||
"cell": [
|
||||
"import",
|
||||
"randomString",
|
||||
"startLoop"
|
||||
],
|
||||
"extra": [
|
||||
"_status",
|
||||
"addParam",
|
||||
"addResult",
|
||||
"addVar",
|
||||
"avapConnector",
|
||||
"else",
|
||||
"end",
|
||||
"endLoop",
|
||||
"getListLen",
|
||||
"if_mode1",
|
||||
"itemFromList",
|
||||
"ormAccessInsert",
|
||||
"ormAccessSelect"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"task_id": 2,
|
||||
"text": "Crear un microservicio que consulte información de un usuario desde una API externa usando GET, valide la respuesta y maneje diferentes códigos de estado HTTP según el resultado obtenido.",
|
||||
"code": "addParam(\"user_id\", user_id)\nif(user_id, None, \"==\")\n_status = 400\naddVar(response_error, \"Missing user_id parameter\")\naddResult(response_error)\nelse()\napi_url = \"https://jsonplaceholder.typicode.com/users/\"\napi_url = api_url + str(user_id)\nheaders = {\"Content-Type\": \"application/json\"}\nRequestGet(api_url, \"\", headers, api_response, 5000)\nif(api_response, None, \"==\")\n_status = 503\naddVar(service_error, \"External API unavailable\")\naddResult(service_error)\nelse()\nvariableFromJSON(api_response, \"id\", user_found_id)\nif(user_found_id, None, \"==\")\n_status = 404\naddVar(not_found_msg, \"User not found in external service\")\naddResult(not_found_msg)\nelse()\nvariableFromJSON(api_response, \"name\", user_name)\nvariableFromJSON(api_response, \"email\", user_email)\nvariableFromJSON(api_response, \"phone\", user_phone)\nif(None, None, `len(user_name) > 0 and \"@\" in user_email`)\n_status = 200\naddVar(success_msg, \"User data retrieved successfully\")\naddResult(success_msg)\naddResult(user_name)\naddResult(user_email)\naddResult(user_phone)\nelse()\n_status = 422\naddVar(invalid_data, \"Invalid user data from external API\")\naddResult(invalid_data)\nend()\nend()\nend()\nend()",
|
||||
"test_inputs": {
|
||||
"user_id": "1"
|
||||
},
|
||||
"test_list": [
|
||||
"re.match(r'^User data retrieved successfully$', success_msg)",
|
||||
"re.match(r'^[A-Za-z\\s]+$', user_name)",
|
||||
"re.match(r'^[\\w\\._%+-]+@[\\w\\.-]+\\.[A-Za-z]{2,}$', user_email)"
|
||||
],
|
||||
"_cell": [
|
||||
"RequestGet",
|
||||
"_status"
|
||||
],
|
||||
"_prior_weight": 0.1313,
|
||||
"_quality": {
|
||||
"fidelity": 1.0,
|
||||
"bonus_ratio": 0.194,
|
||||
"test_quality": 1.0,
|
||||
"richness": 1.0,
|
||||
"quality": 1.358,
|
||||
"detected": [
|
||||
"RequestGet",
|
||||
"_status",
|
||||
"addParam",
|
||||
"addResult",
|
||||
"addVar",
|
||||
"else",
|
||||
"end",
|
||||
"if_mode2",
|
||||
"variableFromJSON"
|
||||
],
|
||||
"cell": [
|
||||
"RequestGet",
|
||||
"_status"
|
||||
],
|
||||
"extra": [
|
||||
"addParam",
|
||||
"addResult",
|
||||
"addVar",
|
||||
"else",
|
||||
"end",
|
||||
"if_mode2",
|
||||
"variableFromJSON"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"task_id": 3,
|
||||
"text": "Crear un endpoint que actualice el estado de múltiples tareas en una base de datos. El endpoint recibe una lista de IDs de tareas como parámetro de consulta, actualiza cada tarea al estado 'completada' y retorna el número de tareas actualizadas exitosamente.",
|
||||
"code": "addParam(\"task_ids\", task_list)\nif(task_list, None, \"!=\")\n getListLen(task_list, total_tasks)\n addVar(updated_count, 0)\n addVar(counter, 0)\n startLoop(i, 0, total_tasks)\n itemFromList(task_list, i, current_task_id)\n addVar(fields, [\"status\"])\n addVar(values, [\"completed\"])\n addVar(selector, \"id = %s\" % current_task_id)\n ormAccessUpdate(fields, values, \"tasks\", selector, update_result)\n if(update_result, None, \"is not None\")\n addVar(updated_count, updated_count + 1)\n end()\n addVar(counter, counter + 1)\n endLoop()\n addResult(updated_count)\n addVar(_status, 200)\nelse()\n addVar(error_msg, \"No task IDs provided\")\n addResult(error_msg)\n addVar(_status, 400)\nend()",
|
||||
"test_inputs": {
|
||||
"task_ids": [
|
||||
"101",
|
||||
"102",
|
||||
"103"
|
||||
]
|
||||
},
|
||||
"test_list": [
|
||||
"re.match(r'\\d+', str(updated_count))",
|
||||
"re.match(r'2\\d\\d', str(_status))",
|
||||
"re.match(r'completed', 'completed')"
|
||||
],
|
||||
"_cell": [
|
||||
"addVar",
|
||||
"itemFromList",
|
||||
"ormAccessUpdate"
|
||||
],
|
||||
"_prior_weight": 0.5394,
|
||||
"_quality": {
|
||||
"fidelity": 1.0,
|
||||
"bonus_ratio": 0.257,
|
||||
"test_quality": 1.0,
|
||||
"richness": 0.767,
|
||||
"quality": 1.354,
|
||||
"detected": [
|
||||
"_status",
|
||||
"addParam",
|
||||
"addResult",
|
||||
"addVar",
|
||||
"else",
|
||||
"end",
|
||||
"endLoop",
|
||||
"getListLen",
|
||||
"if_mode1",
|
||||
"itemFromList",
|
||||
"ormAccessUpdate",
|
||||
"startLoop"
|
||||
],
|
||||
"cell": [
|
||||
"addVar",
|
||||
"itemFromList",
|
||||
"ormAccessUpdate"
|
||||
],
|
||||
"extra": [
|
||||
"_status",
|
||||
"addParam",
|
||||
"addResult",
|
||||
"else",
|
||||
"end",
|
||||
"endLoop",
|
||||
"getListLen",
|
||||
"if_mode1",
|
||||
"startLoop"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"task_id": 4,
|
||||
"text": "Desarrolla un endpoint de API que reciba un parámetro 'user_id', consulte la base de datos para obtener los datos del usuario en formato JSON, extraiga el campo 'email' del JSON resultante y devuelva el email junto con el status code apropiado. Si no encuentra el usuario, debe devolver un error 404.",
|
||||
"code": "addParam(\"user_id\", userId)\nif(userId, None, \"==\")\n addVar(_status, 400)\n addResult(_status)\nelse()\n ormAccessSelect(\"*\", \"users\", \"id = \" + str(userId), userResult)\n getListLen(userResult, resultCount)\n if(resultCount, 0, \"==\")\n addVar(_status, 404)\n addResult(_status)\n else()\n itemFromList(userResult, 0, firstUser)\n variableFromJSON(firstUser, \"email\", userEmail)\n variableFromJSON(firstUser, \"name\", userName)\n addVar(_status, 200)\n addResult(userEmail)\n addResult(userName)\n addResult(_status)\n end()\nend()",
|
||||
"test_inputs": {
|
||||
"user_id": "123"
|
||||
},
|
||||
"test_list": [
|
||||
"re.match(r'^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$', userEmail)",
|
||||
"re.match(r'^[A-Za-z\\s]+$', userName)",
|
||||
"re.match(r'^200$', str(_status))"
|
||||
],
|
||||
"_cell": [
|
||||
"addParam",
|
||||
"ormAccessSelect",
|
||||
"variableFromJSON"
|
||||
],
|
||||
"_prior_weight": 0.2485,
|
||||
"_quality": {
|
||||
"fidelity": 1.0,
|
||||
"bonus_ratio": 0.229,
|
||||
"test_quality": 1.0,
|
||||
"richness": 0.667,
|
||||
"quality": 1.335,
|
||||
"detected": [
|
||||
"_status",
|
||||
"addParam",
|
||||
"addResult",
|
||||
"addVar",
|
||||
"else",
|
||||
"end",
|
||||
"getListLen",
|
||||
"if_mode1",
|
||||
"itemFromList",
|
||||
"ormAccessSelect",
|
||||
"variableFromJSON"
|
||||
],
|
||||
"cell": [
|
||||
"addParam",
|
||||
"ormAccessSelect",
|
||||
"variableFromJSON"
|
||||
],
|
||||
"extra": [
|
||||
"_status",
|
||||
"addResult",
|
||||
"addVar",
|
||||
"else",
|
||||
"end",
|
||||
"getListLen",
|
||||
"if_mode1",
|
||||
"itemFromList"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"task_id": 5,
|
||||
"text": "Crear un microservicio que consulte productos en una base de datos, verifique el stock disponible y aplique descuentos basados en la cantidad. El servicio debe manejar casos donde no se encuentren productos y recorrer los resultados para calcular el precio total.",
|
||||
"code": "addParam(\"user_id\", user_id)\naddParam(\"categoria\", categoria)\naddParam(\"descuento_minimo\", descuento_min)\nif(user_id, None, \"!=\")\n ormAccessSelect(\"*\", \"productos\", \"categoria = '\" + categoria + \"'\", productos_lista)\n getListLen(productos_lista, total_productos)\n if(total_productos, 0, \">\")\n precio_total = 0\n descuento_aplicado = 0\n startLoop(i, 0, total_productos)\n itemFromList(productos_lista, i, producto_actual)\n variableFromJSON(producto_actual, \"precio\", precio_item)\n variableFromJSON(producto_actual, \"stock\", stock_item)\n variableFromJSON(producto_actual, \"nombre\", nombre_item)\n if(stock_item, 0, \">\")\n precio_total = precio_total + precio_item\n if(precio_item, descuento_min, \">=\")\n descuento_aplicado = descuento_aplicado + (precio_item * 0.1)\n else()\n addResult(nombre_item)\n end()\n else()\n addVar(mensaje_error, \"Producto sin stock: \" + nombre_item)\n addResult(mensaje_error)\n end()\n endLoop()\n precio_final = precio_total - descuento_aplicado\n addResult(precio_final)\n addVar(_status, 200)\n else()\n addVar(mensaje, \"No se encontraron productos en la categoria\")\n addResult(mensaje)\n addVar(_status, 404)\n end()\nelse()\n addVar(error_msg, \"ID de usuario requerido\")\n addResult(error_msg)\n addVar(_status, 400)\nend()",
|
||||
"test_inputs": {
|
||||
"user_id": "123",
|
||||
"categoria": "electronicos",
|
||||
"descuento_minimo": "100"
|
||||
},
|
||||
"test_list": [
|
||||
"re.match(r'\\d+', precio_final)",
|
||||
"re.match(r'[A-Za-z]+', mensaje)",
|
||||
"re.match(r'\\d{3}', _status)"
|
||||
],
|
||||
"_cell": [
|
||||
"else",
|
||||
"ormAccessSelect",
|
||||
"startLoop"
|
||||
],
|
||||
"_prior_weight": 0.2909,
|
||||
"_quality": {
|
||||
"fidelity": 1.0,
|
||||
"bonus_ratio": 0.286,
|
||||
"test_quality": 1.0,
|
||||
"richness": 1.0,
|
||||
"quality": 1.386,
|
||||
"detected": [
|
||||
"_status",
|
||||
"addParam",
|
||||
"addResult",
|
||||
"addVar",
|
||||
"else",
|
||||
"end",
|
||||
"endLoop",
|
||||
"getListLen",
|
||||
"if_mode1",
|
||||
"itemFromList",
|
||||
"ormAccessSelect",
|
||||
"startLoop",
|
||||
"variableFromJSON"
|
||||
],
|
||||
"cell": [
|
||||
"else",
|
||||
"ormAccessSelect",
|
||||
"startLoop"
|
||||
],
|
||||
"extra": [
|
||||
"_status",
|
||||
"addParam",
|
||||
"addResult",
|
||||
"addVar",
|
||||
"end",
|
||||
"endLoop",
|
||||
"getListLen",
|
||||
"if_mode1",
|
||||
"itemFromList",
|
||||
"variableFromJSON"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"task_id": 6,
|
||||
"text": "Crear un microservicio para registrar transacciones bancarias que valide el monto, inserte los datos en base de datos y maneje errores de conexión. El servicio debe rechazar montos negativos o nulos y retornar códigos HTTP apropiados.",
|
||||
"code": "registerEndpoint(\"/api/transaction\", \"POST\", [], \"Crear nueva transacción\", mainHandler, db_connector)\naddParam(\"amount\", amount)\naddParam(\"user_id\", user_id)\naddParam(\"description\", description)\ndb_connector = avapConnector(\"db_token_12345\")\nif(amount, 0, \"<=\")\n addVar(_status, 400)\n addResult(error_msg)\n return()\nelse()\n addVar(transaction_id, \"TXN\")\n randomString(\"[A-Z0-9]\", 8, random_suffix)\n transaction_id = transaction_id + random_suffix\n getDateTime(\"%Y-%m-%d %H:%M:%S\", 0, \"UTC\", created_at)\n variableToList(user_id, fields_values)\n variableToList(amount, temp_amount)\n variableToList(description, temp_desc)\n variableToList(transaction_id, temp_id)\n variableToList(created_at, temp_date)\n getListLen(fields_values, current_len)\n itemFromList(temp_amount, 0, amount_value)\n itemFromList(temp_desc, 0, desc_value)\n itemFromList(temp_id, 0, id_value)\n itemFromList(temp_date, 0, date_value)\n try()\n ormAccessInsert([user_id, amount_value, desc_value, id_value, date_value], \"transactions\", insert_result)\n addVar(_status, 201)\n AddVariableToJSON(\"transaction_id\", transaction_id, response_data)\n AddVariableToJSON(\"status\", \"success\", response_data)\n AddVariableToJSON(\"amount\", amount_value, response_data)\n addResult(response_data)\n exception(db_error)\n addVar(_status, 500)\n AddVariableToJSON(\"error\", \"Database connection failed\", error_response)\n AddVariableToJSON(\"details\", db_error, error_response)\n addResult(error_response)\n end()\nend()",
|
||||
"test_inputs": {
|
||||
"amount": "150.75",
|
||||
"user_id": "USER123",
|
||||
"description": "Payment for services"
|
||||
},
|
||||
"test_list": [
|
||||
"re.match(r'TXN[A-Z0-9]{8}', transaction_id)",
|
||||
"re.match(r'\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}', created_at)",
|
||||
"re.match(r'success', response_data)"
|
||||
],
|
||||
"_cell": [
|
||||
"if_mode1",
|
||||
"ormAccessInsert",
|
||||
"try"
|
||||
],
|
||||
"_prior_weight": 0.4424,
|
||||
"_quality": {
|
||||
"fidelity": 1.0,
|
||||
"bonus_ratio": 0.371,
|
||||
"test_quality": 1.0,
|
||||
"richness": 1.0,
|
||||
"quality": 1.411,
|
||||
"detected": [
|
||||
"AddVariableToJSON",
|
||||
"_status",
|
||||
"addParam",
|
||||
"addResult",
|
||||
"addVar",
|
||||
"avapConnector",
|
||||
"else",
|
||||
"end",
|
||||
"getDateTime",
|
||||
"getListLen",
|
||||
"if_mode1",
|
||||
"itemFromList",
|
||||
"ormAccessInsert",
|
||||
"randomString",
|
||||
"return",
|
||||
"try"
|
||||
],
|
||||
"cell": [
|
||||
"if_mode1",
|
||||
"ormAccessInsert",
|
||||
"try"
|
||||
],
|
||||
"extra": [
|
||||
"AddVariableToJSON",
|
||||
"_status",
|
||||
"addParam",
|
||||
"addResult",
|
||||
"addVar",
|
||||
"avapConnector",
|
||||
"else",
|
||||
"end",
|
||||
"getDateTime",
|
||||
"getListLen",
|
||||
"itemFromList",
|
||||
"randomString",
|
||||
"return"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"task_id": 7,
|
||||
"text": "Crear un endpoint que importe una librería de utilidades, haga una petición GET a una API externa para obtener datos de clima, valide la respuesta y retorne información procesada con el estado HTTP apropiado.",
|
||||
"code": "import \"weather_utils\"\nfunction validateTemperature(temp) {\n if(temp, 50, \">=\") {\n return(\"extreme_hot\")\n else()\n if(temp, -20, \"<=\") {\n return(\"extreme_cold\")\n else()\n return(\"normal\")\n end()\n end()\n}\nfunction processWeatherData(data) {\n variableFromJSON(data, \"temperature\", temp)\n variableFromJSON(data, \"city\", city)\n validateTemperature(temp)\n tempStatus = validateTemperature(temp)\n AddVariableToJSON(\"status\", tempStatus, data)\n AddVariableToJSON(\"processed_at\", \"2024-01-15T10:30:00Z\", data)\n return(data)\n}\naddParam(\"city\", cityName)\naddParam(\"api_key\", apiKey)\nif(cityName, None, \"==\") {\n addVar(_status, 400)\n errorMsg = \"City parameter is required\"\n addResult(errorMsg)\n return()\nend()\nif(apiKey, None, \"==\") {\n addVar(_status, 401)\n errorMsg = \"API key is required\"\n addResult(errorMsg)\n return()\nend()\nweatherUrl = \"https://api.weather.com/v1/current\"\nqueryParams = \"city=\" + cityName + \"&key=\" + apiKey\nheaders = {\"User-Agent\": \"AVAP-Weather-Client/1.0\", \"Accept\": \"application/json\"}\nRequestGet(weatherUrl, queryParams, headers, weatherResponse, 5000)\nif(weatherResponse, None, \"==\") {\n addVar(_status, 503)\n errorMsg = \"Weather service unavailable\"\n addResult(errorMsg)\n return()\nend()\nvariableFromJSON(weatherResponse, \"error\", apiError)\nif(apiError, None, \"!=\") {\n addVar(_status, 502)\n addResult(apiError)\n return()\nend()\nprocessedData = processWeatherData(weatherResponse)\naddVar(_status, 200)\naddResult(processedData)",
|
||||
"test_inputs": {
|
||||
"city": "Madrid",
|
||||
"api_key": "test123"
|
||||
},
|
||||
"test_list": [
|
||||
"re.match(r'extreme_hot|extreme_cold|normal', tempStatus)",
|
||||
"re.match(r'Madrid|Barcelona|Valencia', cityName)",
|
||||
"re.match(r'\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z', processedData)"
|
||||
],
|
||||
"_cell": [
|
||||
"RequestGet",
|
||||
"import"
|
||||
],
|
||||
"_prior_weight": 0.3737,
|
||||
"_quality": {
|
||||
"fidelity": 1.0,
|
||||
"bonus_ratio": 0.306,
|
||||
"test_quality": 1.0,
|
||||
"richness": 1.0,
|
||||
"quality": 1.392,
|
||||
"detected": [
|
||||
"AddVariableToJSON",
|
||||
"RequestGet",
|
||||
"_status",
|
||||
"addParam",
|
||||
"addResult",
|
||||
"addVar",
|
||||
"else",
|
||||
"end",
|
||||
"function",
|
||||
"if_mode1",
|
||||
"import",
|
||||
"return",
|
||||
"variableFromJSON"
|
||||
],
|
||||
"cell": [
|
||||
"RequestGet",
|
||||
"import"
|
||||
],
|
||||
"extra": [
|
||||
"AddVariableToJSON",
|
||||
"_status",
|
||||
"addParam",
|
||||
"addResult",
|
||||
"addVar",
|
||||
"else",
|
||||
"end",
|
||||
"function",
|
||||
"if_mode1",
|
||||
"return",
|
||||
"variableFromJSON"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"task_id": 8,
|
||||
"text": "Desarrolla una función de autenticación externa que valide un token OAuth con un proveedor de identidad, consulte la base de datos de usuarios y registre la actividad de acceso. La función debe hacer una petición POST para validar el token, consultar la tabla 'usuarios' para verificar permisos, y devolver el código HTTP apropiado según el resultado de la validación.",
|
||||
"code": "addParam(\"token\", auth_token)\naddParam(\"client_id\", client_id)\nif(auth_token, None, \"==\")\n addVar(_status, 400)\n addResult(_status)\n return()\nend()\noauth_url = \"https://auth.provider.com/validate\"\nheaders = {\"Content-Type\": \"application/json\"}\nbody = {\"token\": auth_token, \"client_id\": client_id}\nRequestPost(oauth_url, \"\", headers, body, oauth_response, 5000)\nif(oauth_response, None, \"==\")\n addVar(_status, 503)\n error_msg = \"OAuth service unavailable\"\n addResult(error_msg)\n return()\nend()\nvariableFromJSON(oauth_response, \"valid\", is_valid)\nvariableFromJSON(oauth_response, \"user_id\", external_user_id)\nif(is_valid, \"false\", \"==\")\n addVar(_status, 401)\n error_msg = \"Invalid token\"\n addResult(error_msg)\n return()\nend()\ndb_connector = avapConnector(\"db-uuid-12345\")\nfields = \"user_id,email,status,permissions\"\nselector = \"external_id = '\" + external_user_id + \"'\"\normAccessSelect(fields, \"usuarios\", selector, user_data)\ngetListLen(user_data, user_count)\nif(user_count, 0, \"==\")\n addVar(_status, 404)\n error_msg = \"User not found\"\n addResult(error_msg)\n return()\nend()\nitemFromList(user_data, 0, user_record)\nvariableFromJSON(user_record, \"status\", user_status)\nvariableFromJSON(user_record, \"user_id\", internal_user_id)\nvariableFromJSON(user_record, \"email\", user_email)\nvariableFromJSON(user_record, \"permissions\", user_permissions)\nif(user_status, \"active\", \"!=\")\n addVar(_status, 403)\n error_msg = \"Account suspended\"\n addResult(error_msg)\n return()\nend()\ngetDateTime(\"%Y-%m-%d %H:%M:%S\", 0, \"UTC\", access_timestamp)\naccess_log = {\"user_id\": internal_user_id, \"timestamp\": access_timestamp, \"action\": \"oauth_login\"}\nlog_fields = [\"user_id\", \"timestamp\", \"action\"]\nlog_values = [internal_user_id, access_timestamp, \"oauth_login\"]\normAccessInsert(log_values, \"access_logs\", log_result)\naddVar(_status, 200)\nresponse_data = {\"user_id\": internal_user_id, \"email\": user_email, \"permissions\": user_permissions}\naddResult(response_data)",
|
||||
"test_inputs": {
|
||||
"token": "valid_oauth_token_12345",
|
||||
"client_id": "app_client_001"
|
||||
},
|
||||
"test_list": [
|
||||
"re.match(r'\\d+', str(user_count))",
|
||||
"re.match(r'[a-zA-Z0-9_]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}', user_email)",
|
||||
"re.match(r'\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}', access_timestamp)"
|
||||
],
|
||||
"_cell": [
|
||||
"RequestPost",
|
||||
"_status",
|
||||
"ormAccessSelect"
|
||||
],
|
||||
"_prior_weight": 0.0909,
|
||||
"_quality": {
|
||||
"fidelity": 1.0,
|
||||
"bonus_ratio": 0.343,
|
||||
"test_quality": 1.0,
|
||||
"richness": 1.0,
|
||||
"quality": 1.403,
|
||||
"detected": [
|
||||
"RequestPost",
|
||||
"_status",
|
||||
"addParam",
|
||||
"addResult",
|
||||
"addVar",
|
||||
"avapConnector",
|
||||
"end",
|
||||
"getDateTime",
|
||||
"getListLen",
|
||||
"if_mode1",
|
||||
"itemFromList",
|
||||
"ormAccessInsert",
|
||||
"ormAccessSelect",
|
||||
"return",
|
||||
"variableFromJSON"
|
||||
],
|
||||
"cell": [
|
||||
"RequestPost",
|
||||
"_status",
|
||||
"ormAccessSelect"
|
||||
],
|
||||
"extra": [
|
||||
"addParam",
|
||||
"addResult",
|
||||
"addVar",
|
||||
"avapConnector",
|
||||
"end",
|
||||
"getDateTime",
|
||||
"getListLen",
|
||||
"if_mode1",
|
||||
"itemFromList",
|
||||
"ormAccessInsert",
|
||||
"return",
|
||||
"variableFromJSON"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"task_id": 9,
|
||||
"text": "Implementar un servicio que genere códigos de verificación aleatorios para una lista de usuarios, extraiga información específica de cada usuario usando índices de lista, y devuelva los resultados procesados con códigos únicos.",
|
||||
"code": "registerEndpoint(\"/api/generate-codes\", \"POST\", [], \"application/json\", mainHandler, None)\n\nfunction mainHandler()\n{\naddParam(\"user_data\", user_list)\naddParam(\"code_length\", length_param)\nif(user_list, None, \"==\")\n_status = 400\naddVar(error_msg, \"Lista de usuarios requerida\")\naddResult(error_msg)\nreturn()\nend()\nif(length_param, None, \"==\")\naddVar(length_param, 8)\nend()\nvariableToList(user_list, processed_users)\ngetListLen(processed_users, total_users)\naddVar(counter, 0)\naddVar(verification_codes, [])\nstartLoop(i, 0, total_users)\nitemFromList(processed_users, i, current_user)\nvariableFromJSON(current_user, \"email\", user_email)\nvariableFromJSON(current_user, \"user_id\", user_id)\nrandomString(\"[A-Z0-9]\", length_param, random_code)\nAddVariableToJSON(\"user_id\", user_id, code_entry)\nAddVariableToJSON(\"email\", user_email, code_entry)\nAddVariableToJSON(\"verification_code\", random_code, code_entry)\naddVar(verification_codes, verification_codes + [code_entry])\naddVar(counter, counter + 1)\nendLoop()\naddVar(response_data, {})\nAddVariableToJSON(\"generated_codes\", verification_codes, response_data)\nAddVariableToJSON(\"total_processed\", counter, response_data)\n_status = 200\naddResult(response_data)\nreturn()\n}",
|
||||
"test_inputs": {
|
||||
"user_data": "[{\"user_id\": 123, \"email\": \"test@example.com\"}, {\"user_id\": 456, \"email\": \"user@domain.org\"}]",
|
||||
"code_length": "6"
|
||||
},
|
||||
"test_list": [
|
||||
"re.match(r'^\\[{\"user_id\":', response_data)",
|
||||
"re.match(r'\"verification_code\":\"[A-Z0-9]{6}\"', response_data)",
|
||||
"re.match(r'\"total_processed\":2', response_data)"
|
||||
],
|
||||
"_cell": [
|
||||
"itemFromList",
|
||||
"randomString"
|
||||
],
|
||||
"_prior_weight": 0.1212,
|
||||
"_quality": {
|
||||
"fidelity": 1.0,
|
||||
"bonus_ratio": 0.361,
|
||||
"test_quality": 1.0,
|
||||
"richness": 1.0,
|
||||
"quality": 1.408,
|
||||
"detected": [
|
||||
"AddVariableToJSON",
|
||||
"_status",
|
||||
"addParam",
|
||||
"addResult",
|
||||
"addVar",
|
||||
"end",
|
||||
"endLoop",
|
||||
"function",
|
||||
"getListLen",
|
||||
"if_mode1",
|
||||
"itemFromList",
|
||||
"randomString",
|
||||
"return",
|
||||
"startLoop",
|
||||
"variableFromJSON"
|
||||
],
|
||||
"cell": [
|
||||
"itemFromList",
|
||||
"randomString"
|
||||
],
|
||||
"extra": [
|
||||
"AddVariableToJSON",
|
||||
"_status",
|
||||
"addParam",
|
||||
"addResult",
|
||||
"addVar",
|
||||
"end",
|
||||
"endLoop",
|
||||
"function",
|
||||
"getListLen",
|
||||
"if_mode1",
|
||||
"return",
|
||||
"startLoop",
|
||||
"variableFromJSON"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"task_id": 10,
|
||||
"text": "Crea un endpoint AVAP que reciba un parámetro 'table_name', valide que la tabla existe en la base de datos usando ORM, y devuelva información sobre la tabla. Si no recibe parámetro, debe usar 'users' por defecto. Implementa una función auxiliar para formatear la respuesta y maneja errores apropiadamente.",
|
||||
"code": "registerEndpoint(\"/api/validate-table\", \"GET\", [], \"default\", validateTableHandler, mainHandler)\nfunction validateTableHandler()\n{\n addParam(\"table_name\", received_table)\n if(received_table, None, \"==\")\n addVar(target_table, \"users\")\n else()\n addVar(target_table, $received_table)\n end()\n db_connector = avapConnector(\"db-uuid-12345\")\n ormCheckTable($target_table, table_exists)\n if(table_exists, True, \"==\")\n result = formatTableResponse($target_table, \"exists\")\n addVar(_status, 200)\n else()\n result = formatTableResponse($target_table, \"not_found\")\n addVar(_status, 404)\n end()\n addResult(result)\n return()\n}\nfunction formatTableResponse(table_name, status)\n{\n addVar(response_data, \"{}\")\n AddVariableToJSON(\"table\", $table_name, response_data)\n AddVariableToJSON(\"status\", $status, response_data)\n getDateTime(\"%Y-%m-%d %H:%M:%S\", 0, \"UTC\", current_time)\n AddVariableToJSON(\"timestamp\", $current_time, response_data)\n return($response_data)\n}",
|
||||
"test_inputs": {
|
||||
"table_name": "products"
|
||||
},
|
||||
"test_list": [
|
||||
"re.match(r'\\{.*\"table\".*\"products\".*\\}', result)",
|
||||
"re.match(r'\\{.*\"status\".*\"exists\".*\\}', result)",
|
||||
"re.match(r'\\{.*\"timestamp\".*\"\\d{4}-\\d{2}-\\d{2}.*\\}', result)"
|
||||
],
|
||||
"_cell": [
|
||||
"addParam",
|
||||
"function",
|
||||
"ormCheckTable"
|
||||
],
|
||||
"_prior_weight": 0.5758,
|
||||
"_quality": {
|
||||
"fidelity": 1.0,
|
||||
"bonus_ratio": 0.286,
|
||||
"test_quality": 1.0,
|
||||
"richness": 1.0,
|
||||
"quality": 1.386,
|
||||
"detected": [
|
||||
"AddVariableToJSON",
|
||||
"_status",
|
||||
"addParam",
|
||||
"addResult",
|
||||
"addVar",
|
||||
"avapConnector",
|
||||
"else",
|
||||
"end",
|
||||
"function",
|
||||
"getDateTime",
|
||||
"if_mode1",
|
||||
"ormCheckTable",
|
||||
"return"
|
||||
],
|
||||
"cell": [
|
||||
"addParam",
|
||||
"function",
|
||||
"ormCheckTable"
|
||||
],
|
||||
"extra": [
|
||||
"AddVariableToJSON",
|
||||
"_status",
|
||||
"addResult",
|
||||
"addVar",
|
||||
"avapConnector",
|
||||
"else",
|
||||
"end",
|
||||
"getDateTime",
|
||||
"if_mode1",
|
||||
"return"
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
{
|
||||
"total_cells": 9139,
|
||||
"filled_cells": 10,
|
||||
"fill_rate": 0.0011,
|
||||
"distribution_entropy": 4.06,
|
||||
"node_type_frequency": {
|
||||
"startLoop": 2,
|
||||
"randomString": 2,
|
||||
"import": 2,
|
||||
"_status": 2,
|
||||
"RequestGet": 2,
|
||||
"itemFromList": 2,
|
||||
"addVar": 1,
|
||||
"ormAccessUpdate": 1,
|
||||
"ormAccessSelect": 3,
|
||||
"variableFromJSON": 1,
|
||||
"addParam": 2,
|
||||
"else": 1,
|
||||
"ormAccessInsert": 1,
|
||||
"try": 1,
|
||||
"if_mode1": 1,
|
||||
"RequestPost": 1,
|
||||
"ormCheckTable": 1,
|
||||
"function": 1
|
||||
},
|
||||
"low_quality_cells": 0,
|
||||
"empty_cells": 9129,
|
||||
"kl_divergence_dataset_vs_prior": -0.724,
|
||||
"prior_summary": "ConstructPrior: 4262 cells | mean=0.252 | epsilon=0.05 | github_files_analyzed=100 github_files_fetched=100 total_pair_cooccurrences=441 total_trio_cooccurrences=3821"
|
||||
}
|
||||
|
|
@ -1,187 +0,0 @@
|
|||
[
|
||||
{
|
||||
"task_id": 1,
|
||||
"text": "Crea un endpoint que reciba un parámetro 'codigo_pais' desde la petición HTTP y genere un token aleatorio de 8 caracteres alfanuméricos si el código de país es válido (tiene exactamente 2 letras mayúsculas), o establezca un error 400 si no es válido.",
|
||||
"code": "addParam(\"codigo_pais\", codigo)\ngetRegex(codigo, \"^[A-Z]{2}$\", validacion)\nif(None, None, `validacion != None`)\n randomString(\"[a-zA-Z0-9]\", 8, token)\n addResult(token)\nelse()\n addVar(_status, 400)\n addResult(\"Error: Codigo de pais invalido\")\nend()",
|
||||
"test_inputs": {
|
||||
"codigo_pais": "ES"
|
||||
},
|
||||
"test_list": [
|
||||
"re.match(r'^[a-zA-Z0-9]{8}$', token)",
|
||||
"re.match(r'^200$', str(_status))",
|
||||
"re.match(r'^[a-zA-Z0-9]+$', token)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"task_id": 2,
|
||||
"text": "Crea un servicio que tome una contraseña como parámetro, genere un token aleatorio de 32 caracteres alfanuméricos, reemplace todas las vocales de la contraseña por asteriscos, combine los resultados en un objeto JSON y devuelva el resultado.",
|
||||
"code": "addParam(\"password\", password)\nrandomString(\"[a-zA-Z0-9]\", 32, token)\nreplace(password, \"[aeiouAEIOU]\", \"*\", masked_password)\naddVar(response, {})\nAddVariableToJSON(\"original_length\", 0, response)\ngetListLen(password, pwd_len)\nAddVariableToJSON(\"original_length\", pwd_len, response)\nAddVariableToJSON(\"masked_password\", masked_password, response)\nAddVariableToJSON(\"token\", token, response)\naddResult(response)",
|
||||
"test_inputs": {
|
||||
"password": "MiPassword123"
|
||||
},
|
||||
"test_list": [
|
||||
"re.match(r'^[a-zA-Z0-9]{32}$', token)",
|
||||
"re.match(r'.*M\\*P\\*ssw\\*rd123.*', masked_password)",
|
||||
"re.match(r'^\\d+$', str(pwd_len))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"task_id": 3,
|
||||
"text": "Implementa un validador de contraseñas que recibe una contraseña y evalúa su fortaleza. Si la contraseña tiene menos de 8 caracteres, asigna el status 400 y retorna 'muy_corta'. Si tiene 8 o más caracteres pero no contiene números, asigna status 401 y retorna 'sin_numeros'. Si cumple ambos requisitos, asigna status 200 y retorna 'valida'.",
|
||||
"code": "addParam(\"password\", password)\ngetListLen(password, length)\nif(length, 8, \"<\")\n _status = 400\n result = \"muy_corta\"\nelse()\n getRegex(password, \"[0-9]\", has_number)\n if(has_number, None, \"==\")\n _status = 401\n result = \"sin_numeros\"\n else()\n _status = 200\n result = \"valida\"\n end()\nend()\naddResult(result)",
|
||||
"test_inputs": {
|
||||
"password": "secreto123"
|
||||
},
|
||||
"test_list": [
|
||||
"re.match(r'^200$', str(_status))",
|
||||
"re.match(r'^valida$', result)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"task_id": 4,
|
||||
"text": "Crear un endpoint que reciba una lista de números y calcule la suma de todos los elementos que sean mayores a un valor umbral especificado.",
|
||||
"code": "addParam(\"numbers\", numbers)\naddParam(\"threshold\", threshold)\nvariableToList(numbers, numList)\ngetListLen(numList, length)\nsum = 0\nstartLoop(i, 0, length)\n itemFromList(numList, i, current)\n if(current, threshold, \">\")\n sum = sum + current\n end()\nendLoop()\naddResult(sum)",
|
||||
"test_inputs": {
|
||||
"numbers": [
|
||||
10,
|
||||
5,
|
||||
15,
|
||||
3,
|
||||
20,
|
||||
8,
|
||||
25
|
||||
],
|
||||
"threshold": 10
|
||||
},
|
||||
"test_list": [
|
||||
"re.match(r'^60$', str(sum))",
|
||||
"re.match(r'^\\d+$', str(sum))",
|
||||
"re.match(r'^[1-9]\\d*$', str(sum))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"task_id": 5,
|
||||
"text": "Crea un endpoint que extraiga el email de un usuario desde un objeto JSON recibido como parámetro, luego agregue un campo 'domain' con el dominio del email extraído y retorne el JSON modificado.",
|
||||
"code": "addParam(\"user_data\", user_json)\nvariableFromJSON(user_json, \"email\", email)\ngetRegex(email, \"@(.+)\", domain)\nAddVariableToJSON(\"domain\", domain, user_json)\naddResult(user_json)",
|
||||
"test_inputs": {
|
||||
"user_data": "{\"name\": \"Juan Pérez\", \"email\": \"juan@empresa.com\", \"age\": 30}"
|
||||
},
|
||||
"test_list": [
|
||||
"re.match(r'^juan@empresa\\.com$', email)",
|
||||
"re.match(r'^empresa\\.com$', domain)",
|
||||
"re.match(r'.*\"domain\"\\s*:\\s*\"empresa\\.com\".*', str(user_json))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"task_id": 6,
|
||||
"text": "Crear un endpoint que consulte usuarios por edad mínima usando ORM. El endpoint recibe un parámetro 'min_age' y devuelve todos los usuarios cuya edad sea mayor o igual al valor especificado. Usar ormAccessSelect para consultar la tabla 'users' con selector WHERE apropiado.",
|
||||
"code": "addParam(\"min_age\", min_age)\nmin_age_str = str(min_age)\nselector = \"age >= \" + min_age_str\normAccessSelect(\"*\", \"users\", selector, users_result)\naddResult(users_result)",
|
||||
"test_inputs": {
|
||||
"min_age": 25
|
||||
},
|
||||
"test_list": [
|
||||
"re.match(r'^\\[.*\\]$', str(users_result))",
|
||||
"re.match(r'^25$', str(min_age))",
|
||||
"re.match(r'^age >= 25$', selector)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"task_id": 7,
|
||||
"text": "Crea un endpoint que reciba una contraseña como parámetro, la hashee usando SHA-256 y devuelva el hash resultante. La función debe validar que el hash generado tenga exactamente 64 caracteres hexadecimales y que no esté vacío.",
|
||||
"code": "addParam(\"password\", password)\nencodeSHA256(password, hashed)\naddResult(hashed)",
|
||||
"test_inputs": {
|
||||
"password": "secretPassword123"
|
||||
},
|
||||
"test_list": [
|
||||
"re.match(r'^[a-f0-9]{64}$', hashed)",
|
||||
"re.match(r'^.{64}$', hashed)",
|
||||
"re.match(r'^[^\\s]+$', hashed)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"task_id": 8,
|
||||
"text": "Crear un endpoint que reciba una fecha en formato ISO (YYYY-MM-DD HH:MM:SS) y devuelva el timestamp Unix correspondiente. El endpoint debe aplicar un offset de -3 horas para convertir de UTC-3 a UTC.",
|
||||
"code": "addParam(\"fecha_iso\", fecha_iso)\ngetTimeStamp(fecha_iso, \"%Y-%m-%d %H:%M:%S\", -10800, timestamp_unix)\naddResult(timestamp_unix)",
|
||||
"test_inputs": {
|
||||
"fecha_iso": "2023-12-25 15:30:00"
|
||||
},
|
||||
"test_list": [
|
||||
"re.match(r'^\\d{10}$', str(timestamp_unix))",
|
||||
"re.match(r'^1703.*', str(timestamp_unix))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"task_id": 9,
|
||||
"text": "Crea un endpoint que use un conector de Belvo para listar instituciones financieras y devuelva el resultado. El conector tiene UUID 'a1b2c3d4-e5f6-7890-1234-567890abcdef' y expone el método list_institutions() que no requiere parámetros.",
|
||||
"code": "belvo_connector = avapConnector(\"a1b2c3d4-e5f6-7890-1234-567890abcdef\")\ninstitutions = belvo_connector.list_institutions()\naddResult(institutions)",
|
||||
"test_inputs": {},
|
||||
"test_list": [
|
||||
"re.match(r'^<avap_connector:', str(belvo_connector))",
|
||||
"re.match(r'^\\[.*\\]$', str(institutions))",
|
||||
"re.match(r'.*institutions.*', str(institutions))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"task_id": 10,
|
||||
"text": "Crea un endpoint que ejecute dos operaciones concurrentes usando go/gather: una que genere un token SHA256 a partir de un usuario, y otra que obtenga la fecha actual. Ambas deben completarse en paralelo y retornar sus resultados junto con un timestamp de cuando se iniciaron las operaciones.",
|
||||
"code": "addParam(\"username\", username)\ngetDateTime(\"%Y-%m-%d %H:%M:%S\", 0, \"UTC\", start_time)\ntask1 = go generateUserToken(username)\ntask2 = go getCurrentDate()\ntoken_result = gather(task1, 5000)\ndate_result = gather(task2, 3000)\naddResult(token_result)\naddResult(date_result)\naddResult(start_time)\n\nfunction generateUserToken(user) {\n user_data = user + \"_secret_salt\"\n encodeSHA256(user_data, hashed_token)\n return(hashed_token)\n}\n\nfunction getCurrentDate() {\n getDateTime(\"%Y-%m-%d\", 0, \"America/New_York\", current_date)\n return(current_date)\n}",
|
||||
"test_inputs": {
|
||||
"username": "john_doe"
|
||||
},
|
||||
"test_list": [
|
||||
"re.match(r'^[a-f0-9]{64}$', token_result)",
|
||||
"re.match(r'^\\d{4}-\\d{2}-\\d{2}$', date_result)",
|
||||
"re.match(r'^\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}$', start_time)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"task_id": 11,
|
||||
"text": "Crea una función que calcule el factorial de un número entero positivo. La función debe recibir el número como parámetro via addParam y retornar el resultado del factorial. Implementa la función recursiva y llámala desde el flujo principal.",
|
||||
"code": "addParam(\"numero\", numero)\n\nfunction factorial(n) {\n if(n, 1, \"<=\") {\n return(1)\n }\n else() {\n addVar(n_minus_1, n)\n n_minus_1 = n_minus_1 - 1\n partial_result = factorial(n_minus_1)\n result = n * partial_result\n return(result)\n }\n end()\n}\n\nfactorial_result = factorial(numero)\naddResult(factorial_result)",
|
||||
"test_inputs": {
|
||||
"numero": 5
|
||||
},
|
||||
"test_list": [
|
||||
"re.match(r'^120$', str(factorial_result))",
|
||||
"re.match(r'^\\d+$', str(factorial_result))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"task_id": 12,
|
||||
"text": "Crear un sistema de validación de entrada que use try/exception para manejar errores de conversión de tipos. El sistema debe intentar convertir un parámetro de entrada a entero, y si falla, devolver un mensaje de error con status 400.",
|
||||
"code": "addParam(\"numero\", numero)\ntry()\n numero_int = int(numero)\n addVar(resultado, \"Numero valido\")\n addVar(_status, 200)\nexception(error)\n addVar(resultado, \"Error: entrada invalida\")\n addVar(_status, 400)\nend()\naddResult(resultado)",
|
||||
"test_inputs": {
|
||||
"numero": "abc123"
|
||||
},
|
||||
"test_list": [
|
||||
"re.match(r'^Error: entrada invalida$', resultado)",
|
||||
"re.match(r'^400$', str(_status))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"task_id": 13,
|
||||
"text": "Crear un endpoint que consuma una API externa de clima usando RequestGet. El endpoint debe recibir una ciudad como parámetro, realizar una petición GET a una API de clima (simulada) con timeout de 5000ms, extraer la temperatura del JSON de respuesta y retornarla. Si la petición falla por timeout, devolver status 408.",
|
||||
"code": "addParam(\"ciudad\", ciudad)\napi_url = \"https://api.clima.com/weather\"\nquerystring = \"?city=\" + ciudad + \"&units=metric\"\nheaders = {}\nRequestGet(api_url, querystring, headers, clima_response, 5000)\nif(clima_response, None, \"==\")\n addVar(_status, 408)\n error_msg = \"Timeout al consultar API de clima\"\n addResult(error_msg)\nelse()\n variableFromJSON(clima_response, \"temperature\", temperatura)\n result = \"La temperatura en \" + ciudad + \" es \" + str(temperatura) + \"°C\"\n addResult(result)\nend()",
|
||||
"test_inputs": {
|
||||
"ciudad": "Madrid"
|
||||
},
|
||||
"test_list": [
|
||||
"re.match(r'^La temperatura en Madrid es -?\\d+(\\.\\d+)?°C$', result)",
|
||||
"re.match(r'^\\d+$', str(_status)) and re.match(r'^200$', str(_status))",
|
||||
"re.match(r'^-?\\d+(\\.\\d+)?$', str(temperatura))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"task_id": 14,
|
||||
"text": "Crea un sistema modular que use include para cargar configuraciones desde un archivo externo y import para cargar una librería matemática nativa. El sistema debe calcular el área de un círculo usando funciones de la librería matemática, aplicar una configuración de factor de conversión cargada desde archivo, y devolver tanto el área original como el área convertida. El parámetro de entrada es el radio del círculo.",
|
||||
"code": "include \"config.avap\"\nimport <math>\naddParam(\"radio\", radio)\narea_original = math.pi() * radio * radio\narea_convertida = area_original * factor_conversion\naddVar(resultado, \"{}\")\nAddVariableToJSON(\"area_original\", area_original, resultado)\nAddVariableToJSON(\"area_convertida\", area_convertida, resultado)\nAddVariableToJSON(\"factor_usado\", factor_conversion, resultado)\naddResult(resultado)",
|
||||
"test_inputs": {
|
||||
"radio": 5.0
|
||||
},
|
||||
"test_list": [
|
||||
"re.match(r'^\\{.*area_original.*\\}$', resultado)",
|
||||
"re.match(r'^\\{.*area_convertida.*\\}$', resultado)",
|
||||
"re.match(r'^\\{.*factor_usado.*\\}$', resultado)"
|
||||
]
|
||||
}
|
||||
]
|
||||
File diff suppressed because one or more lines are too long
|
|
@ -1,51 +0,0 @@
|
|||
{
|
||||
"mode": "reward",
|
||||
"weights": {
|
||||
"w_ecs": 0.5,
|
||||
"w_novelty": 0.35,
|
||||
"w_tests": 0.15
|
||||
},
|
||||
"dataset_size": 10,
|
||||
"pool_size": 5,
|
||||
"pool_summary": "GoldPool: 5/5 | reward: min=0.578 max=0.763 mean=0.621",
|
||||
"distribution_entropy": 4.959,
|
||||
"node_type_frequency": {
|
||||
"AddVariableToJSON": 10,
|
||||
"RequestGet": 4,
|
||||
"_status": 10,
|
||||
"addParam": 10,
|
||||
"addResult": 10,
|
||||
"addVar": 10,
|
||||
"else": 10,
|
||||
"end": 10,
|
||||
"endLoop": 9,
|
||||
"function": 10,
|
||||
"gather": 10,
|
||||
"getListLen": 10,
|
||||
"getQueryParamList": 4,
|
||||
"if_mode2": 10,
|
||||
"itemFromList": 10,
|
||||
"replace": 4,
|
||||
"return": 10,
|
||||
"startLoop": 9,
|
||||
"try": 10,
|
||||
"variableFromJSON": 10,
|
||||
"avapConnector": 9,
|
||||
"encodeMD5": 4,
|
||||
"encodeSHA256": 4,
|
||||
"getDateTime": 9,
|
||||
"getTimeStamp": 4,
|
||||
"ormAccessInsert": 9,
|
||||
"ormAccessSelect": 4,
|
||||
"import": 7,
|
||||
"ormAccessUpdate": 3,
|
||||
"ormCheckTable": 4,
|
||||
"randomString": 4,
|
||||
"RequestPost": 3,
|
||||
"ormDirect": 3,
|
||||
"stampToDatetime": 3
|
||||
},
|
||||
"covered_constructs": 34,
|
||||
"total_constructs": 38,
|
||||
"mean_reward": 0.5854
|
||||
}
|
||||
|
|
@ -0,0 +1,546 @@
|
|||
[
|
||||
{
|
||||
"source_file": "mbap_avap_A.json",
|
||||
"task_id": 1,
|
||||
"text": "Crea una API de validación y transformación de datos de usuarios que procese una lista de emails desde parámetros de consulta, valide cada email con expresión regular, transforme nombres de usuarios eliminando espacios, y genere un reporte con estadísticas de emails válidos/inválidos. La API debe manejar errores y devolver código de estado HTTP apropiado.",
|
||||
"code": "addParam('user_list', user_data)\ngetQueryParamList('emails', email_list)\naddVar(valid_count, 0)\naddVar(invalid_count, 0)\naddVar(processed_emails, [])\ntry()\n getListLen(email_list, total_emails)\n if(total_emails, 0, \">\")\n addVar(i, 0)\n startLoop(counter, 0, total_emails)\n itemFromList(email_list, i, current_email)\n getRegex(current_email, \"^[\\\\w\\\\.-]+@[\\\\w\\\\.-]+\\\\.[a-zA-Z]{2,}$\", email_match)\n if(None, None, `email_match != None`)\n addVar(valid_count, valid_count + 1)\n replace(current_email, \" \", \"\", clean_email)\n variableToList(clean_email, temp_list)\n AddVariableToJSON(\"email\", clean_email, email_obj)\n AddVariableToJSON(\"status\", \"valid\", email_obj)\n else()\n addVar(invalid_count, invalid_count + 1)\n AddVariableToJSON(\"email\", current_email, email_obj)\n AddVariableToJSON(\"status\", \"invalid\", email_obj)\n end()\n addVar(i, i + 1)\n endLoop()\n AddVariableToJSON(\"total_processed\", total_emails, report)\n AddVariableToJSON(\"valid_emails\", valid_count, report)\n AddVariableToJSON(\"invalid_emails\", invalid_count, report)\n if(valid_count, 0, \">\")\n addVar(_status, 200)\n else()\n addVar(_status, 422)\n end()\n else()\n AddVariableToJSON(\"error\", \"No emails provided\", report)\n addVar(_status, 400)\n end()\nexception(error_var)\n AddVariableToJSON(\"error\", \"Processing failed\", report)\n addVar(_status, 500)\nend()\naddResult(report)",
|
||||
"test_inputs": {
|
||||
"emails": [
|
||||
"user1@domain.com",
|
||||
"invalid-email",
|
||||
"test@example.org",
|
||||
"bad@",
|
||||
"admin@site.co.uk"
|
||||
]
|
||||
},
|
||||
"test_list": [
|
||||
"re.match(r'\\d+', str(report.get('total_processed', '')))",
|
||||
"re.match(r'[2-5]\\d\\d', str(_status))",
|
||||
"re.match(r'(valid|invalid)', str(report.get('error', '') or 'valid'))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"source_file": "mbpp_avap.json",
|
||||
"task_id": 1,
|
||||
"text": "Crear un endpoint que reciba un parámetro 'message' y devuelva un saludo personalizado. Si no se proporciona el parámetro, debe devolver un saludo genérico con código de estado 200.",
|
||||
"code": "addParam(\"message\", message)\nif(message, None, \"=\")\n greeting = \"Hello, World!\"\nelse()\n greeting = \"Hello, \" + message + \"!\"\nend()\naddResult(greeting)\n_status = 200",
|
||||
"test_inputs": {
|
||||
"message": "Alice"
|
||||
},
|
||||
"test_list": [
|
||||
"re.search(r'Hello, Alice!', greeting)",
|
||||
"re.match(r'^200$', str(_status))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"source_file": "mbpp_avap.json",
|
||||
"task_id": 2,
|
||||
"text": "Crear un generador de tokens seguros que tome una contraseña como entrada, genere un hash SHA256 de la misma, y luego cree un token aleatorio de 32 caracteres alfanuméricos. El sistema debe retornar tanto el hash como el token generado.",
|
||||
"code": "addParam(\"password\", password)\nencodeSHA256(password, hashed_password)\nrandomString(\"[a-zA-Z0-9]\", 32, secure_token)\naddResult(hashed_password)\naddResult(secure_token)",
|
||||
"test_inputs": {
|
||||
"password": "mySecretPass123"
|
||||
},
|
||||
"test_list": [
|
||||
"re.match(r'^[a-f0-9]{64}$', hashed_password)",
|
||||
"re.match(r'^[a-zA-Z0-9]{32}$', secure_token)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"source_file": "synthetic_data_generated_bedrock.json",
|
||||
"task_id": 1,
|
||||
"text": "Captura el parámetro 'username' de la petición HTTP y devuélvelo como resultado. Si no existe, la variable será None.",
|
||||
"code": "addParam(\"username\", username)\naddResult(username)",
|
||||
"test_inputs": {
|
||||
"username": "alice"
|
||||
},
|
||||
"test_list": [
|
||||
"re.match(r'^alice$', str(username))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"source_file": "synthetic_data_generated_bedrock.json",
|
||||
"task_id": 2,
|
||||
"text": "Recibe el parámetro 'email' y establece el código de estado HTTP en 200. Devuelve el email como resultado.",
|
||||
"code": "addParam(\"email\", email)\naddVar(_status, 200)\naddResult(email)",
|
||||
"test_inputs": {
|
||||
"email": "user@example.com"
|
||||
},
|
||||
"test_list": [
|
||||
"re.match(r'^user@example\\.com$', str(email))",
|
||||
"re.match(r'^200$', str(_status))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"source_file": "synthetic_data_generated_bedrock.json",
|
||||
"task_id": 3,
|
||||
"text": "Recibe el parámetro 'password', genera su hash SHA-256 y devuelve el hash como resultado.",
|
||||
"code": "addParam(\"password\", password)\nencodeSHA256(password, hashed)\naddResult(hashed)",
|
||||
"test_inputs": {
|
||||
"password": "secret123"
|
||||
},
|
||||
"test_list": [
|
||||
"re.match(r'^[a-f0-9]{64}$', str(hashed))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"source_file": "synthetic_data_generated_bedrock.json",
|
||||
"task_id": 4,
|
||||
"text": "Recibe el parámetro 'text', reemplaza todos los espacios por guiones bajos y devuelve el resultado.",
|
||||
"code": "addParam(\"text\", text)\nreplace(text, \" \", \"_\", result)\naddResult(result)",
|
||||
"test_inputs": {
|
||||
"text": "hello world foo"
|
||||
},
|
||||
"test_list": [
|
||||
"re.match(r'^hello_world_foo$', str(result))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"source_file": "synthetic_data_generated_bedrock.json",
|
||||
"task_id": 5,
|
||||
"text": "Genera un token aleatorio de 32 caracteres alfanuméricos y devuélvelo como resultado.",
|
||||
"code": "randomString(\"[a-zA-Z0-9]\", 32, token)\naddResult(token)",
|
||||
"test_inputs": {},
|
||||
"test_list": [
|
||||
"re.match(r'^[a-zA-Z0-9]{32}$', str(token))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"source_file": "synthetic_data_generated_bedrock.json",
|
||||
"task_id": 6,
|
||||
"text": "Recibe el parámetro 'age'. Si age es mayor que 18, devuelve 'adulto'; de lo contrario devuelve 'menor'.",
|
||||
"code": "addParam(\"age\", age)\nif(age, 18, \">\")\nresult = \"adulto\"\nelse()\nresult = \"menor\"\nend()\naddResult(result)",
|
||||
"test_inputs": {
|
||||
"age": 25
|
||||
},
|
||||
"test_list": [
|
||||
"re.match(r'^adulto$', str(result))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"source_file": "synthetic_data_generated_bedrock.json",
|
||||
"task_id": 7,
|
||||
"text": "Recibe el parámetro 'score'. Si score es igual a 100, establece _status en 200 y result en 'perfecto'; si no, _status en 400 y result en 'incompleto'.",
|
||||
"code": "addParam(\"score\", score)\nif(score, 100, \"==\")\naddVar(_status, 200)\nresult = \"perfecto\"\nelse()\naddVar(_status, 400)\nresult = \"incompleto\"\nend()\naddResult(result)",
|
||||
"test_inputs": {
|
||||
"score": 100
|
||||
},
|
||||
"test_list": [
|
||||
"re.match(r'^perfecto$', str(result))",
|
||||
"re.match(r'^200$', str(_status))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"source_file": "synthetic_data_generated_bedrock.json",
|
||||
"task_id": 8,
|
||||
"text": "Crea una lista con el elemento 'item1', obtén su longitud y devuelve la longitud como resultado.",
|
||||
"code": "variableToList(\"item1\", myList)\ngetListLen(myList, length)\naddResult(length)",
|
||||
"test_inputs": {},
|
||||
"test_list": [
|
||||
"re.match(r'^1$', str(length))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"source_file": "synthetic_data_generated_bedrock.json",
|
||||
"task_id": 9,
|
||||
"text": "Recibe el parámetro 'items' como lista de query params, obtén su longitud y devuélvela como resultado.",
|
||||
"code": "getQueryParamList(\"items\", items)\ngetListLen(items, length)\naddResult(length)",
|
||||
"test_inputs": {
|
||||
"items": [
|
||||
"a",
|
||||
"b",
|
||||
"c"
|
||||
]
|
||||
},
|
||||
"test_list": [
|
||||
"re.match(r'^\\d+$', str(length))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"source_file": "synthetic_data_generated_bedrock.json",
|
||||
"task_id": 10,
|
||||
"text": "Recibe el parámetro 'data' como JSON, extrae el campo 'name' y devuélvelo como resultado.",
|
||||
"code": "addParam(\"data\", data)\nvariableFromJSON(data, \"name\", name)\naddResult(name)",
|
||||
"test_inputs": {
|
||||
"data": "{\"name\": \"Carlos\", \"age\": 30}"
|
||||
},
|
||||
"test_list": [
|
||||
"re.match(r'^Carlos$', str(name))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"source_file": "synthetic_data_generated_bedrock.json",
|
||||
"task_id": 11,
|
||||
"text": "Crea un objeto JSON vacío, agrega el campo 'status' con valor 'ok' y devuelve el objeto como resultado.",
|
||||
"code": "info = {}\nAddVariableToJSON(\"status\", \"ok\", info)\naddResult(info)",
|
||||
"test_inputs": {},
|
||||
"test_list": [
|
||||
"re.match(r'.*ok.*', str(info))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"source_file": "synthetic_data_generated_bedrock.json",
|
||||
"task_id": 12,
|
||||
"text": "Recibe el parámetro 'password', genera su hash MD5 y devuelve el hash como resultado.",
|
||||
"code": "addParam(\"password\", password)\nencodeMD5(password, hashed)\naddResult(hashed)",
|
||||
"test_inputs": {
|
||||
"password": "mypassword"
|
||||
},
|
||||
"test_list": [
|
||||
"re.match(r'^[a-f0-9]{32}$', str(hashed))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"source_file": "synthetic_data_generated_bedrock.json",
|
||||
"task_id": 13,
|
||||
"text": "Obtén la fecha y hora actual en formato 'YYYY-MM-DD' en la zona horaria 'UTC' y devuélvela como resultado.",
|
||||
"code": "getDateTime(\"%Y-%m-%d\", 0, \"UTC\", today)\naddResult(today)",
|
||||
"test_inputs": {},
|
||||
"test_list": [
|
||||
"re.match(r'^\\d{4}-\\d{2}-\\d{2}$', str(today))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"source_file": "synthetic_data_generated_bedrock.json",
|
||||
"task_id": 14,
|
||||
"text": "Recibe el parámetro 'epoch', conviértelo a string de fecha en formato 'YYYY-MM-DD HH:MM:SS' y devuelve el resultado.",
|
||||
"code": "addParam(\"epoch\", epoch)\nstampToDatetime(epoch, \"%Y-%m-%d %H:%M:%S\", 0, datestr)\naddResult(datestr)",
|
||||
"test_inputs": {
|
||||
"epoch": 1700000000
|
||||
},
|
||||
"test_list": [
|
||||
"re.match(r'^\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}$', str(datestr))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"source_file": "synthetic_data_generated_bedrock.json",
|
||||
"task_id": 15,
|
||||
"text": "Recibe el parámetro 'date_str' en formato 'YYYY-MM-DD', conviértelo a epoch y devuelve el epoch como resultado.",
|
||||
"code": "addParam(\"date_str\", date_str)\ngetTimeStamp(date_str, \"%Y-%m-%d\", 0, epoch)\naddResult(epoch)",
|
||||
"test_inputs": {
|
||||
"date_str": "2024-01-15"
|
||||
},
|
||||
"test_list": [
|
||||
"re.match(r'^\\d+$', str(epoch))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"source_file": "synthetic_data_generated_bedrock.json",
|
||||
"task_id": 16,
|
||||
"text": "Define una función que recibe un número y devuelve su cuadrado. Llama a la función con el parámetro 'n' y devuelve el resultado.",
|
||||
"code": "function square(n) {\nresult = n * n\nreturn(result)\n}\naddParam(\"n\", n)\nsquared = square(n)\naddResult(squared)",
|
||||
"test_inputs": {
|
||||
"n": 7
|
||||
},
|
||||
"test_list": [
|
||||
"re.match(r'^49$', str(squared))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"source_file": "synthetic_data_generated_bedrock.json",
|
||||
"task_id": 17,
|
||||
"text": "Define una función que recibe dos números y devuelve su suma. Llama a la función con los parámetros 'a' y 'b' y devuelve el resultado.",
|
||||
"code": "function add(a, b) {\nresult = a + b\nreturn(result)\n}\naddParam(\"a\", a)\naddParam(\"b\", b)\nsum = add(a, b)\naddResult(sum)",
|
||||
"test_inputs": {
|
||||
"a": 15,
|
||||
"b": 27
|
||||
},
|
||||
"test_list": [
|
||||
"re.match(r'^42$', str(sum))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"source_file": "synthetic_data_generated_bedrock.json",
|
||||
"task_id": 18,
|
||||
"text": "Usa un bloque try/exception para intentar dividir el parámetro 'num' entre 0. Si ocurre error, devuelve 'error_division'.",
|
||||
"code": "addParam(\"num\", num)\ntry()\nresult = num / 0\nexception(err)\nresult = \"error_division\"\nend()\naddResult(result)",
|
||||
"test_inputs": {
|
||||
"num": 10
|
||||
},
|
||||
"test_list": [
|
||||
"re.match(r'^error_division$', str(result))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"source_file": "synthetic_data_generated_bedrock.json",
|
||||
"task_id": 19,
|
||||
"text": "Recibe el parámetro 'url', realiza una petición GET a esa URL con timeout de 5000ms y devuelve la respuesta.",
|
||||
"code": "addParam(\"url\", url)\nRequestGet(url, \"\", \"\", response, 5000)\naddResult(response)",
|
||||
"test_inputs": {
|
||||
"url": "https://httpbin.org/get"
|
||||
},
|
||||
"test_list": [
|
||||
"re.match(r'^.*$', str(response))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"source_file": "synthetic_data_generated_bedrock.json",
|
||||
"task_id": 20,
|
||||
"text": "Recibe los parámetros 'url' y 'body', realiza una petición POST con timeout de 3000ms y devuelve la respuesta.",
|
||||
"code": "addParam(\"url\", url)\naddParam(\"body\", body)\nRequestPost(url, \"\", \"\", body, response, 3000)\naddResult(response)",
|
||||
"test_inputs": {
|
||||
"url": "https://httpbin.org/post",
|
||||
"body": "{\"key\":\"value\"}"
|
||||
},
|
||||
"test_list": [
|
||||
"re.match(r'^.*$', str(response))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"source_file": "synthetic_data_generated_bedrock.json",
|
||||
"task_id": 21,
|
||||
"text": "Instancia un conector externo con UUID '20908e93260147acb2636967021fbf5d', llama al método 'get_status' y devuelve el resultado.",
|
||||
"code": "connector = avapConnector(\"20908e93260147acb2636967021fbf5d\")\nstatus = connector.get_status()\naddResult(status)",
|
||||
"test_inputs": {},
|
||||
"test_list": [
|
||||
"re.match(r'^.*$', str(status))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"source_file": "synthetic_data_generated_bedrock.json",
|
||||
"task_id": 22,
|
||||
"text": "Lanza una función 'fetchData' de forma asíncrona con go, espera el resultado con gather (timeout 2000ms) y devuelve el resultado.",
|
||||
"code": "function fetchData() {\ndata = \"fetched\"\nreturn(data)\n}\nhandle = go fetchData()\nresult = gather(handle, 2000)\naddResult(result)",
|
||||
"test_inputs": {},
|
||||
"test_list": [
|
||||
"re.match(r'^fetched$', str(result))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"source_file": "synthetic_data_generated_bedrock.json",
|
||||
"task_id": 23,
|
||||
"text": "Recibe el parámetro 'n', itera desde 0 hasta n acumulando la suma y devuelve la suma total.",
|
||||
"code": "addParam(\"n\", n)\naccum = 0\nstartLoop(i, 0, n)\naccum = accum + i\nendLoop()\naddResult(accum)",
|
||||
"test_inputs": {
|
||||
"n": 5
|
||||
},
|
||||
"test_list": [
|
||||
"re.match(r'^10$', str(accum))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"source_file": "synthetic_data_generated_bedrock.json",
|
||||
"task_id": 24,
|
||||
"text": "Recibe el parámetro 'value'. Usando if Modo 2, si value es mayor que 0 y menor que 100, devuelve 'rango_valido'; si no, devuelve 'fuera_de_rango'.",
|
||||
"code": "addParam(\"value\", value)\nif(None, None, `value > 0 and value < 100`)\nresult = \"rango_valido\"\nelse()\nresult = \"fuera_de_rango\"\nend()\naddResult(result)",
|
||||
"test_inputs": {
|
||||
"value": 50
|
||||
},
|
||||
"test_list": [
|
||||
"re.match(r'^rango_valido$', str(result))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"source_file": "synthetic_data_generated_bedrock.json",
|
||||
"task_id": 25,
|
||||
"text": "Realiza una consulta ORM a la tabla 'users' seleccionando todos los campos sin filtro y devuelve los registros.",
|
||||
"code": "ormAccessSelect(\"*\", \"users\", \"\", records)\naddResult(records)",
|
||||
"test_inputs": {},
|
||||
"test_list": [
|
||||
"re.match(r'^.*$', str(records))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"source_file": "synthetic_data_generated_bedrock.json",
|
||||
"task_id": 26,
|
||||
"text": "Recibe los parámetros 'username' y 'email', inserta un registro en la tabla 'users' y devuelve el resultado de la inserción.",
|
||||
"code": "addParam(\"username\", username)\naddParam(\"email\", email)\nfields = {\"username\": username, \"email\": email}\normAccessInsert(fields, \"users\", insert_result)\naddResult(insert_result)",
|
||||
"test_inputs": {
|
||||
"username": "bob",
|
||||
"email": "bob@example.com"
|
||||
},
|
||||
"test_list": [
|
||||
"re.match(r'^.*$', str(insert_result))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"source_file": "synthetic_data_generated_bedrock.json",
|
||||
"task_id": 27,
|
||||
"text": "Recibe el parámetro 'user_id', actualiza el campo 'active' a 1 en la tabla 'users' donde id coincide y devuelve el resultado.",
|
||||
"code": "addParam(\"user_id\", user_id)\nfields = \"active\"\nvalues = {\"active\": 1}\nselector = \"id = \" + str(user_id)\normAccessUpdate(fields, values, \"users\", selector, update_result)\naddResult(update_result)",
|
||||
"test_inputs": {
|
||||
"user_id": 42
|
||||
},
|
||||
"test_list": [
|
||||
"re.match(r'^.*$', str(update_result))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"source_file": "synthetic_data_generated_bedrock.json",
|
||||
"task_id": 28,
|
||||
"text": "Importa la librería nativa 'math', calcula el cuadrado de 9 usando una función y devuelve el resultado.",
|
||||
"code": "import <math>\nfunction calcSquare(x) {\nresult = x * x\nreturn(result)\n}\nresult = calcSquare(9)\naddResult(result)",
|
||||
"test_inputs": {},
|
||||
"test_list": [
|
||||
"re.match(r'^81$', str(result))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"source_file": "synthetic_data_generated_bedrock.json",
|
||||
"task_id": 29,
|
||||
"text": "Recibe el parámetro 'items_json' como JSON con una lista bajo la clave 'items'. Extrae la lista, obtén su longitud y devuelve la longitud.",
|
||||
"code": "addParam(\"items_json\", items_json)\nvariableFromJSON(items_json, \"items\", items)\ngetListLen(items, length)\naddResult(length)",
|
||||
"test_inputs": {
|
||||
"items_json": "{\"items\": [\"x\", \"y\", \"z\"]}"
|
||||
},
|
||||
"test_list": [
|
||||
"re.match(r'^3$', str(length))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"source_file": "synthetic_data_generated_bedrock.json",
|
||||
"task_id": 30,
|
||||
"text": "Recibe el parámetro 'token'. Si el token tiene exactamente 32 caracteres (usando Modo 2), devuelve 'token_valido' con _status 200; si no, devuelve 'token_invalido' con _status 401.",
|
||||
"code": "addParam(\"token\", token)\nif(None, None, `len(token) == 32`)\nresult = \"token_valido\"\naddVar(_status, 200)\nelse()\nresult = \"token_invalido\"\naddVar(_status, 401)\nend()\naddResult(result)",
|
||||
"test_inputs": {
|
||||
"token": "abcdefghijklmnopqrstuvwxyz123456"
|
||||
},
|
||||
"test_list": [
|
||||
"re.match(r'^token_valido$', str(result))",
|
||||
"re.match(r'^200$', str(_status))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"source_file": "synthetic_data_human_eval_bedrock.json",
|
||||
"task_id": 52,
|
||||
"text": "Crear un endpoint que reciba una lista de números 'numbers' y un umbral 'threshold'. El endpoint debe devolver True si todos los números de la lista son estrictamente menores que el umbral, y False en caso contrario. El resultado debe exponerse como respuesta de la API con código de estado 200.",
|
||||
"code": "addParam(\"numbers\", numbers)\naddParam(\"threshold\", threshold)\nresult = True\ngetListLen(numbers, list_len)\ni = 0\nstartLoop(i, 0, list_len)\n itemFromList(numbers, i, current_item)\n current_val = int(current_item)\n thresh_val = int(threshold)\n if(None, None, `current_val >= thresh_val`)\n result = False\n end()\nendLoop()\naddResult(result)\n_status = 200",
|
||||
"test_inputs": {
|
||||
"numbers": [
|
||||
1,
|
||||
2,
|
||||
4,
|
||||
10
|
||||
],
|
||||
"threshold": 100
|
||||
},
|
||||
"test_list": [
|
||||
"re.search(r'True', str(result))",
|
||||
"re.match(r'^200$', str(_status))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"source_file": "synthetic_data_human_eval_bedrock.json",
|
||||
"task_id": 134,
|
||||
"text": "Crear un endpoint que reciba un parámetro 'txt' (cadena de texto) y devuelva True si el último carácter de la cadena es una letra alfabética y no forma parte de una palabra (es decir, el último token separado por espacios tiene longitud 1 y es una letra). En caso contrario, devuelve False. El resultado debe exponerse como respuesta de la API con código de estado 200.",
|
||||
"code": "addParam(\"txt\", txt)\nresult = False\nif(None, None, `txt == \"\" or txt == None`)\n result = False\nelse()\n replace(txt, \",\", \" \", txt_clean)\n last_word = txt_clean.split()[-1] if txt_clean.split() else \"\"\n getListLen(last_word, last_len)\n if(None, None, `last_len == 1 and last_word.lower() >= \"a\" and last_word.lower() <= \"z\"`)\n result = True\n else()\n result = False\n end()\nend()\naddResult(result)\n_status = 200",
|
||||
"test_inputs": {
|
||||
"txt": "apple pi e"
|
||||
},
|
||||
"test_list": [
|
||||
"re.search(r'True', str(result))",
|
||||
"re.match(r'^200$', str(_status))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"source_file": "synthetic_data_human_eval_bedrock.json",
|
||||
"task_id": 51,
|
||||
"text": "Crear un endpoint que reciba un parámetro 'text' (cadena de texto) y devuelva la misma cadena pero con todas las vocales (a, e, i, o, u, tanto mayúsculas como minúsculas) eliminadas. El resultado debe exponerse como respuesta de la API con código de estado 200.",
|
||||
"code": "addParam(\"text\", text)\nresult = [s for s in text if s.lower() not in [\"a\", \"e\", \"i\", \"o\", \"u\"]]\nresult_str = \"\".join(result)\naddResult(result_str)\n_status = 200",
|
||||
"test_inputs": {
|
||||
"text": "abcdef"
|
||||
},
|
||||
"test_list": [
|
||||
"re.search(r'bcdf', str(result_str))",
|
||||
"re.match(r'^200$', str(_status))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"source_file": "synthetic_data_human_eval_bedrock.json",
|
||||
"task_id": 66,
|
||||
"text": "Crear un endpoint que reciba un parámetro 's' (cadena de texto) y devuelva la suma de los códigos ASCII de todos los caracteres en mayúscula presentes en la cadena. Si la cadena está vacía, debe devolver 0. El resultado debe exponerse como respuesta de la API con código de estado 200.",
|
||||
"code": "addParam(\"s\", s)\nif(None, None, `s == \"\" or s == None`)\n digit_sum = 0\nelse()\n digit_sum = sum(ord(char) if char.isupper() else 0 for char in s)\nend()\naddResult(digit_sum)\n_status = 200",
|
||||
"test_inputs": {
|
||||
"s": "abAB"
|
||||
},
|
||||
"test_list": [
|
||||
"re.search(r'131', str(digit_sum))",
|
||||
"re.match(r'^200$', str(_status))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"source_file": "synthetic_data_human_eval_bedrock.json",
|
||||
"task_id": 147,
|
||||
"text": "Crear un endpoint que reciba un parámetro entero 'n' y construya un array a de longitud n donde a[i] = i*i - i + 1 (para i desde 1 hasta n). El endpoint debe devolver el número de tripletas (a[i], a[j], a[k]) con i < j < k tal que la suma a[i] + a[j] + a[k] sea múltiplo de 3. El resultado debe exponerse como respuesta de la API con código de estado 200.",
|
||||
"code": "addParam(\"n\", n)\nn_val = int(n)\nA = [i*i - i + 1 for i in range(1, n_val + 1)]\ncount = 0\ngetListLen(A, len_a)\ni = 0\nstartLoop(i, 0, len_a)\n j = i + 1\n startLoop(j, i + 1, len_a)\n k = j + 1\n startLoop(k, j + 1, len_a)\n itemFromList(A, i, ai)\n itemFromList(A, j, aj)\n itemFromList(A, k, ak)\n triple_sum = int(ai) + int(aj) + int(ak)\n if(None, None, `triple_sum % 3 == 0`)\n count = count + 1\n end()\n endLoop()\n endLoop()\nendLoop()\naddResult(count)\n_status = 200",
|
||||
"test_inputs": {
|
||||
"n": 5
|
||||
},
|
||||
"test_list": [
|
||||
"re.search(r'^1$', str(count))",
|
||||
"re.match(r'^200$', str(_status))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"source_file": "synthetic_data_human_eval_bedrock.json",
|
||||
"task_id": 101,
|
||||
"text": "Crear un endpoint que reciba un parámetro 's' (cadena de texto con palabras separadas por comas o espacios) y devuelva un array con las palabras individuales extraídas de la cadena. Si la cadena está vacía, debe devolver una lista vacía. El resultado debe exponerse como respuesta de la API con código de estado 200.",
|
||||
"code": "addParam(\"s\", s)\nif(None, None, `s == \"\" or s == None`)\n words = []\nelse()\n replace(s, \",\", \" \", s_clean)\n words = s_clean.split()\nend()\naddResult(words)\n_status = 200",
|
||||
"test_inputs": {
|
||||
"s": "Hi, my name is John"
|
||||
},
|
||||
"test_list": [
|
||||
"re.search(r'Hi', str(words))",
|
||||
"re.search(r'John', str(words))",
|
||||
"re.match(r'^200$', str(_status))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"source_file": "synthetic_data_human_eval_bedrock.json",
|
||||
"task_id": 24,
|
||||
"text": "Crear un endpoint que reciba un parámetro entero 'n' y devuelva el mayor divisor de n que sea estrictamente menor que n. El resultado debe exponerse como respuesta de la API con código de estado 200.",
|
||||
"code": "addParam(\"n\", n)\nn_val = int(n)\nlargest_div = 1\ni = n_val - 1\nstartLoop(i, 1, n_val)\n candidate = n_val - i\n if(None, None, `n_val % candidate == 0`)\n largest_div = candidate\n return(largest_div)\n end()\nendLoop()\naddResult(largest_div)\n_status = 200",
|
||||
"test_inputs": {
|
||||
"n": 15
|
||||
},
|
||||
"test_list": [
|
||||
"re.search(r'^5$', str(largest_div))",
|
||||
"re.match(r'^200$', str(_status))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"source_file": "synthetic_data_human_eval_bedrock.json",
|
||||
"task_id": 125,
|
||||
"text": "Crear un endpoint que reciba un parámetro 'txt' (cadena de texto) y devuelva: una lista de palabras separadas por espacios si hay espacios en el texto; una lista de palabras separadas por comas si no hay espacios pero sí comas; o el número de letras minúsculas con posición impar en el alfabeto (ord('a')=0, ord('b')=1, ...) si no hay ni espacios ni comas. El resultado debe exponerse como respuesta de la API con código de estado 200.",
|
||||
"code": "addParam(\"txt\", txt)\nif(None, None, `\" \" in txt`)\n split_result = txt.split()\nelse()\n if(None, None, `\",\" in txt`)\n replace(txt, \",\", \" \", txt_replaced)\n split_result = txt_replaced.split()\n else()\n split_result = len([i for i in txt if i.islower() and ord(i) % 2 == 0])\n end()\nend()\naddResult(split_result)\n_status = 200",
|
||||
"test_inputs": {
|
||||
"txt": "Hello world!"
|
||||
},
|
||||
"test_list": [
|
||||
"re.search(r'Hello', str(split_result))",
|
||||
"re.search(r'world!', str(split_result))",
|
||||
"re.match(r'^200$', str(_status))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"source_file": "synthetic_data_human_eval_bedrock.json",
|
||||
"task_id": 145,
|
||||
"text": "Crear un endpoint que reciba una lista de enteros 'nums' y la devuelva ordenada de forma ascendente según la suma de sus dígitos. Si varios elementos tienen la misma suma de dígitos, se mantiene su orden relativo original. El resultado debe exponerse como respuesta de la API con código de estado 200.",
|
||||
"code": "addParam(\"nums\", nums)\nfunction digits_sum(n) {\n neg = 1\n if(None, None, `n < 0`)\n n = -1 * n\n neg = -1\n end()\n digits = [int(d) for d in str(n)]\n digits[0] = digits[0] * neg\n return(sum(digits))\n}\nsorted_nums = sorted(nums, key=digits_sum)\naddResult(sorted_nums)\n_status = 200",
|
||||
"test_inputs": {
|
||||
"nums": [
|
||||
1,
|
||||
11,
|
||||
-1,
|
||||
-11,
|
||||
-12
|
||||
]
|
||||
},
|
||||
"test_list": [
|
||||
"re.search(r'-1', str(sorted_nums))",
|
||||
"re.match(r'^200$', str(_status))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"source_file": "synthetic_data_human_eval_bedrock.json",
|
||||
"task_id": 50,
|
||||
"text": "Crear un endpoint que reciba un parámetro 's' (cadena de texto codificada mediante un desplazamiento de 5 posiciones en el alfabeto) y devuelva la cadena decodificada original, revirtiendo el desplazamiento. El resultado debe exponerse como respuesta de la API con código de estado 200.",
|
||||
"code": "addParam(\"s\", s)\ndecoded = \"\".join([chr(((ord(ch) - 5 - ord(\"a\")) % 26) + ord(\"a\")) for ch in s])\naddResult(decoded)\n_status = 200",
|
||||
"test_inputs": {
|
||||
"s": "fghij"
|
||||
},
|
||||
"test_list": [
|
||||
"re.search(r'[a-z]+', str(decoded))",
|
||||
"re.match(r'^200$', str(_status))"
|
||||
]
|
||||
}
|
||||
]
|
||||
|
|
@ -0,0 +1,428 @@
|
|||
[
|
||||
{
|
||||
"passed": false,
|
||||
"error": "Command not found: getQueryParamList",
|
||||
"Local_Language_Server_Execution": "Execution Data:\n500: Internal Server Error"
|
||||
},
|
||||
{
|
||||
"passed": true,
|
||||
"error": "",
|
||||
"Local_Language_Server_Execution": {
|
||||
"status": true,
|
||||
"elapsed": 0.6782073974609375,
|
||||
"result": {
|
||||
"greeting": "Hello, Alice!"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"passed": false,
|
||||
"error": "Command not found: encodeSHA256",
|
||||
"Local_Language_Server_Execution": {
|
||||
"status": true,
|
||||
"elapsed": 0.6546368598937988,
|
||||
"result": {
|
||||
"hashed_password": "e410f9baf32634f4e0492acede51942c0b76bff30b859408acdcba3b94941f1e",
|
||||
"secure_token": "MnGg2AHegPR5CMLq2W10d8PwSQEM6EYz"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"passed": true,
|
||||
"error": "",
|
||||
"Local_Language_Server_Execution": {
|
||||
"status": true,
|
||||
"elapsed": 0.9698343276977539,
|
||||
"result": {
|
||||
"username": "alice"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"passed": true,
|
||||
"error": "",
|
||||
"Local_Language_Server_Execution": {
|
||||
"status": true,
|
||||
"elapsed": 0.9964001178741455,
|
||||
"result": {
|
||||
"email": "user@example.com"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"passed": false,
|
||||
"error": "Command not found: encodeSHA256",
|
||||
"Local_Language_Server_Execution": {
|
||||
"status": true,
|
||||
"elapsed": 0.6653525829315186,
|
||||
"result": {
|
||||
"hashed": "fcf730b6d95236ecd3c9fc2d92d7b6b2bb061514961aec041d6c7a7192f592e4"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"passed": false,
|
||||
"error": "Command not found: replace",
|
||||
"Local_Language_Server_Execution": {
|
||||
"status": true,
|
||||
"elapsed": 0.6933853626251221,
|
||||
"result": {
|
||||
"result": "hello_world_foo"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"passed": false,
|
||||
"error": "Command not found: randomString",
|
||||
"Local_Language_Server_Execution": {
|
||||
"status": true,
|
||||
"elapsed": 0.8636107444763184,
|
||||
"result": {
|
||||
"token": "RT1B5UdjhfPF0yrP72ENFdWsMOGF6Zel"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"passed": true,
|
||||
"error": "",
|
||||
"Local_Language_Server_Execution": {
|
||||
"status": true,
|
||||
"elapsed": 0.7546753883361816,
|
||||
"result": {
|
||||
"result": "adulto"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"passed": true,
|
||||
"error": "",
|
||||
"Local_Language_Server_Execution": {
|
||||
"status": true,
|
||||
"elapsed": 0.66571044921875,
|
||||
"result": {
|
||||
"result": "perfecto"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"passed": false,
|
||||
"error": "Command not found: variableToList",
|
||||
"Local_Language_Server_Execution": {
|
||||
"status": true,
|
||||
"elapsed": 1.0307579040527344,
|
||||
"result": {
|
||||
"length": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"passed": false,
|
||||
"error": "Command not found: getQueryParamList",
|
||||
"Local_Language_Server_Execution": "Errors encountered:"
|
||||
},
|
||||
{
|
||||
"passed": false,
|
||||
"error": "Command not found: variableFromJSON",
|
||||
"Local_Language_Server_Execution": {
|
||||
"status": true,
|
||||
"elapsed": 0.6620609760284424,
|
||||
"result": {
|
||||
"name": "Carlos"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"passed": false,
|
||||
"error": "Command not found: AddVariableToJSON",
|
||||
"Local_Language_Server_Execution": "Errors encountered:"
|
||||
},
|
||||
{
|
||||
"passed": false,
|
||||
"error": "Command not found: encodeMD5",
|
||||
"Local_Language_Server_Execution": {
|
||||
"status": true,
|
||||
"elapsed": 0.6491982936859131,
|
||||
"result": {
|
||||
"hashed": "5f4dcc3b5aa765d61d8327deb882cf99"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"passed": false,
|
||||
"error": "Command not found: getDateTime",
|
||||
"Local_Language_Server_Execution": {
|
||||
"status": true,
|
||||
"elapsed": 0.6737937927246094,
|
||||
"result": {
|
||||
"today": "2026-03-30"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"passed": false,
|
||||
"error": "Command not found: stampToDatetime",
|
||||
"Local_Language_Server_Execution": {
|
||||
"status": false,
|
||||
"elapsed": 0.7022957801818848,
|
||||
"Errors:": [
|
||||
"Variable datestr not defined at line: 3"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"passed": false,
|
||||
"error": "Command not found: getTimeStamp",
|
||||
"Local_Language_Server_Execution": {
|
||||
"status": true,
|
||||
"elapsed": 0.927962064743042,
|
||||
"result": {
|
||||
"epoch": 1705276800
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"passed": true,
|
||||
"error": "",
|
||||
"Local_Language_Server_Execution": {
|
||||
"status": true,
|
||||
"elapsed": 0.6997628211975098,
|
||||
"result": {
|
||||
"squared": 49
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"passed": true,
|
||||
"error": "",
|
||||
"Local_Language_Server_Execution": {
|
||||
"status": true,
|
||||
"elapsed": 0.6906683444976807,
|
||||
"result": {
|
||||
"sum": "None"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"passed": true,
|
||||
"error": "",
|
||||
"Local_Language_Server_Execution": "Execution Data:\n500: Internal Server Error"
|
||||
},
|
||||
{
|
||||
"passed": true,
|
||||
"error": "",
|
||||
"Local_Language_Server_Execution": "Errors encountered: \nVariable response not defined at line: 3"
|
||||
},
|
||||
{
|
||||
"passed": true,
|
||||
"error": "",
|
||||
"Local_Language_Server_Execution": "Execution encountered: \nVariable response not defined at line: 4"
|
||||
},
|
||||
{
|
||||
"passed": false,
|
||||
"error": "Command not found: avapConnector",
|
||||
"Local_Language_Server_Execution": {
|
||||
"status": false,
|
||||
"elapsed": 1.0673284530639648,
|
||||
"Errors:": [
|
||||
"Variable status not defined at line: 3"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"passed": true,
|
||||
"error": "",
|
||||
"Local_Language_Server_Execution": {
|
||||
"status": true,
|
||||
"elapsed": 0.7820870876312256,
|
||||
"result": {
|
||||
"result": "fetched"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"passed": false,
|
||||
"error": "",
|
||||
"Local_Language_Server_Execution": {
|
||||
"status": true,
|
||||
"elapsed": 0.8281633853912354,
|
||||
"result": {
|
||||
"accum": 15
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"passed": false,
|
||||
"error": "",
|
||||
"Local_Language_Server_Execution": {
|
||||
"status": true,
|
||||
"elapsed": 0.7174324989318848,
|
||||
"result": {
|
||||
"result": "rango_valido"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"passed": false,
|
||||
"error": "Command not found: ormAccessSelect",
|
||||
"Local_Language_Server_Execution": {
|
||||
"status": false,
|
||||
"elapsed": 0.6810524463653564,
|
||||
"Errors:": [
|
||||
"'ProjectDatabase' object has no attribute 'conexion' at line: 1"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"passed": false,
|
||||
"error": "Command not found: ormAccessInsert",
|
||||
"Local_Language_Server_Execution": "Errors encountered: Variable insert_result not defined at line: 5"
|
||||
},
|
||||
{
|
||||
"passed": false,
|
||||
"error": "Command not found: ormAccessUpdate",
|
||||
"Local_Language_Server_Execution": {
|
||||
"status": false,
|
||||
"elapsed": 0.7697818279266357,
|
||||
"Errors:": [
|
||||
"Variable update_result not defined at line: 6"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"passed": true,
|
||||
"error": "",
|
||||
"Local_Language_Server_Execution": "Errors encountered:"
|
||||
},
|
||||
{
|
||||
"passed": false,
|
||||
"error": "Command not found: variableFromJSON",
|
||||
"Local_Language_Server_Execution": {
|
||||
"status": true,
|
||||
"elapsed": 0.7087039947509766,
|
||||
"result": {
|
||||
"length": 3
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"passed": false,
|
||||
"error": "",
|
||||
"Local_Language_Server_Execution": {
|
||||
"status": true,
|
||||
"elapsed": 0.7014470100402832,
|
||||
"result": {
|
||||
"result": "token_valido"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"passed": false,
|
||||
"error": "Command not found: getListLen",
|
||||
"Local_Language_Server_Execution": {
|
||||
"status": true,
|
||||
"elapsed": 0.7706844806671143,
|
||||
"result": {
|
||||
"result": true
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"passed": false,
|
||||
"error": "Command not found: replace",
|
||||
"Local_Language_Server_Execution": {
|
||||
"status": true,
|
||||
"elapsed": 0.7992682456970215,
|
||||
"result": {
|
||||
"result": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"passed": false,
|
||||
"error": "",
|
||||
"Local_Language_Server_Execution": {
|
||||
"status": true,
|
||||
"elapsed": 0.6971292495727539,
|
||||
"result": {
|
||||
"result_str": "bcdf"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"passed": false,
|
||||
"error": "",
|
||||
"Local_Language_Server_Execution": {
|
||||
"status": true,
|
||||
"elapsed": 0.6751101016998291,
|
||||
"result": {
|
||||
"digit_sum": 131
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"passed": false,
|
||||
"error": "Command not found: int",
|
||||
"Local_Language_Server_Execution": {
|
||||
"status": true,
|
||||
"elapsed": 0.7301974296569824,
|
||||
"result": {
|
||||
"count": 0
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"passed": false,
|
||||
"error": "Command not found: replace",
|
||||
"Local_Language_Server_Execution": {
|
||||
"status": false,
|
||||
"elapsed": 0.8365917205810547,
|
||||
"Errors:": [
|
||||
"Variable words not defined at line: 8"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"passed": false,
|
||||
"error": "Command not found: int",
|
||||
"Local_Language_Server_Execution": {
|
||||
"status": false,
|
||||
"elapsed": 1.0710501670837402,
|
||||
"Errors:": [
|
||||
"integer division or modulo by zero at line: 7 integer division or modulo by zero at line: 7"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"passed": false,
|
||||
"error": "",
|
||||
"Local_Language_Server_Execution": {
|
||||
"status": false,
|
||||
"elapsed": 0.6991498470306396,
|
||||
"Errors:": [
|
||||
"unterminated string literal (detected at line 1) (, line 1) at line: 9"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"passed": false,
|
||||
"error": "Command not found: sorted",
|
||||
"Local_Language_Server_Execution": {
|
||||
"status": true,
|
||||
"elapsed": 0.7440598011016846,
|
||||
"result": {
|
||||
"sorted_nums": "None"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"passed": false,
|
||||
"error": "",
|
||||
"Local_Language_Server_Execution": {
|
||||
"status": true,
|
||||
"elapsed": 0.7263014316558838,
|
||||
"result": {
|
||||
"decoded": "abcde"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
@ -0,0 +1,863 @@
|
|||
[
|
||||
{
|
||||
"execution_message": {
|
||||
"success": false,
|
||||
"error": "Command not found: getQueryParamList"
|
||||
}
|
||||
},
|
||||
{
|
||||
"execution_message": {
|
||||
"success": true,
|
||||
"result": {
|
||||
"greeting": "Hello, Alice!"
|
||||
},
|
||||
"variables": {
|
||||
"message": "Alice",
|
||||
"greeting": "Hello, Alice!",
|
||||
"_status": 200
|
||||
},
|
||||
"assertion_result": true,
|
||||
"logs": [
|
||||
{
|
||||
"command": "addParam",
|
||||
"duration_ms": 0.212,
|
||||
"success": true
|
||||
},
|
||||
{
|
||||
"command": "if",
|
||||
"duration_ms": 0.28800000000000003,
|
||||
"success": true
|
||||
},
|
||||
{
|
||||
"command": "addResult",
|
||||
"duration_ms": 0.049,
|
||||
"success": true
|
||||
},
|
||||
{
|
||||
"command": "assign",
|
||||
"duration_ms": 0.024,
|
||||
"success": true
|
||||
}
|
||||
],
|
||||
"http_status": 200
|
||||
}
|
||||
},
|
||||
{
|
||||
"execution_message": {
|
||||
"success": false,
|
||||
"error": "Command not found: encodeSHA256"
|
||||
}
|
||||
},
|
||||
{
|
||||
"execution_message": {
|
||||
"success": true,
|
||||
"result": {
|
||||
"username": "alice"
|
||||
},
|
||||
"variables": {
|
||||
"username": "alice"
|
||||
},
|
||||
"assertion_result": true,
|
||||
"logs": [
|
||||
{
|
||||
"command": "addParam",
|
||||
"duration_ms": 0.13999999999999999,
|
||||
"success": true
|
||||
},
|
||||
{
|
||||
"command": "addResult",
|
||||
"duration_ms": 0.034999999999999996,
|
||||
"success": true
|
||||
}
|
||||
],
|
||||
"http_status": 200
|
||||
}
|
||||
},
|
||||
{
|
||||
"execution_message": {
|
||||
"success": true,
|
||||
"result": {
|
||||
"email": "user@example.com"
|
||||
},
|
||||
"variables": {
|
||||
"email": "user@example.com",
|
||||
"_status": 200
|
||||
},
|
||||
"assertion_result": true,
|
||||
"logs": [
|
||||
{
|
||||
"command": "addParam",
|
||||
"duration_ms": 0.146,
|
||||
"success": true
|
||||
},
|
||||
{
|
||||
"command": "addVar",
|
||||
"duration_ms": 0.074,
|
||||
"success": true
|
||||
},
|
||||
{
|
||||
"command": "addResult",
|
||||
"duration_ms": 0.034,
|
||||
"success": true
|
||||
}
|
||||
],
|
||||
"http_status": 200
|
||||
}
|
||||
},
|
||||
{
|
||||
"execution_message": {
|
||||
"success": false,
|
||||
"error": "Command not found: encodeSHA256"
|
||||
}
|
||||
},
|
||||
{
|
||||
"execution_message": {
|
||||
"success": false,
|
||||
"error": "Command not found: replace"
|
||||
}
|
||||
},
|
||||
{
|
||||
"execution_message": {
|
||||
"success": false,
|
||||
"error": "Command not found: randomString"
|
||||
}
|
||||
},
|
||||
{
|
||||
"execution_message": {
|
||||
"success": true,
|
||||
"result": {
|
||||
"result": "adulto"
|
||||
},
|
||||
"variables": {
|
||||
"age": "25",
|
||||
"result": "adulto"
|
||||
},
|
||||
"assertion_result": true,
|
||||
"logs": [
|
||||
{
|
||||
"command": "addParam",
|
||||
"duration_ms": 0.175,
|
||||
"success": true
|
||||
},
|
||||
{
|
||||
"command": "if",
|
||||
"duration_ms": 0.219,
|
||||
"success": true
|
||||
},
|
||||
{
|
||||
"command": "addResult",
|
||||
"duration_ms": 0.048,
|
||||
"success": true
|
||||
}
|
||||
],
|
||||
"http_status": 200
|
||||
}
|
||||
},
|
||||
{
|
||||
"execution_message": {
|
||||
"success": true,
|
||||
"result": {
|
||||
"result": "perfecto"
|
||||
},
|
||||
"variables": {
|
||||
"score": "100",
|
||||
"_status": 200,
|
||||
"result": "perfecto"
|
||||
},
|
||||
"assertion_result": true,
|
||||
"logs": [
|
||||
{
|
||||
"command": "addParam",
|
||||
"duration_ms": 0.187,
|
||||
"success": true
|
||||
},
|
||||
{
|
||||
"command": "if",
|
||||
"duration_ms": 0.876,
|
||||
"success": true
|
||||
},
|
||||
{
|
||||
"command": "addResult",
|
||||
"duration_ms": 0.09000000000000001,
|
||||
"success": true
|
||||
}
|
||||
],
|
||||
"http_status": 200
|
||||
}
|
||||
},
|
||||
{
|
||||
"execution_message": {
|
||||
"success": false,
|
||||
"error": "Command not found: variableToList"
|
||||
}
|
||||
},
|
||||
{
|
||||
"execution_message": {
|
||||
"success": false,
|
||||
"error": "Command not found: getQueryParamList"
|
||||
}
|
||||
},
|
||||
{
|
||||
"execution_message": {
|
||||
"success": false,
|
||||
"error": "Command not found: variableFromJSON"
|
||||
}
|
||||
},
|
||||
{
|
||||
"execution_message": {
|
||||
"success": false,
|
||||
"error": "Command not found: AddVariableToJSON"
|
||||
}
|
||||
},
|
||||
{
|
||||
"execution_message": {
|
||||
"success": false,
|
||||
"error": "Command not found: encodeMD5"
|
||||
}
|
||||
},
|
||||
{
|
||||
"execution_message": {
|
||||
"success": false,
|
||||
"error": "Command not found: getDateTime"
|
||||
}
|
||||
},
|
||||
{
|
||||
"execution_message": {
|
||||
"success": false,
|
||||
"error": "Command not found: stampToDatetime"
|
||||
}
|
||||
},
|
||||
{
|
||||
"execution_message": {
|
||||
"success": false,
|
||||
"error": "Command not found: getTimeStamp"
|
||||
}
|
||||
},
|
||||
{
|
||||
"execution_message": {
|
||||
"success": true,
|
||||
"result": {
|
||||
"squared": 49
|
||||
},
|
||||
"variables": {
|
||||
"n": "7",
|
||||
"result": 49,
|
||||
"squared": 49
|
||||
},
|
||||
"assertion_result": true,
|
||||
"logs": [
|
||||
{
|
||||
"command": "addParam",
|
||||
"duration_ms": 0.177,
|
||||
"success": true
|
||||
},
|
||||
{
|
||||
"command": "square",
|
||||
"duration_ms": 0.094,
|
||||
"success": true
|
||||
},
|
||||
{
|
||||
"command": "addResult",
|
||||
"duration_ms": 0.038,
|
||||
"success": true
|
||||
}
|
||||
],
|
||||
"http_status": 200
|
||||
}
|
||||
},
|
||||
{
|
||||
"execution_message": {
|
||||
"success": true,
|
||||
"result": {
|
||||
"sum": 42
|
||||
},
|
||||
"variables": {
|
||||
"a": "15",
|
||||
"b": "27",
|
||||
"result": 42,
|
||||
"sum": 42
|
||||
},
|
||||
"assertion_result": true,
|
||||
"logs": [
|
||||
{
|
||||
"command": "addParam",
|
||||
"duration_ms": 0.253,
|
||||
"success": true
|
||||
},
|
||||
{
|
||||
"command": "addParam",
|
||||
"duration_ms": 0.060000000000000005,
|
||||
"success": true
|
||||
},
|
||||
{
|
||||
"command": "add",
|
||||
"duration_ms": 0.154,
|
||||
"success": true
|
||||
},
|
||||
{
|
||||
"command": "addResult",
|
||||
"duration_ms": 0.054,
|
||||
"success": true
|
||||
}
|
||||
],
|
||||
"http_status": 200
|
||||
}
|
||||
},
|
||||
{
|
||||
"execution_message": {
|
||||
"success": true,
|
||||
"result": {
|
||||
"result": "error_division"
|
||||
},
|
||||
"variables": {
|
||||
"num": "10",
|
||||
"result": "error_division",
|
||||
"err": "No error detected"
|
||||
},
|
||||
"assertion_result": true,
|
||||
"logs": [
|
||||
{
|
||||
"command": "addParam",
|
||||
"duration_ms": 0.17,
|
||||
"success": true
|
||||
},
|
||||
{
|
||||
"command": "try",
|
||||
"duration_ms": 0.04,
|
||||
"success": true
|
||||
},
|
||||
{
|
||||
"command": "assign",
|
||||
"duration_ms": 0.064,
|
||||
"success": true
|
||||
},
|
||||
{
|
||||
"command": "exception",
|
||||
"duration_ms": 0.041,
|
||||
"success": true
|
||||
},
|
||||
{
|
||||
"command": "assign",
|
||||
"duration_ms": 0.024,
|
||||
"success": true
|
||||
},
|
||||
{
|
||||
"command": "addResult",
|
||||
"duration_ms": 0.033,
|
||||
"success": true
|
||||
}
|
||||
],
|
||||
"http_status": 200
|
||||
}
|
||||
},
|
||||
{
|
||||
"execution_message": {
|
||||
"success": true,
|
||||
"result": {
|
||||
"response": {
|
||||
"args": {},
|
||||
"headers": {
|
||||
"Accept": "*/*",
|
||||
"Accept-Encoding": "gzip, deflate",
|
||||
"Host": "httpbin.org",
|
||||
"User-Agent": "python-requests/2.33.0",
|
||||
"X-Amzn-Trace-Id": "Root=1-69ca35f3-7a7ea392014f0bf41a77473b"
|
||||
},
|
||||
"origin": "207.246.65.119",
|
||||
"url": "https://httpbin.org/get"
|
||||
}
|
||||
},
|
||||
"variables": {
|
||||
"url": "https://httpbin.org/get",
|
||||
"response": {
|
||||
"args": {},
|
||||
"headers": {
|
||||
"Accept": "*/*",
|
||||
"Accept-Encoding": "gzip, deflate",
|
||||
"Host": "httpbin.org",
|
||||
"User-Agent": "python-requests/2.33.0",
|
||||
"X-Amzn-Trace-Id": "Root=1-69ca35f3-7a7ea392014f0bf41a77473b"
|
||||
},
|
||||
"origin": "207.246.65.119",
|
||||
"url": "https://httpbin.org/get"
|
||||
}
|
||||
},
|
||||
"assertion_result": true,
|
||||
"logs": [
|
||||
{
|
||||
"command": "addParam",
|
||||
"duration_ms": 0.185,
|
||||
"success": true
|
||||
},
|
||||
{
|
||||
"command": "RequestGet",
|
||||
"duration_ms": 202.913,
|
||||
"success": true
|
||||
},
|
||||
{
|
||||
"command": "addResult",
|
||||
"duration_ms": 0.11299999999999999,
|
||||
"success": true
|
||||
}
|
||||
],
|
||||
"http_status": 200
|
||||
}
|
||||
},
|
||||
{
|
||||
"execution_message": {
|
||||
"success": true,
|
||||
"result": {
|
||||
"response": {
|
||||
"args": {},
|
||||
"data": "{\"key\": \"value\"}",
|
||||
"files": {},
|
||||
"form": {},
|
||||
"headers": {
|
||||
"Accept": "*/*",
|
||||
"Accept-Encoding": "gzip, deflate",
|
||||
"Content-Length": "16",
|
||||
"Content-Type": "application/json",
|
||||
"Host": "httpbin.org",
|
||||
"User-Agent": "python-requests/2.33.0",
|
||||
"X-Amzn-Trace-Id": "Root=1-69ca35f3-5a51fec722c2fa6d70f35792"
|
||||
},
|
||||
"json": {
|
||||
"key": "value"
|
||||
},
|
||||
"origin": "207.246.65.119",
|
||||
"url": "https://httpbin.org/post"
|
||||
}
|
||||
},
|
||||
"variables": {
|
||||
"url": "https://httpbin.org/post",
|
||||
"body": "{\"key\":\"value\"}",
|
||||
"response": {
|
||||
"args": {},
|
||||
"data": "{\"key\": \"value\"}",
|
||||
"files": {},
|
||||
"form": {},
|
||||
"headers": {
|
||||
"Accept": "*/*",
|
||||
"Accept-Encoding": "gzip, deflate",
|
||||
"Content-Length": "16",
|
||||
"Content-Type": "application/json",
|
||||
"Host": "httpbin.org",
|
||||
"User-Agent": "python-requests/2.33.0",
|
||||
"X-Amzn-Trace-Id": "Root=1-69ca35f3-5a51fec722c2fa6d70f35792"
|
||||
},
|
||||
"json": {
|
||||
"key": "value"
|
||||
},
|
||||
"origin": "207.246.65.119",
|
||||
"url": "https://httpbin.org/post"
|
||||
}
|
||||
},
|
||||
"assertion_result": true,
|
||||
"logs": [
|
||||
{
|
||||
"command": "addParam",
|
||||
"duration_ms": 0.7879999999999999,
|
||||
"success": true
|
||||
},
|
||||
{
|
||||
"command": "addParam",
|
||||
"duration_ms": 0.062,
|
||||
"success": true
|
||||
},
|
||||
{
|
||||
"command": "RequestPost",
|
||||
"duration_ms": 125.87499999999999,
|
||||
"success": true
|
||||
},
|
||||
{
|
||||
"command": "addResult",
|
||||
"duration_ms": 0.135,
|
||||
"success": true
|
||||
}
|
||||
],
|
||||
"http_status": 200
|
||||
}
|
||||
},
|
||||
{
|
||||
"execution_message": {
|
||||
"success": false,
|
||||
"error": "Command not found: avapConnector"
|
||||
}
|
||||
},
|
||||
{
|
||||
"execution_message": {
|
||||
"success": true,
|
||||
"result": {
|
||||
"result": "fetched"
|
||||
},
|
||||
"variables": {
|
||||
"handle": "7f1d86b7-f253-4b74-8f2c-34a65099713e",
|
||||
"data": "fetched",
|
||||
"result": "fetched"
|
||||
},
|
||||
"assertion_result": true,
|
||||
"logs": [
|
||||
{
|
||||
"command": "go",
|
||||
"duration_ms": 1.2489999999999999,
|
||||
"success": true
|
||||
},
|
||||
{
|
||||
"command": "gather",
|
||||
"duration_ms": 0.40900000000000003,
|
||||
"success": true
|
||||
},
|
||||
{
|
||||
"command": "addResult",
|
||||
"duration_ms": 0.11699999999999999,
|
||||
"success": true
|
||||
}
|
||||
],
|
||||
"http_status": 200
|
||||
}
|
||||
},
|
||||
{
|
||||
"execution_message": {
|
||||
"success": true,
|
||||
"result": {
|
||||
"accum": 15
|
||||
},
|
||||
"variables": {
|
||||
"n": "5",
|
||||
"accum": 15,
|
||||
"i": 5
|
||||
},
|
||||
"assertion_result": false,
|
||||
"logs": [
|
||||
{
|
||||
"command": "addParam",
|
||||
"duration_ms": 0.148,
|
||||
"success": true
|
||||
},
|
||||
{
|
||||
"command": "assign",
|
||||
"duration_ms": 0.047,
|
||||
"success": true
|
||||
},
|
||||
{
|
||||
"command": "startLoop",
|
||||
"duration_ms": 0.155,
|
||||
"success": true
|
||||
},
|
||||
{
|
||||
"command": "addResult",
|
||||
"duration_ms": 0.056,
|
||||
"success": true
|
||||
}
|
||||
],
|
||||
"http_status": 200
|
||||
}
|
||||
},
|
||||
{
|
||||
"execution_message": {
|
||||
"success": true,
|
||||
"result": {
|
||||
"result": "fuera_de_rango"
|
||||
},
|
||||
"variables": {
|
||||
"value": "50",
|
||||
"result": "fuera_de_rango"
|
||||
},
|
||||
"assertion_result": false,
|
||||
"logs": [
|
||||
{
|
||||
"command": "addParam",
|
||||
"duration_ms": 0.202,
|
||||
"success": true
|
||||
},
|
||||
{
|
||||
"command": "if",
|
||||
"duration_ms": 0.781,
|
||||
"success": true
|
||||
},
|
||||
{
|
||||
"command": "addResult",
|
||||
"duration_ms": 0.092,
|
||||
"success": true
|
||||
}
|
||||
],
|
||||
"http_status": 200
|
||||
}
|
||||
},
|
||||
{
|
||||
"execution_message": {
|
||||
"success": false,
|
||||
"error": "Command not found: ormAccessSelect"
|
||||
}
|
||||
},
|
||||
{
|
||||
"execution_message": {
|
||||
"success": false,
|
||||
"error": "Command not found: ormAccessInsert"
|
||||
}
|
||||
},
|
||||
{
|
||||
"execution_message": {
|
||||
"success": false,
|
||||
"error": "Command not found: ormAccessUpdate"
|
||||
}
|
||||
},
|
||||
{
|
||||
"execution_message": {
|
||||
"success": true,
|
||||
"result": {
|
||||
"result": 81
|
||||
},
|
||||
"variables": {
|
||||
"result": 81
|
||||
},
|
||||
"assertion_result": true,
|
||||
"logs": [
|
||||
{
|
||||
"command": "calcSquare",
|
||||
"duration_ms": 0.13699999999999998,
|
||||
"success": true
|
||||
},
|
||||
{
|
||||
"command": "addResult",
|
||||
"duration_ms": 0.146,
|
||||
"success": true
|
||||
}
|
||||
],
|
||||
"http_status": 200
|
||||
}
|
||||
},
|
||||
{
|
||||
"execution_message": {
|
||||
"success": false,
|
||||
"error": "Command not found: variableFromJSON"
|
||||
}
|
||||
},
|
||||
{
|
||||
"execution_message": {
|
||||
"success": true,
|
||||
"result": {
|
||||
"result": "token_invalido"
|
||||
},
|
||||
"variables": {
|
||||
"token": "abcdefghijklmnopqrstuvwxyz123456",
|
||||
"result": "token_invalido",
|
||||
"_status": 401
|
||||
},
|
||||
"assertion_result": false,
|
||||
"logs": [
|
||||
{
|
||||
"command": "addParam",
|
||||
"duration_ms": 0.203,
|
||||
"success": true
|
||||
},
|
||||
{
|
||||
"command": "if",
|
||||
"duration_ms": 1.175,
|
||||
"success": true
|
||||
},
|
||||
{
|
||||
"command": "addResult",
|
||||
"duration_ms": 0.32,
|
||||
"success": true
|
||||
}
|
||||
],
|
||||
"http_status": 401
|
||||
}
|
||||
},
|
||||
{
|
||||
"execution_message": {
|
||||
"success": false,
|
||||
"error": "Command not found: getListLen"
|
||||
}
|
||||
},
|
||||
{
|
||||
"execution_message": {
|
||||
"success": false,
|
||||
"error": "Command not found: replace"
|
||||
}
|
||||
},
|
||||
{
|
||||
"execution_message": {
|
||||
"success": true,
|
||||
"result": {
|
||||
"result_str": null
|
||||
},
|
||||
"variables": {
|
||||
"text": "abcdef",
|
||||
"result": [
|
||||
"b",
|
||||
"c",
|
||||
"d",
|
||||
"f"
|
||||
],
|
||||
"result_str": null,
|
||||
"_status": 200
|
||||
},
|
||||
"assertion_result": false,
|
||||
"logs": [
|
||||
{
|
||||
"command": "addParam",
|
||||
"duration_ms": 0.18100000000000002,
|
||||
"success": true
|
||||
},
|
||||
{
|
||||
"command": "assign",
|
||||
"duration_ms": 0.13799999999999998,
|
||||
"success": true
|
||||
},
|
||||
{
|
||||
"command": "connector_call",
|
||||
"duration_ms": 0.003,
|
||||
"success": true
|
||||
},
|
||||
{
|
||||
"command": "addResult",
|
||||
"duration_ms": 0.046,
|
||||
"success": true
|
||||
},
|
||||
{
|
||||
"command": "assign",
|
||||
"duration_ms": 0.032,
|
||||
"success": true
|
||||
}
|
||||
],
|
||||
"http_status": 200
|
||||
}
|
||||
},
|
||||
{
|
||||
"execution_message": {
|
||||
"success": true,
|
||||
"result": {
|
||||
"digit_sum": null
|
||||
},
|
||||
"variables": {
|
||||
"s": "abAB",
|
||||
"digit_sum": null,
|
||||
"_status": 200
|
||||
},
|
||||
"assertion_result": false,
|
||||
"logs": [
|
||||
{
|
||||
"command": "addParam",
|
||||
"duration_ms": 0.16,
|
||||
"success": true
|
||||
},
|
||||
{
|
||||
"command": "if",
|
||||
"duration_ms": 0.19699999999999998,
|
||||
"success": true
|
||||
},
|
||||
{
|
||||
"command": "addResult",
|
||||
"duration_ms": 0.037,
|
||||
"success": true
|
||||
},
|
||||
{
|
||||
"command": "assign",
|
||||
"duration_ms": 0.044,
|
||||
"success": true
|
||||
}
|
||||
],
|
||||
"http_status": 200
|
||||
}
|
||||
},
|
||||
{
|
||||
"execution_message": {
|
||||
"success": false,
|
||||
"error": "Command not found: int"
|
||||
}
|
||||
},
|
||||
{
|
||||
"execution_message": {
|
||||
"success": false,
|
||||
"error": "Command not found: replace"
|
||||
}
|
||||
},
|
||||
{
|
||||
"execution_message": {
|
||||
"success": false,
|
||||
"error": "Command not found: int"
|
||||
}
|
||||
},
|
||||
{
|
||||
"execution_message": {
|
||||
"success": true,
|
||||
"result": {
|
||||
"split_result": null
|
||||
},
|
||||
"variables": {
|
||||
"txt": "Hello world!",
|
||||
"split_result": null,
|
||||
"_status": 200
|
||||
},
|
||||
"assertion_result": false,
|
||||
"logs": [
|
||||
{
|
||||
"command": "addParam",
|
||||
"duration_ms": 0.501,
|
||||
"success": true
|
||||
},
|
||||
{
|
||||
"command": "if",
|
||||
"duration_ms": 0.281,
|
||||
"success": true
|
||||
},
|
||||
{
|
||||
"command": "addResult",
|
||||
"duration_ms": 0.038,
|
||||
"success": true
|
||||
},
|
||||
{
|
||||
"command": "assign",
|
||||
"duration_ms": 0.047,
|
||||
"success": true
|
||||
}
|
||||
],
|
||||
"http_status": 200
|
||||
}
|
||||
},
|
||||
{
|
||||
"execution_message": {
|
||||
"success": false,
|
||||
"error": "Command not found: sorted"
|
||||
}
|
||||
},
|
||||
{
|
||||
"execution_message": {
|
||||
"success": true,
|
||||
"result": {
|
||||
"decoded": null
|
||||
},
|
||||
"variables": {
|
||||
"s": "fghij",
|
||||
"decoded": null,
|
||||
"_status": 200
|
||||
},
|
||||
"assertion_result": false,
|
||||
"logs": [
|
||||
{
|
||||
"command": "addParam",
|
||||
"duration_ms": 0.158,
|
||||
"success": true
|
||||
},
|
||||
{
|
||||
"command": "connector_call",
|
||||
"duration_ms": 0.003,
|
||||
"success": true
|
||||
},
|
||||
{
|
||||
"command": "addResult",
|
||||
"duration_ms": 0.034,
|
||||
"success": true
|
||||
},
|
||||
{
|
||||
"command": "assign",
|
||||
"duration_ms": 0.046,
|
||||
"success": true
|
||||
}
|
||||
],
|
||||
"http_status": 200
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
@ -1 +1,4 @@
|
|||
variableToList(1, myList)
|
||||
addParam("datos", lista_entrada)
|
||||
getListLen(lista_entrada, longitud)
|
||||
addVar(_status, 200)
|
||||
addResult(longitud)
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 7,
|
||||
"execution_count": null,
|
||||
"id": "c46228bd",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
|
|
@ -12,38 +12,636 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 8,
|
||||
"execution_count": null,
|
||||
"id": "91c20032",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"variableToList(\"a\", myList)\n",
|
||||
"AddVariableToJSON(\"1\", \"b\", myList)\n",
|
||||
"AddVariableToJSON(\"2\", \"c\", myList)\n",
|
||||
"getListLen(myList, total)\n",
|
||||
"addResult(total)\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"print(code)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 1,
|
||||
"id": "64d5e9d4",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"=== Task 1 | success: False ===\n",
|
||||
"addParam('user_list', user_data)\n",
|
||||
"getQueryParamList('emails', email_list)\n",
|
||||
"addVar(valid_count, 0)\n",
|
||||
"addVar(invalid_count, 0)\n",
|
||||
"addVar(processed_emails, [])\n",
|
||||
"try()\n",
|
||||
" getListLen(email_list, total_emails)\n",
|
||||
" if(total_emails, 0, \">\")\n",
|
||||
" addVar(i, 0)\n",
|
||||
" startLoop(counter, 0, total_emails)\n",
|
||||
" itemFromList(email_list, i, current_email)\n",
|
||||
" getRegex(current_email, \"^[\\\\w\\\\.-]+@[\\\\w\\\\.-]+\\\\.[a-zA-Z]{2,}$\", email_match)\n",
|
||||
" if(None, None, `email_match != None`)\n",
|
||||
" addVar(valid_count, valid_count + 1)\n",
|
||||
" replace(current_email, \" \", \"\", clean_email)\n",
|
||||
" variableToList(clean_email, temp_list)\n",
|
||||
" AddVariableToJSON(\"email\", clean_email, email_obj)\n",
|
||||
" AddVariableToJSON(\"status\", \"valid\", email_obj)\n",
|
||||
" else()\n",
|
||||
" addVar(invalid_count, invalid_count + 1)\n",
|
||||
" AddVariableToJSON(\"email\", current_email, email_obj)\n",
|
||||
" AddVariableToJSON(\"status\", \"invalid\", email_obj)\n",
|
||||
" end()\n",
|
||||
" addVar(i, i + 1)\n",
|
||||
" endLoop()\n",
|
||||
" AddVariableToJSON(\"total_processed\", total_emails, report)\n",
|
||||
" AddVariableToJSON(\"valid_emails\", valid_count, report)\n",
|
||||
" AddVariableToJSON(\"invalid_emails\", invalid_count, report)\n",
|
||||
" if(valid_count, 0, \">\")\n",
|
||||
" addVar(_status, 200)\n",
|
||||
" else()\n",
|
||||
" addVar(_status, 422)\n",
|
||||
" end()\n",
|
||||
" else()\n",
|
||||
" AddVariableToJSON(\"error\", \"No emails provided\", report)\n",
|
||||
" addVar(_status, 400)\n",
|
||||
" end()\n",
|
||||
"exception(error_var)\n",
|
||||
" AddVariableToJSON(\"error\", \"Processing failed\", report)\n",
|
||||
" addVar(_status, 500)\n",
|
||||
"end()\n",
|
||||
"addResult(report)\n",
|
||||
"\n",
|
||||
"=== Task 1 | success: True ===\n",
|
||||
"addParam(\"message\", message)\n",
|
||||
"if(message, None, \"=\")\n",
|
||||
" greeting = \"Hello, World!\"\n",
|
||||
"else()\n",
|
||||
" greeting = \"Hello, \" + message + \"!\"\n",
|
||||
"end()\n",
|
||||
"addResult(greeting)\n",
|
||||
"_status = 200\n",
|
||||
"\n",
|
||||
"=== Task 2 | success: False ===\n",
|
||||
"addParam(\"password\", password)\n",
|
||||
"encodeSHA256(password, hashed_password)\n",
|
||||
"randomString(\"[a-zA-Z0-9]\", 32, secure_token)\n",
|
||||
"addResult(hashed_password)\n",
|
||||
"addResult(secure_token)\n",
|
||||
"\n",
|
||||
"=== Task 1 | success: True ===\n",
|
||||
"addParam(\"username\", username)\n",
|
||||
"addResult(username)\n",
|
||||
"\n",
|
||||
"=== Task 2 | success: True ===\n",
|
||||
"addParam(\"email\", email)\n",
|
||||
"addVar(_status, 200)\n",
|
||||
"addResult(email)\n",
|
||||
"\n",
|
||||
"=== Task 3 | success: False ===\n",
|
||||
"addParam(\"password\", password)\n",
|
||||
"encodeSHA256(password, hashed)\n",
|
||||
"addResult(hashed)\n",
|
||||
"\n",
|
||||
"=== Task 4 | success: False ===\n",
|
||||
"addParam(\"text\", text)\n",
|
||||
"replace(text, \" \", \"_\", result)\n",
|
||||
"addResult(result)\n",
|
||||
"\n",
|
||||
"=== Task 5 | success: False ===\n",
|
||||
"randomString(\"[a-zA-Z0-9]\", 32, token)\n",
|
||||
"addResult(token)\n",
|
||||
"\n",
|
||||
"=== Task 6 | success: True ===\n",
|
||||
"addParam(\"age\", age)\n",
|
||||
"if(age, 18, \">\")\n",
|
||||
"result = \"adulto\"\n",
|
||||
"else()\n",
|
||||
"result = \"menor\"\n",
|
||||
"end()\n",
|
||||
"addResult(result)\n",
|
||||
"\n",
|
||||
"=== Task 7 | success: True ===\n",
|
||||
"addParam(\"score\", score)\n",
|
||||
"if(score, 100, \"==\")\n",
|
||||
"addVar(_status, 200)\n",
|
||||
"result = \"perfecto\"\n",
|
||||
"else()\n",
|
||||
"addVar(_status, 400)\n",
|
||||
"result = \"incompleto\"\n",
|
||||
"end()\n",
|
||||
"addResult(result)\n",
|
||||
"\n",
|
||||
"=== Task 8 | success: False ===\n",
|
||||
"variableToList(\"item1\", myList)\n",
|
||||
"getListLen(myList, length)\n",
|
||||
"addResult(length)\n",
|
||||
"\n",
|
||||
"=== Task 9 | success: False ===\n",
|
||||
"getQueryParamList(\"items\", items)\n",
|
||||
"getListLen(items, length)\n",
|
||||
"addResult(length)\n",
|
||||
"\n",
|
||||
"=== Task 10 | success: False ===\n",
|
||||
"addParam(\"data\", data)\n",
|
||||
"variableFromJSON(data, \"name\", name)\n",
|
||||
"addResult(name)\n",
|
||||
"\n",
|
||||
"=== Task 11 | success: False ===\n",
|
||||
"info = {}\n",
|
||||
"AddVariableToJSON(\"status\", \"ok\", info)\n",
|
||||
"addResult(info)\n",
|
||||
"\n",
|
||||
"=== Task 12 | success: False ===\n",
|
||||
"addParam(\"password\", password)\n",
|
||||
"encodeMD5(password, hashed)\n",
|
||||
"addResult(hashed)\n",
|
||||
"\n",
|
||||
"=== Task 13 | success: False ===\n",
|
||||
"getDateTime(\"%Y-%m-%d\", 0, \"UTC\", today)\n",
|
||||
"addResult(today)\n",
|
||||
"\n",
|
||||
"=== Task 14 | success: False ===\n",
|
||||
"addParam(\"epoch\", epoch)\n",
|
||||
"stampToDatetime(epoch, \"%Y-%m-%d %H:%M:%S\", 0, datestr)\n",
|
||||
"addResult(datestr)\n",
|
||||
"\n",
|
||||
"=== Task 15 | success: False ===\n",
|
||||
"addParam(\"date_str\", date_str)\n",
|
||||
"getTimeStamp(date_str, \"%Y-%m-%d\", 0, epoch)\n",
|
||||
"addResult(epoch)\n",
|
||||
"\n",
|
||||
"=== Task 16 | success: True ===\n",
|
||||
"function square(n) {\n",
|
||||
"result = n * n\n",
|
||||
"return(result)\n",
|
||||
"}\n",
|
||||
"addParam(\"n\", n)\n",
|
||||
"squared = square(n)\n",
|
||||
"addResult(squared)\n",
|
||||
"\n",
|
||||
"=== Task 17 | success: True ===\n",
|
||||
"function add(a, b) {\n",
|
||||
"result = a + b\n",
|
||||
"return(result)\n",
|
||||
"}\n",
|
||||
"addParam(\"a\", a)\n",
|
||||
"addParam(\"b\", b)\n",
|
||||
"sum = add(a, b)\n",
|
||||
"addResult(sum)\n",
|
||||
"\n",
|
||||
"=== Task 18 | success: True ===\n",
|
||||
"addParam(\"num\", num)\n",
|
||||
"try()\n",
|
||||
"result = num / 0\n",
|
||||
"exception(err)\n",
|
||||
"result = \"error_division\"\n",
|
||||
"end()\n",
|
||||
"addResult(result)\n",
|
||||
"\n",
|
||||
"=== Task 19 | success: True ===\n",
|
||||
"addParam(\"url\", url)\n",
|
||||
"RequestGet(url, \"\", \"\", response, 5000)\n",
|
||||
"addResult(response)\n",
|
||||
"\n",
|
||||
"=== Task 20 | success: True ===\n",
|
||||
"addParam(\"url\", url)\n",
|
||||
"addParam(\"body\", body)\n",
|
||||
"RequestPost(url, \"\", \"\", body, response, 3000)\n",
|
||||
"addResult(response)\n",
|
||||
"\n",
|
||||
"=== Task 21 | success: False ===\n",
|
||||
"connector = avapConnector(\"20908e93260147acb2636967021fbf5d\")\n",
|
||||
"status = connector.get_status()\n",
|
||||
"addResult(status)\n",
|
||||
"\n",
|
||||
"=== Task 22 | success: True ===\n",
|
||||
"function fetchData() {\n",
|
||||
"data = \"fetched\"\n",
|
||||
"return(data)\n",
|
||||
"}\n",
|
||||
"handle = go fetchData()\n",
|
||||
"result = gather(handle, 2000)\n",
|
||||
"addResult(result)\n",
|
||||
"\n",
|
||||
"=== Task 23 | success: True ===\n",
|
||||
"addParam(\"n\", n)\n",
|
||||
"accum = 0\n",
|
||||
"startLoop(i, 0, n)\n",
|
||||
"accum = accum + i\n",
|
||||
"endLoop()\n",
|
||||
"addResult(accum)\n",
|
||||
"\n",
|
||||
"=== Task 24 | success: True ===\n",
|
||||
"addParam(\"value\", value)\n",
|
||||
"if(None, None, `value > 0 and value < 100`)\n",
|
||||
"result = \"rango_valido\"\n",
|
||||
"else()\n",
|
||||
"result = \"fuera_de_rango\"\n",
|
||||
"end()\n",
|
||||
"addResult(result)\n",
|
||||
"\n",
|
||||
"=== Task 25 | success: False ===\n",
|
||||
"ormAccessSelect(\"*\", \"users\", \"\", records)\n",
|
||||
"addResult(records)\n",
|
||||
"\n",
|
||||
"=== Task 26 | success: False ===\n",
|
||||
"addParam(\"username\", username)\n",
|
||||
"addParam(\"email\", email)\n",
|
||||
"fields = {\"username\": username, \"email\": email}\n",
|
||||
"ormAccessInsert(fields, \"users\", insert_result)\n",
|
||||
"addResult(insert_result)\n",
|
||||
"\n",
|
||||
"=== Task 27 | success: False ===\n",
|
||||
"addParam(\"user_id\", user_id)\n",
|
||||
"fields = \"active\"\n",
|
||||
"values = {\"active\": 1}\n",
|
||||
"selector = \"id = \" + str(user_id)\n",
|
||||
"ormAccessUpdate(fields, values, \"users\", selector, update_result)\n",
|
||||
"addResult(update_result)\n",
|
||||
"\n",
|
||||
"=== Task 28 | success: True ===\n",
|
||||
"import <math>\n",
|
||||
"function calcSquare(x) {\n",
|
||||
"result = x * x\n",
|
||||
"return(result)\n",
|
||||
"}\n",
|
||||
"result = calcSquare(9)\n",
|
||||
"addResult(result)\n",
|
||||
"\n",
|
||||
"=== Task 29 | success: False ===\n",
|
||||
"addParam(\"items_json\", items_json)\n",
|
||||
"variableFromJSON(items_json, \"items\", items)\n",
|
||||
"getListLen(items, length)\n",
|
||||
"addResult(length)\n",
|
||||
"\n",
|
||||
"=== Task 30 | success: True ===\n",
|
||||
"addParam(\"token\", token)\n",
|
||||
"if(None, None, `len(token) == 32`)\n",
|
||||
"result = \"token_valido\"\n",
|
||||
"addVar(_status, 200)\n",
|
||||
"else()\n",
|
||||
"result = \"token_invalido\"\n",
|
||||
"addVar(_status, 401)\n",
|
||||
"end()\n",
|
||||
"addResult(result)\n",
|
||||
"\n",
|
||||
"=== Task 52 | success: False ===\n",
|
||||
"addParam(\"numbers\", numbers)\n",
|
||||
"addParam(\"threshold\", threshold)\n",
|
||||
"result = True\n",
|
||||
"getListLen(numbers, list_len)\n",
|
||||
"i = 0\n",
|
||||
"startLoop(i, 0, list_len)\n",
|
||||
" itemFromList(numbers, i, current_item)\n",
|
||||
" current_val = int(current_item)\n",
|
||||
" thresh_val = int(threshold)\n",
|
||||
" if(None, None, `current_val >= thresh_val`)\n",
|
||||
" result = False\n",
|
||||
" end()\n",
|
||||
"endLoop()\n",
|
||||
"addResult(result)\n",
|
||||
"_status = 200\n",
|
||||
"\n",
|
||||
"=== Task 134 | success: False ===\n",
|
||||
"addParam(\"txt\", txt)\n",
|
||||
"result = False\n",
|
||||
"if(None, None, `txt == \"\" or txt == None`)\n",
|
||||
" result = False\n",
|
||||
"else()\n",
|
||||
" replace(txt, \",\", \" \", txt_clean)\n",
|
||||
" last_word = txt_clean.split()[-1] if txt_clean.split() else \"\"\n",
|
||||
" getListLen(last_word, last_len)\n",
|
||||
" if(None, None, `last_len == 1 and last_word.lower() >= \"a\" and last_word.lower() <= \"z\"`)\n",
|
||||
" result = True\n",
|
||||
" else()\n",
|
||||
" result = False\n",
|
||||
" end()\n",
|
||||
"end()\n",
|
||||
"addResult(result)\n",
|
||||
"_status = 200\n",
|
||||
"\n",
|
||||
"=== Task 51 | success: True ===\n",
|
||||
"addParam(\"text\", text)\n",
|
||||
"result = [s for s in text if s.lower() not in [\"a\", \"e\", \"i\", \"o\", \"u\"]]\n",
|
||||
"result_str = \"\".join(result)\n",
|
||||
"addResult(result_str)\n",
|
||||
"_status = 200\n",
|
||||
"\n",
|
||||
"=== Task 66 | success: True ===\n",
|
||||
"addParam(\"s\", s)\n",
|
||||
"if(None, None, `s == \"\" or s == None`)\n",
|
||||
" digit_sum = 0\n",
|
||||
"else()\n",
|
||||
" digit_sum = sum(ord(char) if char.isupper() else 0 for char in s)\n",
|
||||
"end()\n",
|
||||
"addResult(digit_sum)\n",
|
||||
"_status = 200\n",
|
||||
"\n",
|
||||
"=== Task 147 | success: False ===\n",
|
||||
"addParam(\"n\", n)\n",
|
||||
"n_val = int(n)\n",
|
||||
"A = [i*i - i + 1 for i in range(1, n_val + 1)]\n",
|
||||
"count = 0\n",
|
||||
"getListLen(A, len_a)\n",
|
||||
"i = 0\n",
|
||||
"startLoop(i, 0, len_a)\n",
|
||||
" j = i + 1\n",
|
||||
" startLoop(j, i + 1, len_a)\n",
|
||||
" k = j + 1\n",
|
||||
" startLoop(k, j + 1, len_a)\n",
|
||||
" itemFromList(A, i, ai)\n",
|
||||
" itemFromList(A, j, aj)\n",
|
||||
" itemFromList(A, k, ak)\n",
|
||||
" triple_sum = int(ai) + int(aj) + int(ak)\n",
|
||||
" if(None, None, `triple_sum % 3 == 0`)\n",
|
||||
" count = count + 1\n",
|
||||
" end()\n",
|
||||
" endLoop()\n",
|
||||
" endLoop()\n",
|
||||
"endLoop()\n",
|
||||
"addResult(count)\n",
|
||||
"_status = 200\n",
|
||||
"\n",
|
||||
"=== Task 101 | success: False ===\n",
|
||||
"addParam(\"s\", s)\n",
|
||||
"if(None, None, `s == \"\" or s == None`)\n",
|
||||
" words = []\n",
|
||||
"else()\n",
|
||||
" replace(s, \",\", \" \", s_clean)\n",
|
||||
" words = s_clean.split()\n",
|
||||
"end()\n",
|
||||
"addResult(words)\n",
|
||||
"_status = 200\n",
|
||||
"\n",
|
||||
"=== Task 24 | success: False ===\n",
|
||||
"addParam(\"n\", n)\n",
|
||||
"n_val = int(n)\n",
|
||||
"largest_div = 1\n",
|
||||
"i = n_val - 1\n",
|
||||
"startLoop(i, 1, n_val)\n",
|
||||
" candidate = n_val - i\n",
|
||||
" if(None, None, `n_val % candidate == 0`)\n",
|
||||
" largest_div = candidate\n",
|
||||
" return(largest_div)\n",
|
||||
" end()\n",
|
||||
"endLoop()\n",
|
||||
"addResult(largest_div)\n",
|
||||
"_status = 200\n",
|
||||
"\n",
|
||||
"=== Task 125 | success: True ===\n",
|
||||
"addParam(\"txt\", txt)\n",
|
||||
"if(None, None, `\" \" in txt`)\n",
|
||||
" split_result = txt.split()\n",
|
||||
"else()\n",
|
||||
" if(None, None, `\",\" in txt`)\n",
|
||||
" replace(txt, \",\", \" \", txt_replaced)\n",
|
||||
" split_result = txt_replaced.split()\n",
|
||||
" else()\n",
|
||||
" split_result = len([i for i in txt if i.islower() and ord(i) % 2 == 0])\n",
|
||||
" end()\n",
|
||||
"end()\n",
|
||||
"addResult(split_result)\n",
|
||||
"_status = 200\n",
|
||||
"\n",
|
||||
"=== Task 145 | success: False ===\n",
|
||||
"addParam(\"nums\", nums)\n",
|
||||
"function digits_sum(n) {\n",
|
||||
" neg = 1\n",
|
||||
" if(None, None, `n < 0`)\n",
|
||||
" n = -1 * n\n",
|
||||
" neg = -1\n",
|
||||
" end()\n",
|
||||
" digits = [int(d) for d in str(n)]\n",
|
||||
" digits[0] = digits[0] * neg\n",
|
||||
" return(sum(digits))\n",
|
||||
"}\n",
|
||||
"sorted_nums = sorted(nums, key=digits_sum)\n",
|
||||
"addResult(sorted_nums)\n",
|
||||
"_status = 200\n",
|
||||
"\n",
|
||||
"=== Task 50 | success: True ===\n",
|
||||
"addParam(\"s\", s)\n",
|
||||
"decoded = \"\".join([chr(((ord(ch) - 5 - ord(\"a\")) % 26) + ord(\"a\")) for ch in s])\n",
|
||||
"addResult(decoded)\n",
|
||||
"_status = 200\n",
|
||||
"\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"from pathlib import Path\n",
|
||||
"\n",
|
||||
"analysis_path = Path(\"../../../../output/parser_analysis.json\")\n",
|
||||
"\n",
|
||||
"with analysis_path.open(\"r\", encoding=\"utf-8\") as f:\n",
|
||||
" records = json.load(f)\n",
|
||||
"\n",
|
||||
"for record in records:\n",
|
||||
" task_id = record.get(\"task_id\")\n",
|
||||
" code = record.get(\"code\", \"\")\n",
|
||||
" exec_msg = record.get(\"execution_message\", {})\n",
|
||||
" success = exec_msg.get(\"success\", False)\n",
|
||||
"\n",
|
||||
" print(f\"=== Task {task_id} | success: {success} ===\")\n",
|
||||
" print(code)\n",
|
||||
" print()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"id": "a5946318",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"{'source_file': 'mbap_avap_A.json',\n",
|
||||
" 'task_id': 1,\n",
|
||||
" 'text': 'Crea una API de validación y transformación de datos de usuarios que procese una lista de emails desde parámetros de consulta, valide cada email con expresión regular, transforme nombres de usuarios eliminando espacios, y genere un reporte con estadísticas de emails válidos/inválidos. La API debe manejar errores y devolver código de estado HTTP apropiado.',\n",
|
||||
" 'code': 'addParam(\\'user_list\\', user_data)\\ngetQueryParamList(\\'emails\\', email_list)\\naddVar(valid_count, 0)\\naddVar(invalid_count, 0)\\naddVar(processed_emails, [])\\ntry()\\n getListLen(email_list, total_emails)\\n if(total_emails, 0, \">\")\\n addVar(i, 0)\\n startLoop(counter, 0, total_emails)\\n itemFromList(email_list, i, current_email)\\n getRegex(current_email, \"^[\\\\\\\\w\\\\\\\\.-]+@[\\\\\\\\w\\\\\\\\.-]+\\\\\\\\.[a-zA-Z]{2,}$\", email_match)\\n if(None, None, `email_match != None`)\\n addVar(valid_count, valid_count + 1)\\n replace(current_email, \" \", \"\", clean_email)\\n variableToList(clean_email, temp_list)\\n AddVariableToJSON(\"email\", clean_email, email_obj)\\n AddVariableToJSON(\"status\", \"valid\", email_obj)\\n else()\\n addVar(invalid_count, invalid_count + 1)\\n AddVariableToJSON(\"email\", current_email, email_obj)\\n AddVariableToJSON(\"status\", \"invalid\", email_obj)\\n end()\\n addVar(i, i + 1)\\n endLoop()\\n AddVariableToJSON(\"total_processed\", total_emails, report)\\n AddVariableToJSON(\"valid_emails\", valid_count, report)\\n AddVariableToJSON(\"invalid_emails\", invalid_count, report)\\n if(valid_count, 0, \">\")\\n addVar(_status, 200)\\n else()\\n addVar(_status, 422)\\n end()\\n else()\\n AddVariableToJSON(\"error\", \"No emails provided\", report)\\n addVar(_status, 400)\\n end()\\nexception(error_var)\\n AddVariableToJSON(\"error\", \"Processing failed\", report)\\n addVar(_status, 500)\\nend()\\naddResult(report)',\n",
|
||||
" 'test_inputs': {'emails': ['user1@domain.com',\n",
|
||||
" 'invalid-email',\n",
|
||||
" 'test@example.org',\n",
|
||||
" 'bad@',\n",
|
||||
" 'admin@site.co.uk']},\n",
|
||||
" 'test_list': [\"re.match(r'\\\\d+', str(report.get('total_processed', '')))\",\n",
|
||||
" \"re.match(r'[2-5]\\\\d\\\\d', str(_status))\",\n",
|
||||
" \"re.match(r'(valid|invalid)', str(report.get('error', '') or 'valid'))\"],\n",
|
||||
" 'execution_message': {'success': False,\n",
|
||||
" 'error': 'Command not found: getQueryParamList'},\n",
|
||||
" 'passed': False,\n",
|
||||
" 'error': 'Command not found: getQueryParamList',\n",
|
||||
" 'Local_Language_Server_Execution': 'Execution Data:\\n500: Internal Server Error'}"
|
||||
]
|
||||
},
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"records[0]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 12,
|
||||
"id": "60e04025",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"input_record_keys = [\"source_file\", \"task_id\", \"text\",\"code\", \"test_inputs\", \"test_list\"]\n",
|
||||
"parser_record_keys = [\"execution_message\"]\n",
|
||||
"lang_server_record_keys = [\"passed\", \"error\", \"Local_Language_Server_Execution\"]\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"input_records = [\n",
|
||||
" {k: v for k, v in record.items() if k in input_record_keys} for record in records \n",
|
||||
"]\n",
|
||||
"parser_records = [\n",
|
||||
" {k: v for k, v in record.items() if k in parser_record_keys} for record in records \n",
|
||||
"]\n",
|
||||
"\n",
|
||||
"lang_server_records = [\n",
|
||||
" {k: v for k, v in record.items() if k in lang_server_record_keys} for record in records \n",
|
||||
"]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 13,
|
||||
"id": "2dd0b3c7",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"{'source_file': 'mbap_avap_A.json',\n",
|
||||
" 'task_id': 1,\n",
|
||||
" 'text': 'Crea una API de validación y transformación de datos de usuarios que procese una lista de emails desde parámetros de consulta, valide cada email con expresión regular, transforme nombres de usuarios eliminando espacios, y genere un reporte con estadísticas de emails válidos/inválidos. La API debe manejar errores y devolver código de estado HTTP apropiado.',\n",
|
||||
" 'code': 'addParam(\\'user_list\\', user_data)\\ngetQueryParamList(\\'emails\\', email_list)\\naddVar(valid_count, 0)\\naddVar(invalid_count, 0)\\naddVar(processed_emails, [])\\ntry()\\n getListLen(email_list, total_emails)\\n if(total_emails, 0, \">\")\\n addVar(i, 0)\\n startLoop(counter, 0, total_emails)\\n itemFromList(email_list, i, current_email)\\n getRegex(current_email, \"^[\\\\\\\\w\\\\\\\\.-]+@[\\\\\\\\w\\\\\\\\.-]+\\\\\\\\.[a-zA-Z]{2,}$\", email_match)\\n if(None, None, `email_match != None`)\\n addVar(valid_count, valid_count + 1)\\n replace(current_email, \" \", \"\", clean_email)\\n variableToList(clean_email, temp_list)\\n AddVariableToJSON(\"email\", clean_email, email_obj)\\n AddVariableToJSON(\"status\", \"valid\", email_obj)\\n else()\\n addVar(invalid_count, invalid_count + 1)\\n AddVariableToJSON(\"email\", current_email, email_obj)\\n AddVariableToJSON(\"status\", \"invalid\", email_obj)\\n end()\\n addVar(i, i + 1)\\n endLoop()\\n AddVariableToJSON(\"total_processed\", total_emails, report)\\n AddVariableToJSON(\"valid_emails\", valid_count, report)\\n AddVariableToJSON(\"invalid_emails\", invalid_count, report)\\n if(valid_count, 0, \">\")\\n addVar(_status, 200)\\n else()\\n addVar(_status, 422)\\n end()\\n else()\\n AddVariableToJSON(\"error\", \"No emails provided\", report)\\n addVar(_status, 400)\\n end()\\nexception(error_var)\\n AddVariableToJSON(\"error\", \"Processing failed\", report)\\n addVar(_status, 500)\\nend()\\naddResult(report)',\n",
|
||||
" 'test_inputs': {'emails': ['user1@domain.com',\n",
|
||||
" 'invalid-email',\n",
|
||||
" 'test@example.org',\n",
|
||||
" 'bad@',\n",
|
||||
" 'admin@site.co.uk']},\n",
|
||||
" 'test_list': [\"re.match(r'\\\\d+', str(report.get('total_processed', '')))\",\n",
|
||||
" \"re.match(r'[2-5]\\\\d\\\\d', str(_status))\",\n",
|
||||
" \"re.match(r'(valid|invalid)', str(report.get('error', '') or 'valid'))\"]}"
|
||||
]
|
||||
},
|
||||
"execution_count": 13,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"input_records[0]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 14,
|
||||
"id": "5df84ee5",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"{'execution_message': {'success': False,\n",
|
||||
" 'error': 'Command not found: getQueryParamList'}}"
|
||||
]
|
||||
},
|
||||
"execution_count": 14,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"parser_records[0]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 15,
|
||||
"id": "3f6d761c",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"{'passed': False,\n",
|
||||
" 'error': 'Command not found: getQueryParamList',\n",
|
||||
" 'Local_Language_Server_Execution': 'Execution Data:\\n500: Internal Server Error'}"
|
||||
]
|
||||
},
|
||||
"execution_count": 15,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"lang_server_records[0]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 16,
|
||||
"id": "966792dd",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Saved input records: 43 -> /home/pseco/VsCodeProjects/assistance-engine/scratches/pseco/synthetic_dataset/avap_test/records_output/input_records.json\n",
|
||||
"Saved parser records: 43 -> /home/pseco/VsCodeProjects/assistance-engine/scratches/pseco/synthetic_dataset/avap_test/records_output/parser_records.json\n",
|
||||
"Saved server records: 43 -> /home/pseco/VsCodeProjects/assistance-engine/scratches/pseco/synthetic_dataset/avap_test/records_output/lang_server_records.json\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"from pathlib import Path\n",
|
||||
"\n",
|
||||
"output_dir = Path(\"./records_output\")\n",
|
||||
"output_dir.mkdir(parents=True, exist_ok=True)\n",
|
||||
"\n",
|
||||
"input_path = output_dir / \"input_records.json\"\n",
|
||||
"parser_path = output_dir / \"parser_records.json\"\n",
|
||||
"server_path = output_dir / \"lang_server_records.json\"\n",
|
||||
"\n",
|
||||
"with input_path.open(\"w\", encoding=\"utf-8\") as f:\n",
|
||||
" json.dump(input_records, f, ensure_ascii=False, indent=2)\n",
|
||||
"\n",
|
||||
"with parser_path.open(\"w\", encoding=\"utf-8\") as f:\n",
|
||||
" json.dump(parser_records, f, ensure_ascii=False, indent=2)\n",
|
||||
"\n",
|
||||
"with server_path.open(\"w\", encoding=\"utf-8\") as f:\n",
|
||||
" json.dump(lang_server_records, f, ensure_ascii=False, indent=2)\n",
|
||||
"\n",
|
||||
"print(f\"Saved input records: {len(input_records)} -> {input_path.resolve()}\")\n",
|
||||
"print(f\"Saved parser records: {len(parser_records)} -> {parser_path.resolve()}\")\n",
|
||||
"print(f\"Saved server records: {len(lang_server_records)} -> {server_path.resolve()}\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "929bb59f",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": ".venv",
|
||||
"display_name": "assistance-engine",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -0,0 +1,238 @@
|
|||
import io
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
import requests
|
||||
import typer
|
||||
from loguru import logger
|
||||
|
||||
from src.config import settings
|
||||
|
||||
app = typer.Typer()
|
||||
|
||||
DEFAULT_DATASETS = [
|
||||
"output/candidate_A_reward_10_v3.json",
|
||||
]
|
||||
|
||||
|
||||
def load_tasks(dataset_path: Path) -> list[dict]:
|
||||
"""Load tasks from a synthetic dataset JSON file.
|
||||
|
||||
Args:
|
||||
dataset_path: Path to the JSON file containing tasks.
|
||||
|
||||
Returns:
|
||||
List of task dictionaries.
|
||||
"""
|
||||
with dataset_path.open("r", encoding="utf-8") as f:
|
||||
tasks: list[dict] = json.load(f)
|
||||
logger.info(f"Loaded {len(tasks)} tasks from {dataset_path.name}")
|
||||
return tasks
|
||||
|
||||
|
||||
def execute_task(task: dict, api_url: str, timeout: int) -> dict:
|
||||
"""Send a single task to the parser API and return the result.
|
||||
|
||||
Args:
|
||||
task: Task dictionary with code and test data.
|
||||
api_url: URL of the parser/validation API endpoint.
|
||||
timeout: Timeout in seconds for the request.
|
||||
|
||||
Returns:
|
||||
Parsed response dictionary from the API.
|
||||
"""
|
||||
payload = json.dumps([task]).encode("utf-8")
|
||||
file_obj = io.BytesIO(payload)
|
||||
response = requests.post(
|
||||
api_url,
|
||||
files={"file": ("task.json", file_obj, "application/json")},
|
||||
timeout=timeout,
|
||||
)
|
||||
return _parse_response(response.text)
|
||||
|
||||
|
||||
def _parse_response(raw: str) -> dict:
|
||||
"""Parse the raw API response into a structured dict.
|
||||
|
||||
Args:
|
||||
raw: Raw response text from the API.
|
||||
|
||||
Returns:
|
||||
Parsed result dictionary.
|
||||
"""
|
||||
raw = raw.strip()
|
||||
if not raw:
|
||||
return {"success": False, "error": "Empty response from API"}
|
||||
|
||||
decoder = json.JSONDecoder()
|
||||
objects: list[dict] = []
|
||||
idx = 0
|
||||
while idx < len(raw):
|
||||
try:
|
||||
obj, end_idx = decoder.raw_decode(raw, idx)
|
||||
objects.append(obj)
|
||||
idx = end_idx
|
||||
except json.JSONDecodeError:
|
||||
idx += 1
|
||||
while idx < len(raw) and raw[idx] in " \t\n\r":
|
||||
idx += 1
|
||||
|
||||
if not objects:
|
||||
return {"success": False, "error": f"Could not parse response: {raw[:200]}"}
|
||||
|
||||
for obj in objects:
|
||||
if not obj.get("success"):
|
||||
return obj
|
||||
if "result_sequence" in obj and obj["result_sequence"]:
|
||||
return obj["result_sequence"][0]
|
||||
|
||||
return objects[0]
|
||||
|
||||
|
||||
def build_analysis_record(
|
||||
source_file: str,
|
||||
task: dict,
|
||||
result: dict,
|
||||
) -> dict:
|
||||
"""Build a consolidated analysis record for a single task.
|
||||
|
||||
Args:
|
||||
source_file: Name of the source JSON file.
|
||||
task: Original task dictionary.
|
||||
result: Parsed API response for the task.
|
||||
|
||||
Returns:
|
||||
Consolidated record with task data and execution results.
|
||||
"""
|
||||
passed = result.get("success", False) and result.get(
|
||||
"assertion_result", True
|
||||
)
|
||||
error = result.get("error", "") if not passed else ""
|
||||
|
||||
return {
|
||||
"source_file": source_file,
|
||||
"task_id": task.get("task_id"),
|
||||
"text": task.get("text", ""),
|
||||
"code": task.get("code", ""),
|
||||
"test_inputs": task.get("test_inputs", {}),
|
||||
"test_list": task.get("test_list", []),
|
||||
"execution_message": result,
|
||||
"passed": passed,
|
||||
"error": error,
|
||||
"Local_Language_Server_Execution": "",
|
||||
}
|
||||
|
||||
|
||||
def analyze_datasets(
|
||||
dataset_paths: list[Path],
|
||||
api_url: str,
|
||||
timeout: int,
|
||||
) -> list[dict]:
|
||||
"""Run parser analysis on every task across multiple dataset files.
|
||||
|
||||
Args:
|
||||
dataset_paths: List of resolved paths to dataset JSON files.
|
||||
api_url: URL of the parser/validation API endpoint.
|
||||
timeout: Timeout in seconds per request.
|
||||
|
||||
Returns:
|
||||
Consolidated list of analysis records.
|
||||
"""
|
||||
records: list[dict] = []
|
||||
errors: list[str] = []
|
||||
|
||||
for dataset_path in dataset_paths:
|
||||
source_file = dataset_path.name
|
||||
tasks = load_tasks(dataset_path)
|
||||
|
||||
for idx, task in enumerate(tasks):
|
||||
task_id = task.get("task_id", idx)
|
||||
try:
|
||||
result = execute_task(task, api_url, timeout)
|
||||
record = build_analysis_record(source_file, task, result)
|
||||
records.append(record)
|
||||
status = "PASSED" if record["passed"] else "FAILED"
|
||||
logger.info(f"[{source_file}] Task {task_id}: {status}")
|
||||
except requests.RequestException as exc:
|
||||
error_result = {"success": False, "error": str(exc)}
|
||||
record = build_analysis_record(source_file, task, error_result)
|
||||
records.append(record)
|
||||
msg = f"[{source_file}] Task {task_id}: Request failed — {exc}"
|
||||
errors.append(msg)
|
||||
logger.error(msg)
|
||||
|
||||
passed_count = sum(1 for r in records if r["passed"])
|
||||
total = len(records)
|
||||
logger.info(f"Analysis complete: {passed_count}/{total} tasks passed")
|
||||
|
||||
if errors:
|
||||
logger.error(
|
||||
f"\n{'=' * 60}\n"
|
||||
f"ERROR SUMMARY — {len(errors)} task(s) failed:\n"
|
||||
+ "\n".join(f" - {e}" for e in errors)
|
||||
+ f"\n{'=' * 60}"
|
||||
)
|
||||
|
||||
return records
|
||||
|
||||
|
||||
def save_analysis(records: list[dict], output_path: Path) -> None:
|
||||
"""Write the consolidated analysis to a JSON file.
|
||||
|
||||
Args:
|
||||
records: List of analysis record dicts.
|
||||
output_path: Destination file path.
|
||||
"""
|
||||
output_path.parent.mkdir(parents=True, exist_ok=True)
|
||||
with output_path.open("w", encoding="utf-8") as f:
|
||||
json.dump(records, f, ensure_ascii=False, indent=2)
|
||||
logger.info(f"Saved parser analysis to {output_path}")
|
||||
|
||||
|
||||
@app.command()
|
||||
def generate_parser_analysis(
|
||||
dataset_paths: list[str] = typer.Argument(
|
||||
None,
|
||||
help="Paths to dataset JSON files (relative to project root). "
|
||||
"Defaults to all files in synthetic_datasets/.",
|
||||
),
|
||||
output_path: str = typer.Option(
|
||||
"output/parser_analysis_candidate_A_v3.json",
|
||||
help="Output path for the consolidated analysis JSON.",
|
||||
),
|
||||
api_url: str = typer.Option(
|
||||
settings.parser_url,
|
||||
help="URL of the parser/validation API endpoint.",
|
||||
),
|
||||
timeout: int = typer.Option(
|
||||
120,
|
||||
help="Timeout in seconds for each API request.",
|
||||
),
|
||||
) -> None:
|
||||
"""Run parser analysis on one or more synthetic dataset files.
|
||||
|
||||
Sends each task to the parser API, collects execution results,
|
||||
and writes a consolidated JSON report with per-task outcomes
|
||||
and a blank Local_Language_Server_Execution field.
|
||||
|
||||
Example usage:
|
||||
python generate_parser_analysis.py \\
|
||||
synthetic_datasets/mbap_avap_A.json \\
|
||||
synthetic_datasets/mbpp_avap.json \\
|
||||
--output-path output/parser_analysis.json
|
||||
"""
|
||||
if not dataset_paths:
|
||||
dataset_paths = DEFAULT_DATASETS
|
||||
resolved_paths = [settings.proj_root / p for p in dataset_paths]
|
||||
resolved_output = settings.proj_root / output_path
|
||||
|
||||
records = analyze_datasets(resolved_paths, api_url, timeout)
|
||||
save_analysis(records, resolved_output)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
try:
|
||||
app()
|
||||
except Exception as exc:
|
||||
logger.exception(exc)
|
||||
raise
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -13,7 +13,7 @@ app = typer.Typer()
|
|||
|
||||
@app.command()
|
||||
def validate_synthetic_dataset(
|
||||
dataset_path: str = "output/mbpp_avap_v2_A.json",
|
||||
dataset_path: str = "synthetic_datasets/synthetic_data_generated_bedrock.json",
|
||||
output_path: str = "synthetic_datasets/validated_synthetic_dataset.json",
|
||||
api_url: str = settings.parser_url,
|
||||
timeout: int = 120,
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
[]
|
||||
|
|
@ -22,37 +22,6 @@
|
|||
"re.match(r'^200$', str(_status))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"task_id": 3,
|
||||
"text": "Recibe el parámetro 'password', genera su hash SHA-256 y devuelve el hash como resultado.",
|
||||
"code": "addParam(\"password\", password)\nencodeSHA256(password, hashed)\naddResult(hashed)",
|
||||
"test_inputs": {
|
||||
"password": "secret123"
|
||||
},
|
||||
"test_list": [
|
||||
"re.match(r'^[a-f0-9]{64}$', str(hashed))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"task_id": 4,
|
||||
"text": "Recibe el parámetro 'text', reemplaza todos los espacios por guiones bajos y devuelve el resultado.",
|
||||
"code": "addParam(\"text\", text)\nreplace(text, \" \", \"_\", result)\naddResult(result)",
|
||||
"test_inputs": {
|
||||
"text": "hello world foo"
|
||||
},
|
||||
"test_list": [
|
||||
"re.match(r'^hello_world_foo$', str(result))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"task_id": 5,
|
||||
"text": "Genera un token aleatorio de 32 caracteres alfanuméricos y devuélvelo como resultado.",
|
||||
"code": "randomString(\"[a-zA-Z0-9]\", 32, token)\naddResult(token)",
|
||||
"test_inputs": {},
|
||||
"test_list": [
|
||||
"re.match(r'^[a-zA-Z0-9]{32}$', str(token))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"task_id": 6,
|
||||
"text": "Recibe el parámetro 'age'. Si age es mayor que 18, devuelve 'adulto'; de lo contrario devuelve 'menor'.",
|
||||
|
|
@ -76,48 +45,6 @@
|
|||
"re.match(r'^200$', str(_status))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"task_id": 8,
|
||||
"text": "Crea una lista con el elemento 'item1', obtén su longitud y devuelve la longitud como resultado.",
|
||||
"code": "variableToList(\"item1\", myList)\ngetListLen(myList, length)\naddResult(length)",
|
||||
"test_inputs": {},
|
||||
"test_list": [
|
||||
"re.match(r'^1$', str(length))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"task_id": 10,
|
||||
"text": "Recibe el parámetro 'data' como JSON, extrae el campo 'name' y devuélvelo como resultado.",
|
||||
"code": "addParam(\"data\", data)\nvariableFromJSON(data, \"name\", name)\naddResult(name)",
|
||||
"test_inputs": {
|
||||
"data": "{\"name\": \"Carlos\", \"age\": 30}"
|
||||
},
|
||||
"test_list": [
|
||||
"re.match(r'^Carlos$', str(name))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"task_id": 12,
|
||||
"text": "Recibe el parámetro 'password', genera su hash MD5 y devuelve el hash como resultado.",
|
||||
"code": "addParam(\"password\", password)\nencodeMD5(password, hashed)\naddResult(hashed)",
|
||||
"test_inputs": {
|
||||
"password": "mypassword"
|
||||
},
|
||||
"test_list": [
|
||||
"re.match(r'^[a-f0-9]{32}$', str(hashed))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"task_id": 14,
|
||||
"text": "Recibe el parámetro 'epoch', conviértelo a string de fecha en formato 'YYYY-MM-DD HH:MM:SS' y devuelve el resultado.",
|
||||
"code": "addParam(\"epoch\", epoch)\nstampToDatetime(epoch, \"%Y-%m-%d %H:%M:%S\", 0, datestr)\naddResult(datestr)",
|
||||
"test_inputs": {
|
||||
"epoch": 1700000000
|
||||
},
|
||||
"test_list": [
|
||||
"re.match(r'^\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}$', str(datestr))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"task_id": 16,
|
||||
"text": "Define una función que recibe un número y devuelve su cuadrado. Llama a la función con el parámetro 'n' y devuelve el resultado.",
|
||||
|
|
@ -175,6 +102,15 @@
|
|||
"re.match(r'^.*$', str(response))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"task_id": 22,
|
||||
"text": "Lanza una función 'fetchData' de forma asíncrona con go, espera el resultado con gather (timeout 2000ms) y devuelve el resultado.",
|
||||
"code": "function fetchData() {\ndata = \"fetched\"\nreturn(data)\n}\nhandle = go fetchData()\nresult = gather(handle, 2000)\naddResult(result)",
|
||||
"test_inputs": {},
|
||||
"test_list": [
|
||||
"re.match(r'^fetched$', str(result))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"task_id": 28,
|
||||
"text": "Importa la librería nativa 'math', calcula el cuadrado de 9 usando una función y devuelve el resultado.",
|
||||
|
|
@ -183,16 +119,5 @@
|
|||
"test_list": [
|
||||
"re.match(r'^81$', str(result))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"task_id": 29,
|
||||
"text": "Recibe el parámetro 'items_json' como JSON con una lista bajo la clave 'items'. Extrae la lista, obtén su longitud y devuelve la longitud.",
|
||||
"code": "addParam(\"items_json\", items_json)\nvariableFromJSON(items_json, \"items\", items)\ngetListLen(items, length)\naddResult(length)",
|
||||
"test_inputs": {
|
||||
"items_json": "{\"items\": [\"x\", \"y\", \"z\"]}"
|
||||
},
|
||||
"test_list": [
|
||||
"re.match(r'^3$', str(length))"
|
||||
]
|
||||
}
|
||||
]
|
||||
Loading…
Reference in New Issue