From 1d33cf59bf5d124dcb7fe0b2b2e508f5e64c8ec0 Mon Sep 17 00:00:00 2001 From: James Willis <james.s.willis@durham.ac.uk> Date: Wed, 16 Aug 2017 12:25:57 +0100 Subject: [PATCH] Added extra test case to test27cells.sh and test27cellsPerturbed.sh to perturb the smoothing lengths further to pick up extra edge cases. --- tests/Makefile.am | 2 +- tests/test27cells.sh.in | 30 +++++++++++++++++++++++++++- tests/test27cellsPerturbed.sh.in | 31 +++++++++++++++++++++++++++-- tests/tolerance_27_perturbed_h2.dat | 4 ++++ 4 files changed, 63 insertions(+), 4 deletions(-) create mode 100644 tests/tolerance_27_perturbed_h2.dat diff --git a/tests/Makefile.am b/tests/Makefile.am index cf967db56a..9cd6e9ab9e 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -100,6 +100,6 @@ EXTRA_DIST = testReading.sh makeInput.py testActivePair.sh \ test27cells.sh test27cellsPerturbed.sh testParser.sh testPeriodicBC.sh \ testPeriodicBCPerturbed.sh test125cells.sh test125cellsPerturbed.sh testParserInput.yaml \ difffloat.py tolerance_125_normal.dat tolerance_125_perturbed.dat \ - tolerance_27_normal.dat tolerance_27_perturbed.dat tolerance_27_perturbed_h.dat \ + tolerance_27_normal.dat tolerance_27_perturbed.dat tolerance_27_perturbed_h.dat tolerance_27_perturbed_h2.dat \ tolerance_testInteractions.dat tolerance_pair_active.dat \ fft_params.yml tolerance_periodic_BC_normal.dat tolerance_periodic_BC_perturbed.dat diff --git a/tests/test27cells.sh.in b/tests/test27cells.sh.in index b327cb1bd8..059a7a208a 100755 --- a/tests/test27cells.sh.in +++ b/tests/test27cells.sh.in @@ -28,6 +28,34 @@ do done +# Test for particles with random smoothing lengths +for v in {0..3} +do + echo "" + + rm -f brute_force_27_standard.dat swift_dopair_27_standard.dat + + echo "Running ./test27cells -n 6 -r 1 -d 0 -f standard -v $v -p 1.1" + ./test27cells -n 6 -r 1 -d 0 -f standard -v $v -p 1.1 + + if [ -e brute_force_27_standard.dat ] + then + if python @srcdir@/difffloat.py brute_force_27_standard.dat swift_dopair_27_standard.dat @srcdir@/tolerance_27_perturbed_h.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 + # Test for particles with random smoothing lengths for v in {0..3} do @@ -40,7 +68,7 @@ do if [ -e brute_force_27_standard.dat ] then - if python @srcdir@/difffloat.py brute_force_27_standard.dat swift_dopair_27_standard.dat @srcdir@/tolerance_27_perturbed_h.dat 6 + if python @srcdir@/difffloat.py brute_force_27_standard.dat swift_dopair_27_standard.dat @srcdir@/tolerance_27_perturbed_h2.dat 6 then echo "Accuracy test passed" else diff --git a/tests/test27cellsPerturbed.sh.in b/tests/test27cellsPerturbed.sh.in index 3680bff7a3..f875504e54 100755 --- a/tests/test27cellsPerturbed.sh.in +++ b/tests/test27cellsPerturbed.sh.in @@ -35,8 +35,8 @@ do rm -f brute_force_27_perturbed.dat swift_dopair_27_perturbed.dat - echo "Running ./test27cells -n 6 -r 1 -d 0.1 -f perturbed -v $v -p 1.3" - ./test27cells -n 6 -r 1 -d 0.1 -f perturbed -v $v -p 1.3 + echo "Running ./test27cells -n 6 -r 1 -d 0.1 -f perturbed -v $v -p 1.1" + ./test27cells -n 6 -r 1 -d 0.1 -f perturbed -v $v -p 1.1 if [ -e brute_force_27_perturbed.dat ] then @@ -56,4 +56,31 @@ do done +# Test for particles with random smoothing lengths +for v in {0..3} +do + echo "" + + rm -f brute_force_27_perturbed.dat swift_dopair_27_perturbed.dat + + echo "Running ./test27cells -n 6 -r 1 -d 0.1 -f perturbed -v $v -p 1.3" + ./test27cells -n 6 -r 1 -d 0.1 -f perturbed -v $v -p 1.3 + + if [ -e brute_force_27_perturbed.dat ] + then + if python @srcdir@/difffloat.py brute_force_27_perturbed.dat swift_dopair_27_perturbed.dat @srcdir@/tolerance_27_perturbed_h2.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 $? diff --git a/tests/tolerance_27_perturbed_h2.dat b/tests/tolerance_27_perturbed_h2.dat new file mode 100644 index 0000000000..23f6a50061 --- /dev/null +++ b/tests/tolerance_27_perturbed_h2.dat @@ -0,0 +1,4 @@ +# ID pos_x pos_y pos_z v_x v_y v_z rho rho_dh wcount wcount_dh div_v curl_vx curl_vy curl_vz + 0 1e-6 1e-6 1e-6 1e-6 1e-6 1e-6 3e-6 1e-4 5e-4 1.5e-2 1.4e-5 3e-6 3e-6 9e-6 + 0 1e-6 1e-6 1e-6 1e-6 1e-6 1e-6 1.5e-6 1.57e-2 1e-5 4.74e-3 3.89e-4 3e-3 3e-3 3e-3 + 0 1e-6 1e-6 1e-6 1e-6 1e-6 1e-6 1e-6 1e-6 1e-6 1e0 1e-6 4e-6 4e-6 4e-6 -- GitLab