NOAA-EMC / NCEPLIBS-bufr

The NCEPLIBS-bufr library contains routines and utilites for working with the WMO BUFR format.
Other
44 stars 19 forks source link

add utility to dump table. #87

Closed aerorahul closed 3 years ago

aerorahul commented 3 years ago

Add another utility from @jack-woollen that dumps the bufr table from a file.

edwardhartnett commented 3 years ago

Where is the test?

aerorahul commented 3 years ago

I can add a test for this utility from Jack that used to live in some random directory. None of these utilities have tests and used to be scattered. The test should test dxdump, not this utility, btw.

edwardhartnett commented 3 years ago

Tests are required for all additions to this repo. Please take this into consideration for all future planning of work on this and all other NCEPLIBS repositories.

Any programmer that does not have time to write the tests needs to manage their time and schedule better, in order to meet this well-defined and often-repeated requirement. Anyone who needs help or training in testing techniques should ask.

In this case, it seems like you would want to dump some of the test files that Jeff is already downloading in testing, and then also capture their text output. Then store the text output in either the tarball or the repo (if not too large), and write a shell script test which runs the utility and uses cmp to check the output. Probably you want more than one test, so you can get a range of output.

@jbathegit has been instructed to require tests for all code changes to this repo. This is a very firm requirement. If I could have it etched in stone and mounted above the desk of every NOAA programmer, I would do so.

edwardhartnett commented 3 years ago

Here's a sample from netcdf-c in the ncdump directory, run_tests.sh. You see how it tests the ncgen and ncdump utilities, against each other, and also against a reference output file that is in the test directory, ref_tst_small.cdl.

#!/bin/sh
# This shell script runs the ncdump tests.
# Ed Hartnett, Dennis Heimbigner

if test "x$srcdir" = x ; then srcdir=`pwd`; fi
. ../test_common.sh

set -e
echo ""
echo "*** Testing ncgen and ncdump using some test CDL files."
echo "*** creating tst_small.nc from ref_tst_small.cdl..."
${NCGEN} -b -o tst_small.nc $srcdir/ref_tst_small.cdl
echo "*** creating tst_small.cdl from tst_small.nc..."
${NCDUMP} tst_small.nc > tst_small.cdl
diff -b -w tst_small.cdl $srcdir/ref_tst_small.cdl

echo "*** creating test0_ncdump.nc from test0.cdl..."
${NCGEN} -o test0_ncdump.nc -b $srcdir/test0.cdl
echo "*** creating test1_ncdump.cdl from test0_ncdump.nc..."
${NCDUMP} -n test1_ncdump test0_ncdump.nc > test1_ncdump.cdl
echo "*** creating test1_ncdump.nc from test1_ncdump.cdl..."
${NCGEN} -b test1_ncdump.cdl
echo "*** creating test2_ncdump.cdl from test1_ncdump.nc..."
${NCDUMP} test1_ncdump.nc > test2_ncdump.cdl
echo "*** checking that test1_ncdump.cdl and test2_ncdump.cdl are the same..."
diff -b -w test1_ncdump.cdl test2_ncdump.cdl

echo "*** All tests of ncgen and ncdump using test0.cdl passed!"
exit 0