test: Add diff tests

This commit is contained in:
Tibo De Peuter 2024-10-11 13:54:48 +02:00
parent a7484f1748
commit 43f19610f6
Signed by: tdpeuter
GPG key ID: 38297DE43F75FFE2

26
test/test_all.sh Executable file
View file

@ -0,0 +1,26 @@
#!/usr/bin/env bash
set -e
# Directory paths
DATA_DIR='../data'
CORRECT_DIR='../correct_results'
IMG_TYPES=('normal' 'depth' 'id')
for json_file in ${DATA_DIR}/*.json; do
base_name=$(basename "${json_file}" '.json')
echo "Testing ${base_name}..."
../build/raycasting "${json_file}" > /dev/null
for img_type in "${IMG_TYPES[@]}"; do
diff "${img_type}.png" "${CORRECT_DIR}/${base_name}-${img_type}.png"
done
done
# Cleanup
for img_type in "${IMG_TYPES[@]}"; do
rm "${img_type}.png"
done