Wiring in test contributed by Greg Sjaardema in support of https://github.com/Unidata/netcdf-c/issues/282

This commit is contained in:
Ward Fisher 2016-07-12 16:58:49 -06:00
parent ad8a85769d
commit 2fe943d32e
3 changed files with 49 additions and 5 deletions

View File

@ -9,7 +9,8 @@ SET(NC4_TESTS tst_dims tst_dims2 tst_dims3 tst_files tst_files4 tst_vars
t_type cdm_sea_soundings tst_vl tst_atts1 tst_atts2
tst_vars2 tst_files5 tst_files6 tst_sync tst_h_strbug tst_h_refs
tst_h_scalar tst_rename tst_h5_endians tst_atts_string_rewrite
tst_put_vars_two_unlim_dim tst_hdf5_file_compat tst_fill_attr_vanish)
tst_put_vars_two_unlim_dim tst_hdf5_file_compat tst_fill_attr_vanish
tst_rehash)
# Note, renamegroup needs to be compiled before run_grp_rename
build_bin_test(renamegroup)

View File

@ -22,7 +22,7 @@ tst_xplatform tst_xplatform2 tst_h_atts2 tst_endian_fill tst_atts \
t_type cdm_sea_soundings tst_camrun tst_vl tst_atts1 tst_atts2 \
tst_vars2 tst_files5 tst_files6 tst_sync tst_h_strbug tst_h_refs \
tst_h_scalar tst_rename tst_h5_endians tst_atts_string_rewrite \
tst_hdf5_file_compat tst_fill_attr_vanish
tst_hdf5_file_compat tst_fill_attr_vanish tst_rehash
check_PROGRAMS = $(NC4_TESTS) renamegroup tst_empty_vlen_unlim
@ -125,8 +125,8 @@ run_grp_rename.sh tst_formatx_hdf4.sh \
run_chunk_hdf4.sh contiguous.hdf4 chunked.hdf4 \
tst_h5_endians.c tst_h4_lendian.c tst_atts_string_rewrite.c \
tst_put_vars_two_unlim_dim.c tst_empty_vlen_unlim.c run_empty_vlen_test.sh \
ref_hdf5_compat1.nc ref_hdf5_compat2.nc ref_hdf5_compat3.nc tst_misc.sh tdset.h5 \
tst_hdf4_read_var.sh
ref_hdf5_compat1.nc ref_hdf5_compat2.nc ref_hdf5_compat3.nc tst_misc.sh \
tdset.h5 tst_hdf4_read_var.sh
CLEANFILES = tst_mpi_parallel.bin cdm_sea_soundings.nc bm_chunking.nc \
@ -139,7 +139,7 @@ usi_01.* thetau_01.* tst_*.nc tst_*.h5 \
tst_grp_rename.cdl tst_grp_rename.nc tst_grp_rename.dmp ref_grp_rename.cdl \
foo1.nc tst_interops2.h4 tst_h5_endians.nc tst_h4_lendian.h4 test.nc \
tst_atts_string_rewrite.nc tst_empty_vlen_unlim.nc tst_empty_vlen_lim.nc \
tst_parallel4_simplerw_coll.nc tst_fill_attr_vanish.nc
tst_parallel4_simplerw_coll.nc tst_fill_attr_vanish.nc tst_rehash.nc
if USE_HDF4_FILE_TESTS
DISTCLEANFILES = AMSR_E_L2_Rain_V10_200905312326_A.hdf \

43
nc_test4/tst_rehash.c Normal file
View File

@ -0,0 +1,43 @@
/* This is part of the netCDF package.
Copyright 2016 University Corporation for Atmospheric Research/Unidata
See COPYRIGHT file for conditions of use.
Provided in support of https://github.com/Unidata/netcdf-c/issues/282
Test provided by Greg Sjaardema
Tests to see if the hashmap is being properly updated.
*/
#define FILENAME "tst_rehash.nc"
#include <netcdf.h>
int main()
{
int status;
int id;
int rh_id, varid, v1, v2, v3, v4;
int dimids[2];
nc_create(FILENAME, NC_CLOBBER, &id);
nc_redef(id);
status = nc_def_dim(id, "dim1", 10, &dimids[0]);
status = nc_def_var(id, "dim1", NC_FLOAT, 1, dimids, &v1);
status = nc_def_var(id, "var1", NC_FLOAT, 1, dimids, &v2);
nc_close(id);
nc_open(FILENAME, NC_WRITE, &id);
nc_redef(id);
nc_rename_var(id, v1,"dim_new1");
nc_rename_dim(id, dimids[0], "dim_new1");
status = nc_def_dim(id, "dim2", 20, &dimids[1]);
nc_def_var(id, "dim2", NC_FLOAT, 1, &dimids[1], &v3);
nc_def_var(id, "var2", NC_FLOAT, 2, dimids, &v4);
nc_close(id);
}