test: Add tests
This commit is contained in:
parent
b0ca946840
commit
023a1db4f1
2 changed files with 38 additions and 0 deletions
22
test/show_all.sh
Normal file
22
test/show_all.sh
Normal file
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
# Directory paths
|
||||
DATA_DIR='../data'
|
||||
OUT_DIR='../out'
|
||||
|
||||
IMG_TYPES=('depth' 'rgb')
|
||||
|
||||
mkdir -p "${OUT_DIR}"
|
||||
|
||||
for json_file in "${DATA_DIR}"/*.json; do
|
||||
base_name=$(basename "${json_file}" '.json')
|
||||
echo "Generating ${base_name}..."
|
||||
|
||||
../cmake-build-release/raytracing "${json_file}" > /dev/null
|
||||
|
||||
for img_type in "${IMG_TYPES[@]}"; do
|
||||
mv "${img_type}.png" "${OUT_DIR}/${base_name}-${img_type}.png"
|
||||
done
|
||||
done
|
16
test/test_all.sh
Normal file
16
test/test_all.sh
Normal file
|
@ -0,0 +1,16 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
# Directory paths
|
||||
TEST_DIR='../out'
|
||||
CORRECT_DIR='../correct_results'
|
||||
|
||||
for file in ${CORRECT_DIR}/*.png; do
|
||||
base_name=$(basename "${file}" '.png')
|
||||
echo "Testing ${base_name}..."
|
||||
|
||||
if ! diff "${file}" "${TEST_DIR}/${base_name}-rgb.png"; then
|
||||
echo "RGB image ${base_name} is incorrect."
|
||||
fi
|
||||
done
|
Reference in a new issue