#!/bin/bash # List each test that should be run declare -a TEST_LIST=(test27cellsSIDM) # Run same test for each executable for TEST in "${TEST_LIST[@]}" do # Test for particles with the same smoothing length echo "" rm -f sidm_brute_force_27_standard.dat swift_sidm_dopair_27_standard.dat SIDM_NONE.dat echo "Running ./$TEST -n 6 -r 1 -d 0 -f standard" ./$TEST -n 6 -r 1 -d 0 -f standard # Skip tests if compiled without SIDM and exit early if [ -e SIDM_NONE.dat ] then echo "SIDM disabled: test automatically passed" exit 0 fi if [ -e sidm_brute_force_27_standard.dat ] then if python3 @srcdir@/difffloat.py sidm_brute_force_27_standard.dat swift_sidm_dopair_27_standard.dat @srcdir@/tolerance_27_normal_SIDM.dat 6 then echo "Accuracy test passed" else echo "Accuracy test failed" exit 1 fi else echo "Error Missing test output file" exit 1 fi echo "------------" # Test for particles with random smoothing lengths echo "" rm -f sidm_brute_force_27_standard.dat swift_sidm_dopair_27_standard.dat echo "Running ./$TEST -n 6 -r 1 -d 0 -f standard -p 1.1" ./$TEST -n 6 -r 1 -d 0 -f standard -p 1.1 if [ -e sidm_brute_force_27_standard.dat ] then if python3 @srcdir@/difffloat.py sidm_brute_force_27_standard.dat swift_sidm_dopair_27_standard.dat @srcdir@/tolerance_27_perturbed_h_SIDM.dat 6 then echo "Accuracy test passed" else echo "Accuracy test failed" exit 1 fi else echo "Error Missing test output file" exit 1 fi echo "------------" # Test for particles with random smoothing lengths echo "" rm -f sidm_brute_force_27_standard.dat swift_sidm_dopair_27_standard.dat echo "Running ./$TEST -n 6 -r 1 -d 0 -f standard -p 1.3" ./$TEST -n 6 -r 1 -d 0 -f standard -p 1.3 if [ -e sidm_brute_force_27_standard.dat ] then if python3 @srcdir@/difffloat.py sidm_brute_force_27_standard.dat swift_sidm_dopair_27_standard.dat @srcdir@/tolerance_27_perturbed_h2_SIDM.dat 6 then echo "Accuracy test passed" else echo "Accuracy test failed" exit 1 fi else echo "Error Missing test output file" exit 1 fi echo "------------" done exit $?