mirror of https://github.com/ecmwf/eccodes.git
Testing: Increase coverage
This commit is contained in:
parent
aca7a5ddb1
commit
2cfe640f1c
|
@ -10,37 +10,33 @@
|
|||
|
||||
. ./include.ctest.sh
|
||||
|
||||
|
||||
#Define a common label for all the tmp files
|
||||
# Define a common label for all the tmp files
|
||||
label="bufr_set_keys_test_c"
|
||||
|
||||
#Define tmp file
|
||||
REDIRECT=/dev/null
|
||||
fBufrTmp=${label}.tmp.bufr
|
||||
rm -f $fBufrTmp
|
||||
|
||||
#We check "syno_multi.bufr". The path is
|
||||
#hardcoded in the example
|
||||
# We check "syno_multi.bufr". The path is hard coded in the example
|
||||
f=${data_dir}/bufr/syno_multi.bufr
|
||||
|
||||
REDIRECT=/dev/null
|
||||
set +e
|
||||
${examples_dir}/c_bufr_set_keys
|
||||
status=$?
|
||||
set -e
|
||||
[ $status -ne 0 ]
|
||||
|
||||
#
|
||||
# Run
|
||||
${examples_dir}/c_bufr_set_keys $fBufrTmp 2> $REDIRECT > $REDIRECT
|
||||
|
||||
#Compare modified to the original
|
||||
# Compare modified to the original
|
||||
set +e
|
||||
${tools_dir}/bufr_compare $f $fBufrTmp >$REDIRECT 2> $REDIRECT
|
||||
|
||||
#Check if modified is different
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "setting keys produced identical files " >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
status=$?
|
||||
set -e
|
||||
[ $status -ne 0 ]
|
||||
|
||||
#Check if modified has the same number of messages
|
||||
# Check if modified has the same number of messages
|
||||
[ `${tools_dir}/bufr_count $f` -eq `${tools_dir}/bufr_count ${fBufrTmp}` ]
|
||||
|
||||
#Clean up
|
||||
# Clean up
|
||||
rm -f $fBufrTmp
|
||||
|
|
|
@ -15,6 +15,12 @@ fTmp=${label}.tmp
|
|||
fOut=${label}.tmp.out
|
||||
fRef=${label}.tmp.ref
|
||||
|
||||
set +e
|
||||
${examples_dir}/c_get_product_kind
|
||||
status=$?
|
||||
set -e
|
||||
[ $status -eq 1 ]
|
||||
|
||||
# Create a file containing one GRIB and three BUFR messages
|
||||
cat ${data_dir}/sample.grib2 ${data_dir}/bufr/syno_multi.bufr >$fTmp
|
||||
|
||||
|
|
|
@ -15,6 +15,12 @@ temp1=$label.temp1.$$
|
|||
temp2=$label.temp2.$$
|
||||
tempRef=$label.ref.$$
|
||||
|
||||
set +e
|
||||
${examples_dir}/c_grib_nearest_multiple 2>/dev/null
|
||||
status=$?
|
||||
set -e
|
||||
[ $status -eq 1 ]
|
||||
|
||||
cat > $temp1 <<EOF
|
||||
1 30 -20
|
||||
2 13 234
|
||||
|
|
|
@ -308,6 +308,29 @@ ${tools_dir}/grib_filter $tempFilt $input
|
|||
cd ..
|
||||
rm -rf $tempDir
|
||||
|
||||
# Use of 'defined' functor
|
||||
cat >$tempFilt <<EOF
|
||||
if (defined(Ni)) { print "Ni defined: true"; }
|
||||
else { print "Ni defined: false"; }
|
||||
EOF
|
||||
${tools_dir}/grib_filter $tempFilt $ECCODES_SAMPLES_PATH/GRIB2.tmpl > $tempOut
|
||||
grep -q "Ni defined: true" $tempOut
|
||||
|
||||
|
||||
cat >$tempFilt <<EOF
|
||||
if (defined(N)) { print "N defined: true"; }
|
||||
else { print "N defined: false"; }
|
||||
EOF
|
||||
${tools_dir}/grib_filter $tempFilt $ECCODES_SAMPLES_PATH/GRIB2.tmpl > $tempOut
|
||||
grep -q "N defined: false" $tempOut
|
||||
|
||||
cat >$tempFilt <<EOF
|
||||
if (defined()) { print "No args: true"; }
|
||||
else { print "No args: false"; }
|
||||
EOF
|
||||
${tools_dir}/grib_filter $tempFilt $ECCODES_SAMPLES_PATH/GRIB2.tmpl > $tempOut
|
||||
grep -q "No args: false" $tempOut
|
||||
|
||||
|
||||
# Clean up
|
||||
rm -f $tempGrib $tempFilt $tempOut $tempRef
|
||||
|
|
|
@ -155,7 +155,14 @@ ${tools_dir}/grib_set -s julianDay=2454504 $input $temp
|
|||
grib_check_key_equals $input day 6
|
||||
grib_check_key_equals $temp day 7
|
||||
|
||||
# Seconds (ignored)
|
||||
# -----------------------------------------------
|
||||
grib2_sample=$ECCODES_SAMPLES_PATH/GRIB2.tmpl
|
||||
${tools_dir}/grib_ls -s second=9 -n time $grib2_sample 2>$templog
|
||||
# Something should have been written to stderr
|
||||
[ -s $templog ]
|
||||
grep -q "Truncating time: non-zero seconds.* ignored" $templog
|
||||
|
||||
# Clean up
|
||||
rm -f $temp
|
||||
rm -f $temp $templog
|
||||
rm -f $grib2File.p8tmp ${grib2File}.tmp x.grib
|
||||
|
|
Loading…
Reference in New Issue