Testing: Add basic test for product kind of samples

This commit is contained in:
Shahram Najm 2019-02-25 10:54:06 +00:00
parent 1b263f0ec8
commit 4430798914
3 changed files with 43 additions and 3 deletions

View File

@ -65,6 +65,7 @@ list( APPEND tests_basic
grib_set_data
large_grib1
sections_copy
get_product_kind_samples
)
list( APPEND tests_extra
grib_iterator

View File

@ -12,10 +12,25 @@
label="get_product_kind_c"
fTmp=${label}.tmp
fOut=${label}.tmp.out
fRef=${label}.tmp.ref
# Create a file containing both GRIB and BUFR messages
# Create a file containing one GRIB and three BUFR messages
cat ${data_dir}/sample.grib2 ${data_dir}/bufr/syno_multi.bufr >$fTmp
${examples_dir}/c_get_product_kind $fTmp
${examples_dir}/c_get_product_kind $fTmp > $fOut
rm -f $fTmp
cat > $fRef <<EOF
message: 0
product: GRIB
message: 1
product: BUFR
message: 2
product: BUFR
message: 3
product: BUFR
EOF
diff ${fRef} ${fOut}
rm -f ${fTmp} ${fRef} ${fOut}

View File

@ -0,0 +1,24 @@
#!/bin/sh
# Copyright 2005-2018 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
#
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
#
. ./include.sh
label="get_product_kind_samples_c"
fTmp=${label}.tmp
sample_grib1=${ECCODES_SAMPLES_PATH}/GRIB1.tmpl
${examples_dir}/c_get_product_kind $sample_grib1 > $fTmp
grep -q 'product: GRIB' $fTmp
sample_bufr4=${ECCODES_SAMPLES_PATH}/BUFR4.tmpl
${examples_dir}/c_get_product_kind $sample_bufr4 > $fTmp
grep -q 'product: BUFR' $fTmp
rm -f $fTmp