Examples: Check results

This commit is contained in:
Shahram Najm 2022-12-22 16:46:00 +00:00
parent a419f4ae19
commit 8a05412b73
6 changed files with 33 additions and 56 deletions

View File

@ -11,24 +11,18 @@
. ./include.ctest.sh
#Define a common label for all the tmp files
# Define a common label for all the tmp files
label="bufr_attributes_test_f"
#Define tmp file
# Define tmp file
fTmp=${label}.tmp.txt
rm -f ${fTmp}
#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
${examples_dir}/eccodes_f_bufr_attributes > $fTmp
REDIRECT=/dev/null
# Check the results
grep -q 'airTemperatureAt2M->percentConfidence->code: *33007' $fTmp
grep -q 'airTemperatureAt2M->percentConfidence->width: *7' $fTmp
#Write the values into a file and compare with reference
${examples_dir}/eccodes_f_bufr_attributes #2> $REDIRECT > $fTmp
#TODO: check the results
#cat $fTmp
#Clean up
rm -f ${fTmp}

View File

@ -9,31 +9,30 @@
. ./include.ctest.sh
#Define a common label for all the tmp files
# Define a common label for all the tmp files
label="bufr_clone_test_f"
#Prepare tmp file
fBufrTmp=${label}.clone.bufr
rm -f $fBufrTmp
#We clone a bufr file with multiple messages.
# We clone a bufr file with multiple messages
f=${data_dir}/bufr/syno_multi.bufr
REDIRECT=/dev/null
#The input ($f) and output ($fBufrTmp) are hardcoded in the f90 example!!!
# The input ($f) and output ($fBufrTmp) are hardcoded in the f90 example
${examples_dir}/eccodes_f_bufr_clone >$REDIRECT 2> $REDIRECT
#Compare clone to the original
# Compare clone to the original. Should be different
set +e
${tools_dir}/bufr_compare $f $fBufrTmp >$REDIRECT 2> $REDIRECT
#Check if clone is different
# Check if clone is different
if [ $? -eq 0 ]; then
echo "cloning produced identical files " >&2
echo "Error: cloning produced identical files " >&2
exit 1
fi
set -e
#Clean up
# Clean up
rm -f ${fBufrTmp}

View File

@ -9,33 +9,28 @@
. ./include.ctest.sh
#Define a common label for all the tmp files
# Define a common label for all the tmp files
label="bufr_expanded_test_f"
#Prepare tmp file
fTmp=${label}.tmp.txt
rm -f $fTmp
#-----------------------------------------------------
# Test reading the expanded values
#----------------------------------------------------
#f=${data_dir}/bufr/syno_1.bufr
REDIRECT=/dev/null
#We check "syno_1.bufr". The path is
#hardcoded in the example
# We check "syno_1.bufr". The path is hard coded in the example
#Write the values into a file
# Write the values into a file
${examples_dir}/eccodes_f_bufr_expanded > $fTmp 2> $REDIRECT
#TODO: add a better check. It could be compared against the bufrdc
# references.
#TODO: add a better check. It could be compared against the bufrdc references
#Check if there is any output
# Check if there is any output
[ -s ${fTmp} ]
#cat $fTmp
# cat $fTmp
#Clean up
rm -f ${fTmp}

View File

@ -28,7 +28,7 @@ ${examples_dir}/eccodes_f_bufr_get_keys 2> $REDIRECT > $fTmp
#TODO: check the results
#cat $fTmp
#cat $fTmp
#Clean up
rm -f ${fTmp}

View File

@ -10,23 +10,19 @@
. ./include.ctest.sh
#Define a common label for all the tmp files
# Define a common label for all the tmp files
label="bufr_keys_iterator_test_f"
#Define tmp file
fTmp=${label}".tmp.txt"
rm -f $fTmp
REDIRECT=/dev/null
f=${data_dir}/bufr/syno_1.bufr
#The input ($f) is hardcoded in the f90 example!!!
${examples_dir}/eccodes_f_bufr_keys_iterator #2> $REDIRECT > $fTmp
# The input ($f) is hard coded in the example
${examples_dir}/eccodes_f_bufr_keys_iterator > $fTmp
#TODO: check the output
# Check the output
grep -q '#49#dataPresentIndicator' $fTmp
grep -q '#1#generatingApplication' $fTmp
#cat $fTmp
#Clean up
rm -f $fTmp

View File

@ -11,24 +11,17 @@
. ./include.ctest.sh
#Define a common label for all the tmp files
# Define a common label for all the tmp files
label="bufr_read_synop_test_f"
#Define tmp file
fTmp=${label}".tmp.txt"
rm -f $fTmp
#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
${examples_dir}/eccodes_f_bufr_read_synop > $fTmp
REDIRECT=/dev/null
# Check the output
grep -q 'cloudType .low.:' $fTmp
grep -q 'cloudType .high.:' $fTmp
#Write the values into a file and compare with reference
${examples_dir}/eccodes_f_bufr_read_synop #2> $REDIRECT > $fTmp
#TODO: check the output
#cat $fTmp
#Clean up
rm -f $fTmp