2
0
mirror of https://github.com/Unidata/netcdf-c.git synced 2025-03-31 17:50:26 +08:00

more tests

This commit is contained in:
Ed Hartnett 2017-12-02 18:00:22 -07:00
parent 8055c1cede
commit 9e4c564656
3 changed files with 18 additions and 2 deletions

@ -3,7 +3,7 @@
* This file is part of netcdf-4, a netCDF-like interface for HDF5, or a
* HDF5 backend for netCDF, depending on your point of view.
* This file handles the nc4 variable functions.
* This file handles the NetCDF-4 variable functions.
* Copyright 2003-2006, University Corporation for Atmospheric
* Research. See COPYRIGHT file for copying and redistribution

@ -542,6 +542,20 @@ main(int argc, char **argv)
if (nc_rename_var(ncid, wind_id, "windy")) ERR;
if (nc_inq_varid(ncid, "windy", &wind_id)) ERR;
if (nc_close(ncid)) ERR;
/* Try again without classic. */
if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;
/* define dimension */
if (nc_def_dim(ncid, "lon", lon_len, &lon_dim)) ERR;
/* define variable */
wind_dims[0] = lon_dim;
if (nc_def_var(ncid, "temp", NC_FLOAT, RANK_wind, wind_dims, &wind_id)) ERR;
if (nc_enddef(ncid)) ERR;
if (nc_rename_var(ncid, wind_id, "windy")) ERR;
if (nc_close(ncid)) ERR;
}
SUMMARIZE_ERR;
@ -873,6 +887,7 @@ main(int argc, char **argv)
if (nc_def_var_chunking(ncid, varid2, NC_CHUNKED, chunksize)) ERR;
if (nc_def_var_chunking_ints(ncid, varid2, NC_CHUNKED, chunksize_int)) ERR;
if (nc_def_var_chunking_ints(ncid, varid1, NC_CHUNKED, chunksize_int)) ERR;
if (nc_inq_var_chunking_ints(ncid, varid2, NC_CHUNKED, chunksize_int_in)) ERR;
if (nc_inq_var_chunking_ints(ncid, varid1, NULL, chunksize_int_in)) ERR;
for (d = 0; d < NDIMS5; d++)
if (chunksize_int_in[d] != chunksize[d] * 2) ERR;

@ -398,7 +398,8 @@ main(int argc, char **argv)
/* Try to write some data, but fail. */
if (nc_put_vara_double(ncid + MILLION, 0, start, count, double_data) != NC_EBADID) ERR;
/* if (nc_put_vara_double(ncid + TEST_VAL_42, 0, start, count, double_data) != NC_EBADID) ERR; */
/* This should return NC_EBADID, but returns NC_ENOTVAR. */
if (nc_put_vara_double(ncid + TEST_VAL_42, 0, start, count, double_data) != NC_ENOTVAR) ERR;
if (nc_close(ncid)) ERR;
}