Skip to content

Commit

Permalink
Testing: Accessor suppressed
Browse files Browse the repository at this point in the history
  • Loading branch information
shahramn committed Feb 15, 2024
1 parent d2e0ac5 commit 8c1719d
Showing 1 changed file with 16 additions and 37 deletions.
53 changes: 16 additions & 37 deletions tests/grib_suppressed.sh
Original file line number Diff line number Diff line change
@@ -17,51 +17,30 @@ tempFilt=temp.${label}.filt
tempRef=temp.${label}.ref
sample2=$ECCODES_SAMPLES_PATH/GRIB2.tmpl

cat > $tempFilt <<EOF
meta a_deprecated_key suppressed(typeOfOriginalFieldValues);
print "[a_deprecated_key]";
EOF

set +e
${tools_dir}/grib_filter $tempFilt $sample2 2>$tempErr
status=$?
set -e
[ $status -ne 0 ]

cat $tempErr

cat > $tempRef <<EOF
ECCODES ERROR : key 'a_deprecated_key' is unavailable in this version.
ECCODES ERROR : Please use the following key(s):
ECCODES ERROR : - typeOfOriginalFieldValues
ERROR: Key/value not found (message 1)
EOF

diff $tempRef $tempErr
do_tests()
{
qualifier=$1
echo "meta a_deprecated_key suppressed(typeOfOriginalFieldValues); print \"[a_deprecated_key$qualifier]\";" > $tempFilt
set +e
${tools_dir}/grib_filter $tempFilt $sample2 2>$tempErr
status=$?
set -e
[ $status -ne 0 ]
cat $tempErr
diff $tempRef $tempErr
}

do_tests ""
do_tests ":i"
do_tests ":d"

# Try decoding as int and double too
cat > $tempFilt <<EOF
meta a_deprecated_key suppressed(typeOfOriginalFieldValues);
print "[a_deprecated_key:i]";
EOF
set +e
${tools_dir}/grib_filter $tempFilt $sample2 2>$tempErr
status=$?
set -e
[ $status -ne 0 ]
grep -q "is unavailable" $tempErr


cat > $tempFilt <<EOF
meta a_deprecated_key suppressed(typeOfOriginalFieldValues);
print "[a_deprecated_key:d]";
EOF
set +e
${tools_dir}/grib_filter $tempFilt $sample2 2>$tempErr
status=$?
set -e
[ $status -ne 0 ]
grep -q "is unavailable" $tempErr

# Clean up
rm -f $tempFilt $tempErr $tempRef

0 comments on commit 8c1719d

Please sign in to comment.