From 4430798914d9c0f2817d424caaf43640cdfb33e8 Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Mon, 25 Feb 2019 10:54:06 +0000 Subject: [PATCH] Testing: Add basic test for product kind of samples --- examples/C/CMakeLists.txt | 1 + examples/C/get_product_kind.sh | 21 ++++++++++++++++++--- examples/C/get_product_kind_samples.sh | 24 ++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 3 deletions(-) create mode 100755 examples/C/get_product_kind_samples.sh diff --git a/examples/C/CMakeLists.txt b/examples/C/CMakeLists.txt index 2ac333763..b2d664071 100644 --- a/examples/C/CMakeLists.txt +++ b/examples/C/CMakeLists.txt @@ -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 diff --git a/examples/C/get_product_kind.sh b/examples/C/get_product_kind.sh index ba127456f..3e5376960 100755 --- a/examples/C/get_product_kind.sh +++ b/examples/C/get_product_kind.sh @@ -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 < $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