Tweaking cdl files so that we can compare against them.

This commit is contained in:
Ward Fisher 2016-11-18 11:07:20 -07:00
parent b848280d3f
commit c3ae660730
3 changed files with 48 additions and 22 deletions

View File

@ -159,8 +159,7 @@ data:
d2 = -1e+308, 1e+308 ;
// c3 = "\001\300." ; This is actually illegal utf8
c3 = "\001\177." ;
c3 = "\001\177." ;
b3 = -128, 127, -1 ;
@ -382,4 +381,8 @@ data:
var-name-dashes = -1 ;
var.name.dots = -2 ;
var+name+plusses = _ ;
var@name@ats = _;
}

View File

@ -1,4 +1,4 @@
netcdf c0 {
netcdf c0_4 {
dimensions:
Dr = UNLIMITED ; // (2 currently)
D1 = 1 ;
@ -20,7 +20,7 @@ variables:
s:b = 0b, 127b, -128b, -1b ;
s:s = -32768s, 0s, 32767s ;
int i ;
i:i = -2147483647, 0, 2147483647L ;
i:i = -2147483647, 0, 2147483647 ;
i:f = -1.e+36f, 0.f, 1.e+36f ;
i:d = -1.e+308, 0., 1.e+308 ;
float f ;
@ -28,9 +28,9 @@ variables:
double d ;
d:c = "abcd\tZ$&" ;
int64 i64 ;
i64:att_int64 = 1LL ;
i64:att_int64 = 1 ;
uint64 ui64 ;
ui64:att_uint64 = 1ULL ;
ui64:att_uint64 = 1 ;
char cr(Dr) ;
byte br(Dr) ;
short sr(Dr) ;
@ -127,9 +127,9 @@ data:
d = -10 ;
i64 = 9223372036854775807LL;
i64 = 9223372036854775807;
ui64 = 18446744073709551615ULL;
ui64 = 18446744073709551615;
cr = "ab" ;
@ -389,4 +389,8 @@ data:
var-name-dashes = -1 ;
var.name.dots = -2 ;
var+name+plusses = _ ;
var@name@ats = _ ;
}

View File

@ -4,35 +4,54 @@
if test "x$srcdir" = x ; then srcdir="."; fi
##
# Function to test a netCDF CDL file.
# 1. Generate binary nc.
# Use ncdump to compare against original CDL file.
# Input: CDL file name, minus the suffix.
# Other input: arguments.
#
# Example:
# $ validateNC compound_datasize_test -k nc4
##
validateNC() {
BASENAME=$1
INFILE=$srcdir/$1.cdl
TMPFILE="tst_$1".cdl
shift
ARGS=$@
echo "*** generating $BASENAME.nc ***"
./ncgen $ARGS $INFILE
../ncdump/ncdump $BASENAME.nc > $TMPFILE
echo "*** comparing binary against source CDL file *** "
diff -b -w $INFILE $TMPFILE
}
echo "*** Testing ncgen for netCDF-4."
set -e
echo "*** creating netCDF-4 file c0_4.nc from c0_4.cdl..."
./ncgen -k nc4 -b -o c0_4.nc $srcdir/c0_4.cdl
validateNC "c0_4" -k nc4 -b -o c0_4.nc
echo "*** creating netCDF-4 classic model file c0_4c.nc from c0.cdl..."
./ncgen -k nc7 -b -o c0_4c.nc $srcdir/c0.cdl
validateNC "c0" -k nc7 -b
echo "*** creating C code for CAM file ref_camrun.cdl..."
./ncgen -lc $srcdir/ref_camrun.cdl >ref_camrun.c
echo "*** test for jira NCF-199 bug"
./ncgen -k nc4 $srcdir/ncf199.cdl
../ncdump/ncdump ncf199.nc > tst_ncf199.cdl
echo "*** comparing binary against source file..."
diff -b -w $srcdir/ncf199.cdl tst_ncf199.cdl
validateNC "ncf199" -k nc4
echo "*** creating binary files for github issue 323..."
echo "*** github issue 323 test 1"
./ncgen -k nc4 $srcdir/compound_datasize_test.cdl
../ncdump/ncdump compound_datasize_test.nc > tst_compound_datasize_test.cdl
echo "*** comparing binary against source file..."
diff -b -w $srcdir/compound_datasize_test.cdl tst_compound_datasize_test.cdl
validateNC "compound_datasize_test" -k nc4
echo "*** github issue 323 test 2"
./ncgen -k nc4 $srcdir/compound_datasize_test2.cdl
../ncdump/ncdump compound_datasize_test2.nc > tst_compound_datasize_test2.cdl
echo "*** comparing binary against source file..."
diff -b -w $srcdir/compound_datasize_test2.cdl tst_compound_datasize_test2.cdl
validateNC "compound_datasize_test2" -k nc4
echo "*** Test successful!"
exit 0