#!/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 "╚════════════════════════════════════════════════════════════╝"