From bfeb8d4e0bbd8b50b76c8a478f279cb4e9694145 Mon Sep 17 00:00:00 2001 From: Ed Hartnett Date: Sat, 2 Dec 2017 07:38:01 -0700 Subject: [PATCH] more testing --- libsrc4/nc4var.c | 8 +------- nc_test4/tst_vars2.c | 6 +++++- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/libsrc4/nc4var.c b/libsrc4/nc4var.c index 5e902dd71..fb379f76f 100644 --- a/libsrc4/nc4var.c +++ b/libsrc4/nc4var.c @@ -977,18 +977,12 @@ nc_def_var_extra(int ncid, int varid, int *shuffle, int *deflate, /* Find info for this file and group, and set pointer to each. */ if ((retval = nc4_find_nc_grp_h5(ncid, &nc, &grp, &h5))) return retval; + assert(nc && grp && h5); #ifdef USE_HDF4 ishdf4 = h5->hdf4; #endif - /* Attempting to do any of these things on a netCDF-3 file produces - * an error. */ - if (!h5) - return NC_ENOTNC4; - - assert(nc && grp && h5); - /* Find the var. */ if (varid < 0 || varid >= grp->vars.nelems) return NC_ENOTVAR; diff --git a/nc_test4/tst_vars2.c b/nc_test4/tst_vars2.c index 82313f427..e7577e75c 100644 --- a/nc_test4/tst_vars2.c +++ b/nc_test4/tst_vars2.c @@ -751,7 +751,11 @@ main(int argc, char **argv) /* Define the variable. */ if (nc_def_var(ncid, VAR_NAME5, NC_INT, NDIMS5, dimids, &varid)) ERR; - /* This will fail due to bad chunk size. */ + /* These will fail due to bad parameters. */ + if (nc_def_var_chunking(ncid + MILLION, varid, NC_CHUNKED, + chunksize) != NC_EBADID) ERR; + if (nc_def_var_chunking(ncid + TEST_VAL_42, varid, NC_CHUNKED, + chunksize) != NC_EBADID) ERR; if (nc_def_var_chunking(ncid, varid, NC_CHUNKED, bad_chunksize) != NC_EBADCHUNK) ERR;