#!/bin/bash # ============================================================================= # V2G EXI Decoder - 전체 테스트 스크립트 (Linux/macOS) # 설명: 모든 샘플 파일을 .NET 버전으로 테스트 # ============================================================================= echo echo "==========================================" echo "V2G EXI Decoder 테스트 시작" echo "==========================================" echo TEST_ERROR=0 SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" cd "$SCRIPT_DIR" # 테스트 결과 저장 폴더 생성 mkdir -p temp echo "[테스트 1] test5.exi (CurrentDemandReq) - 순수 EXI 43바이트" echo dotnet run --project DotNet/V2GDecoderNet.csproj Sample/test5.exi > temp/test5_output.txt 2>&1 if [ $? -ne 0 ]; then echo "ERROR: test5.exi 테스트 실패" TEST_ERROR=1 else echo "✅ test5.exi 테스트 성공" fi echo echo "[테스트 2] test1.exi (CurrentDemandRes) - 네트워크 패킷 포함 131바이트" echo dotnet run --project DotNet/V2GDecoderNet.csproj Sample/test1.exi > temp/test1_output.txt 2>&1 if [ $? -ne 0 ]; then echo "ERROR: test1.exi 테스트 실패" TEST_ERROR=1 else echo "✅ test1.exi 테스트 성공" fi echo echo "[테스트 3] roundtrip 테스트 - EXI → XML → EXI" echo dotnet run --project DotNet/V2GDecoderNet.csproj -decode Sample/test5.exi > temp/test5_decoded.xml 2>/dev/null dotnet run --project DotNet/V2GDecoderNet.csproj -encode temp/test5_decoded.xml > temp/test5_roundtrip.exi 2>/dev/null cmp -s Sample/test5.exi temp/test5_roundtrip.exi if [ $? -ne 0 ]; then echo "ERROR: roundtrip 테스트 실패 - 파일이 다릅니다" TEST_ERROR=1 else echo "✅ roundtrip 테스트 성공 - 파일이 동일합니다" fi echo # GCC 버전 테스트 (있는 경우) if [ -f "V2GDecoder_gcc" ]; then echo "[테스트 4] GCC 버전 테스트" echo ./V2GDecoder_gcc Sample/test5.exi > temp/test5_gcc_output.txt 2>&1 if [ $? -ne 0 ]; then echo "ERROR: GCC 버전 테스트 실패" TEST_ERROR=1 else echo "✅ GCC 버전 테스트 성공" fi echo fi # 결과 요약 echo "==========================================" echo "테스트 결과 요약" echo "==========================================" if [ $TEST_ERROR -eq 0 ]; then echo "✅ 모든 테스트가 성공적으로 완료되었습니다" echo echo "테스트 결과 파일들이 temp/ 폴더에 저장되었습니다:" ls -la temp/*.txt temp/*.xml temp/*.exi 2>/dev/null || echo " (결과 파일 없음)" exit 0 else echo "❌ 일부 테스트가 실패했습니다" echo "자세한 내용은 temp/ 폴더의 로그 파일을 확인하세요" exit 1 fi