add web-service

This commit is contained in:
2025-10-20 23:07:10 +05:00
parent a74b8bbb5d
commit 4f9417a032
10 changed files with 1266 additions and 282 deletions

65
test-api.sh Executable file
View File

@@ -0,0 +1,65 @@
#!/bin/bash
# Скрипт для тестирования API веб-сервиса
API_URL="http://localhost:5000"
echo "╔════════════════════════════════════════════════════════════╗"
echo "║ Testing Racing A* Web Service API ║"
echo "╚════════════════════════════════════════════════════════════╝"
echo
# Проверяем, что сервис запущен
echo "1. Testing health endpoint..."
echo " GET $API_URL/health"
curl -s "$API_URL/health" | jq '.' || echo "❌ Service is not running. Start it with: ./run-webservice.sh"
echo
# Тестируем информационный endpoint
echo "2. Testing info endpoint..."
echo " GET $API_URL/"
curl -s "$API_URL/" | jq '.'
echo
# Тестируем решение простой карты
echo "3. Testing solve endpoint with simple map..."
echo " POST $API_URL/solve"
if [ -f "maps/simple-test.json" ]; then
curl -s -X POST "$API_URL/solve" \
-H "Content-Type: application/json" \
-d @maps/simple-test.json \
| jq '.'
else
echo " ⚠️ maps/simple-test.json not found, testing with inline map"
curl -s -X POST "$API_URL/solve" \
-H "Content-Type: application/json" \
-d '{
"map": [
[0, 0, 0, 0, 0],
[0, 1, 1, 1, 0],
[0, 0, 4, 0, 0],
[0, 1, 1, 1, 0],
[5, 0, 0, 0, 0]
]
}' \
| jq '.'
fi
echo
# Тестируем более сложную карту
echo "4. Testing solve endpoint with complex map..."
if [ -f "maps/racing-map-15x15.json" ]; then
echo " POST $API_URL/solve (with racing-map-15x15.json)"
curl -s -X POST "$API_URL/solve" \
-H "Content-Type: application/json" \
-d @maps/racing-map-15x15.json \
| jq '.'
else
echo " ⚠️ maps/racing-map-15x15.json not found, skipping"
fi
echo
echo "╔════════════════════════════════════════════════════════════╗"
echo "║ Testing completed ║"
echo "╚════════════════════════════════════════════════════════════╝"