From 9583dcc3d7b84e77a8a4d658c737ccba2a250373 Mon Sep 17 00:00:00 2001 From: skal Date: Sat, 7 Feb 2026 17:34:23 +0100 Subject: test: Add Gantt chart output test for seq_compiler - Created test_gantt.seq: minimal sequence file for testing - Created test_gantt_output.sh: bash script that verifies Gantt output - Checks for: timeline header, BPM info, time axis, sequence bars - Added GanttOutputTest to CMake test suite All 29 tests pass (was 28). --- scripts/test_gantt_output.sh | 70 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100755 scripts/test_gantt_output.sh (limited to 'scripts/test_gantt_output.sh') diff --git a/scripts/test_gantt_output.sh b/scripts/test_gantt_output.sh new file mode 100755 index 0000000..3cfb9c3 --- /dev/null +++ b/scripts/test_gantt_output.sh @@ -0,0 +1,70 @@ +#!/bin/bash +# Test script for seq_compiler Gantt chart output + +set -e # Exit on error + +# Arguments +SEQ_COMPILER=$1 +INPUT_SEQ=$2 +OUTPUT_GANTT=$3 + +if [ -z "$SEQ_COMPILER" ] || [ -z "$INPUT_SEQ" ] || [ -z "$OUTPUT_GANTT" ]; then + echo "Usage: $0 " + exit 1 +fi + +# Clean up any existing output +rm -f "$OUTPUT_GANTT" + +# Run seq_compiler with Gantt output +"$SEQ_COMPILER" "$INPUT_SEQ" "--gantt=$OUTPUT_GANTT" > /dev/null 2>&1 + +# Check output file exists +if [ ! -f "$OUTPUT_GANTT" ]; then + echo "ERROR: Gantt output file not created" + exit 1 +fi + +# Verify key content exists +ERRORS=0 + +# Check for timeline header +if ! grep -q "Demo Timeline Gantt Chart" "$OUTPUT_GANTT"; then + echo "ERROR: Missing 'Demo Timeline Gantt Chart' header" + ERRORS=$((ERRORS + 1)) +fi + +# Check for BPM info +if ! grep -q "BPM:" "$OUTPUT_GANTT"; then + echo "ERROR: Missing 'BPM:' information" + ERRORS=$((ERRORS + 1)) +fi + +# Check for time axis +if ! grep -q "Time (s):" "$OUTPUT_GANTT"; then + echo "ERROR: Missing 'Time (s):' axis" + ERRORS=$((ERRORS + 1)) +fi + +# Check for sequence bars (should have '█' characters) +if ! grep -q "█" "$OUTPUT_GANTT"; then + echo "ERROR: Missing sequence visualization bars" + ERRORS=$((ERRORS + 1)) +fi + +# Check file is not empty +FILE_SIZE=$(wc -c < "$OUTPUT_GANTT") +if [ "$FILE_SIZE" -lt 100 ]; then + echo "ERROR: Gantt output is too small ($FILE_SIZE bytes)" + ERRORS=$((ERRORS + 1)) +fi + +if [ $ERRORS -eq 0 ]; then + echo "✓ Gantt chart output test passed" + exit 0 +else + echo "✗ Gantt chart output test failed ($ERRORS errors)" + echo "--- Output file contents ---" + cat "$OUTPUT_GANTT" + exit 1 +fi -- cgit v1.2.3