testing nc_def_var_szip when szip has not been built into HDF5
/* This is part of the netCDF package.
- Copyright 2018 University Corporation for Atmospheric Research/Unidata
+ Copyright 2020 University Corporation for Atmospheric Research/Unidata
See COPYRIGHT file for conditions of use.
Test netcdf-4 variables.
@@ -621,5 +621,29 @@ main(int argc, char **argv)
}
SUMMARIZE_ERR;
#endif /* USE_SZIP */
+#ifndef USE_SZIP
+ /* This code is run if szip is not present in HDF5. It checks that
+ * nc_def_var_szip() returns NC_EFILTER in that case. */
+ printf("**** testing szip filter when szip is not built into HDF5...");
+ {
+ int ncid;
+ int dimid;
+ int varid;
+ int options_mask = NC_SZIP_NN_OPTION_MASK;
+ int bits_per_pixel = NC_SZIP_EC_BPP_IN;
+
+ /* Create a netcdf-4 file with one dimensions. */
+ if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;
+ if (nc_def_dim(ncid, DIM_NAME_1, DIM_LEN_1, &dimid)) ERR;
+
+ /* Add a var. Turn on szip filter. */
+ if (nc_def_var(ncid, V_SMALL, NC_INT64, NDIMS1, &dimid, &varid)) ERR;
+ if (nc_def_var_chunking(ncid, varid, NC_CHUNKED, NULL)) ERR;
+ if (nc_def_var_szip(ncid, varid, options_mask,
+ bits_per_pixel) != NC_EFILTER) ERR;
+ if (nc_close(ncid)) ERR;
+ }
+ SUMMARIZE_ERR;
+#endif /* not USE_SZIP */
FINAL_RESULTS;
}
