added fill mode test
Corporation for Atmospheric Research/Unidata See COPYRIGHT file for
conditions of use. See www.unidata.ucar.edu for more info.
- Create a test file with default fill values for variables of each type.
+ Create a test file with default fill values for variables of each
+ type.
- $Id: tst_fills.c,v 1.12 2009/03/17 01:22:42 ed Exp $
+ Ed Hartnett
*/
#include <nc_tests.h>
@@ -324,5 +325,38 @@ main(int argc, char **argv)
if (nc_close(ncid)) ERR;
}
SUMMARIZE_ERR;
+ printf("*** testing fill mode...");
+#define NDIM1 1
+#define DIM_LEN 4
+#define DIM_NAME "my_dim"
+#define VAR_NAME "my_var"
+ {
+ int ncid;
+ int dimid;
+ int varid;
+ int cmode = 0;
+ char testfile[] = "test.nc";
+ size_t index = 2;
+ int test_val = 42;
+ int no_fill;
+ int ret;
+
+ if ((ret = nc_create(testfile, cmode, &ncid)))
+ return ret;
+ if ((ret = nc_def_dim(ncid, DIM_NAME, DIM_LEN, &dimid)))
+ return ret;
+ if ((ret = nc_def_var(ncid, VAR_NAME, NC_INT, NDIM1, &dimid, &varid)))
+ return ret;
+ if ((ret = nc_enddef(ncid)))
+ return ret;
+ if ((ret = nc_put_var1_int(ncid, varid, &index, &test_val)))
+ return ret;
+ if ((ret = nc_inq_var_fill(ncid, varid, &no_fill, NULL)))
+ return ret;
+ if (no_fill) ERR;
+ if ((ret = nc_close(ncid)))
+ return ret;
+ }
+ SUMMARIZE_ERR;
FINAL_RESULTS;
}
