mirror of https://github.com/ecmwf/eccodes.git
Testing: Add basic test for product kind of samples
This commit is contained in:
parent
1b263f0ec8
commit
4430798914
|
@ -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
|
||||
|
|
|
@ -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}
|
||||
|
|
|
@ -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
|
Loading…
Reference in New Issue