diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2007-10-18 22:02:19 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2007-10-18 22:02:19 (GMT) |
commit | a5984f59f71739531fb78c3933a726e73dd54328 (patch) | |
tree | 839fdd36b93e7976c97b9a351e3937266d1dd7b3 /test | |
parent | cf56cd041d119914d7a9bee79c22e59a8ce85059 (diff) | |
download | hdf5-a5984f59f71739531fb78c3933a726e73dd54328.zip hdf5-a5984f59f71739531fb78c3933a726e73dd54328.tar.gz hdf5-a5984f59f71739531fb78c3933a726e73dd54328.tar.bz2 |
[svn-r14212] Description:
Make H5Tarray_create() and H5Tget_array_dims() versioned, and drop the
"perm" parameter from the '2' versions.
Shift internal library usage to '2' versions.
Add simple regression tests for '1' versions.
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
Diffstat (limited to 'test')
-rw-r--r-- | test/cmpd_dset.c | 32 | ||||
-rw-r--r-- | test/dsets.c | 20 | ||||
-rw-r--r-- | test/dtypes.c | 106 | ||||
-rw-r--r-- | test/gen_new_array.c | 12 | ||||
-rw-r--r-- | test/ntypes.c | 12 | ||||
-rw-r--r-- | test/tarray.c | 100 | ||||
-rw-r--r-- | test/tsohm.c | 8 |
7 files changed, 163 insertions, 127 deletions
diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c index 85c2318..66993e0 100644 --- a/test/cmpd_dset.c +++ b/test/cmpd_dset.c @@ -231,7 +231,7 @@ test_compound (char *filename, hid_t fapl) /* Create the memory data type */ if((s1_tid = H5Tcreate(H5T_COMPOUND, sizeof(s1_t))) < 0) goto error; - array_dt = H5Tarray_create(H5T_NATIVE_INT, 1, memb_size, NULL); + array_dt = H5Tarray_create2(H5T_NATIVE_INT, 1, memb_size); if(H5Tinsert(s1_tid, "a", HOFFSET(s1_t, a), H5T_NATIVE_INT) < 0 || H5Tinsert(s1_tid, "b", HOFFSET(s1_t, b), H5T_NATIVE_INT) < 0 || H5Tinsert(s1_tid, "c", HOFFSET(s1_t, c), array_dt) < 0 || @@ -261,7 +261,7 @@ test_compound (char *filename, hid_t fapl) /* Create a data type for s2 */ if ((s2_tid = H5Tcreate (H5T_COMPOUND, sizeof(s2_t))) < 0) goto error; - array_dt = H5Tarray_create(H5T_NATIVE_INT, 1, memb_size, NULL); + array_dt = H5Tarray_create2(H5T_NATIVE_INT, 1, memb_size); if (H5Tinsert (s2_tid, "a", HOFFSET(s2_t,a), H5T_NATIVE_INT) < 0 || H5Tinsert (s2_tid, "b", HOFFSET(s2_t,b), H5T_NATIVE_INT) < 0 || H5Tinsert (s2_tid, "c", HOFFSET(s2_t,c), array_dt) < 0 || @@ -303,7 +303,7 @@ test_compound (char *filename, hid_t fapl) /* Create a data type for s3 */ if ((s3_tid = H5Tcreate (H5T_COMPOUND, sizeof(s3_t))) < 0) goto error; - array_dt = H5Tarray_create(H5T_NATIVE_INT, 1, memb_size, NULL); + array_dt = H5Tarray_create2(H5T_NATIVE_INT, 1, memb_size); if (H5Tinsert (s3_tid, "a", HOFFSET(s3_t,a), H5T_NATIVE_INT) < 0 || H5Tinsert (s3_tid, "b", HOFFSET(s3_t,b), H5T_NATIVE_INT) < 0 || H5Tinsert (s3_tid, "c", HOFFSET(s3_t,c), array_dt) < 0 || @@ -380,7 +380,7 @@ test_compound (char *filename, hid_t fapl) /* Create a data type for s5 */ if ((s5_tid = H5Tcreate (H5T_COMPOUND, sizeof(s5_t))) < 0) goto error; - array_dt = H5Tarray_create(H5T_NATIVE_INT, 1, memb_size, NULL); + array_dt = H5Tarray_create2(H5T_NATIVE_INT, 1, memb_size); if (H5Tinsert (s5_tid, "a", HOFFSET(s5_t,a), H5T_NATIVE_INT) < 0 || H5Tinsert (s5_tid, "b", HOFFSET(s5_t,b), H5T_NATIVE_INT) < 0 || H5Tinsert (s5_tid, "c", HOFFSET(s5_t,c), array_dt) < 0 || @@ -452,7 +452,7 @@ test_compound (char *filename, hid_t fapl) /* Create a data type for s6 */ if ((s6_tid = H5Tcreate (H5T_COMPOUND, sizeof(s6_t))) < 0) goto error; - array_dt = H5Tarray_create(H5T_NATIVE_INT, 1, memb_size, NULL); + array_dt = H5Tarray_create2(H5T_NATIVE_INT, 1, memb_size); if (H5Tinsert (s6_tid, "a", HOFFSET(s6_t,a), H5T_NATIVE_INT) < 0 || H5Tinsert (s6_tid, "b", HOFFSET(s6_t,b), H5T_NATIVE_INT) < 0 || H5Tinsert (s6_tid, "c", HOFFSET(s6_t,c), array_dt) < 0 || @@ -1034,12 +1034,12 @@ create_stype1(void) const hsize_t eight = 8, sixteen = 16; /* Build hdf5 datatypes */ - if((array_dt1 = H5Tarray_create(H5T_NATIVE_INT,1, &eight, NULL)) < 0) + if((array_dt1 = H5Tarray_create2(H5T_NATIVE_INT,1, &eight)) < 0) goto error; - if((array_dt2 = H5Tarray_create(H5T_NATIVE_FLOAT,1, &sixteen, NULL)) < 0) + if((array_dt2 = H5Tarray_create2(H5T_NATIVE_FLOAT,1, &sixteen)) < 0) goto error; - if ((tid=H5Tcreate(H5T_COMPOUND, sizeof(stype1))) < 0 || + if((tid = H5Tcreate(H5T_COMPOUND, sizeof(stype1))) < 0 || H5Tinsert(tid, "a", HOFFSET(stype1, a), H5T_NATIVE_INT) < 0 || H5Tinsert(tid, "b", HOFFSET(stype1, b), H5T_NATIVE_INT) < 0 || H5Tinsert(tid, "c", HOFFSET(stype1, c), array_dt1) < 0 || @@ -1090,12 +1090,12 @@ create_stype2(void) const hsize_t eight = 8, sixteen = 16; /* Build hdf5 datatypes */ - if((array_dt1 = H5Tarray_create(H5T_NATIVE_INT,1, &eight, NULL)) < 0) + if((array_dt1 = H5Tarray_create2(H5T_NATIVE_INT,1, &eight)) < 0) goto error; - if((array_dt2 = H5Tarray_create(H5T_NATIVE_FLOAT,1, &sixteen, NULL)) < 0) + if((array_dt2 = H5Tarray_create2(H5T_NATIVE_FLOAT,1, &sixteen)) < 0) goto error; - if ((tid=H5Tcreate(H5T_COMPOUND, sizeof(stype2))) < 0 || + if((tid = H5Tcreate(H5T_COMPOUND, sizeof(stype2))) < 0 || H5Tinsert(tid, "a", HOFFSET(stype2, a), H5T_NATIVE_INT) < 0 || H5Tinsert(tid, "b", HOFFSET(stype2, b), H5T_NATIVE_INT) < 0 || H5Tinsert(tid, "c", HOFFSET(stype2, c), array_dt1) < 0 || @@ -1149,10 +1149,10 @@ create_stype3(void) const hsize_t eight = 8; /* Build hdf5 datatypes */ - if((array_dt1 = H5Tarray_create(H5T_NATIVE_INT,1, &eight, NULL)) < 0) + if((array_dt1 = H5Tarray_create2(H5T_NATIVE_INT,1, &eight)) < 0) goto error; - if ((tid=H5Tcreate(H5T_COMPOUND, sizeof(stype3))) < 0 || + if((tid = H5Tcreate(H5T_COMPOUND, sizeof(stype3))) < 0 || H5Tinsert(tid, "a", HOFFSET(stype3, a), H5T_NATIVE_INT) < 0 || H5Tinsert(tid, "b", HOFFSET(stype3, b), H5T_NATIVE_INT) < 0 || H5Tinsert(tid, "c", HOFFSET(stype3, c), array_dt1) < 0 || @@ -1192,12 +1192,12 @@ create_stype4(void) const hsize_t eight = 8, sixteen = 16; /* Build hdf5 datatypes */ - if((array_dt1 = H5Tarray_create(H5T_NATIVE_INT,1, &eight, NULL)) < 0) + if((array_dt1 = H5Tarray_create2(H5T_NATIVE_INT,1, &eight)) < 0) goto error; - if((array_dt2 = H5Tarray_create(H5T_NATIVE_FLOAT,1, &sixteen, NULL)) < 0) + if((array_dt2 = H5Tarray_create2(H5T_NATIVE_FLOAT,1, &sixteen)) < 0) goto error; - if ((tid=H5Tcreate(H5T_COMPOUND, sizeof(stype4))) < 0 || + if((tid = H5Tcreate(H5T_COMPOUND, sizeof(stype4))) < 0 || H5Tinsert(tid, "a", HOFFSET(stype4, a), H5T_NATIVE_INT) < 0 || H5Tinsert(tid, "b", HOFFSET(stype4, b), H5T_NATIVE_INT) < 0 || H5Tinsert(tid, "c", HOFFSET(stype4, c), array_dt1) < 0 || diff --git a/test/dsets.c b/test/dsets.c index 0f3b330..d7bfe8f 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -830,9 +830,9 @@ test_conv_buffer(hid_t fid) /* Create the memory data type */ if((ctype1 = H5Tcreate(H5T_COMPOUND, sizeof (CmpField))) < 0) goto error; - if((arr_type1 = H5Tarray_create(H5T_NATIVE_INT, 3, dimsa, NULL)) < 0) goto error; - if((arr_type2 = H5Tarray_create(H5T_NATIVE_FLOAT, 1, dimsb, NULL)) < 0) goto error; - if((arr_type3 = H5Tarray_create(H5T_NATIVE_DOUBLE, 1, dimsc, NULL)) < 0) goto error; + if((arr_type1 = H5Tarray_create2(H5T_NATIVE_INT, 3, dimsa)) < 0) goto error; + if((arr_type2 = H5Tarray_create2(H5T_NATIVE_FLOAT, 1, dimsb)) < 0) goto error; + if((arr_type3 = H5Tarray_create2(H5T_NATIVE_DOUBLE, 1, dimsc)) < 0) goto error; if(H5Tinsert(ctype1, "A", HOFFSET(CmpField, a), arr_type1) < 0) goto error; if(H5Tinsert (ctype1, "B", HOFFSET(CmpField, b), arr_type2) < 0) goto error; @@ -844,8 +844,8 @@ test_conv_buffer(hid_t fid) if((ctype2 = H5Tcreate(H5T_COMPOUND, sizeof (CmpFieldR))) < 0) goto error; - if((arr_type4 = H5Tarray_create(H5T_NATIVE_FLOAT, 1, dimsb, NULL)) < 0) goto error; - if((arr_type5 = H5Tarray_create(H5T_NATIVE_DOUBLE, 1, dimsc, NULL)) < 0) goto error; + if((arr_type4 = H5Tarray_create2(H5T_NATIVE_FLOAT, 1, dimsb)) < 0) goto error; + if((arr_type5 = H5Tarray_create2(H5T_NATIVE_DOUBLE, 1, dimsc)) < 0) goto error; if(H5Tinsert (ctype2, "B", HOFFSET(CmpFieldR, b), arr_type4) < 0) goto error; if(H5Tinsert (ctype2, "C", HOFFSET(CmpFieldR, c), arr_type5) < 0) goto error; @@ -2959,10 +2959,10 @@ test_nbit_array(hid_t file) if(H5Tset_order(base_datatype, H5T_ORDER_BE) < 0) goto error; /* Create dataset array datatype */ - array_datatype = H5Tarray_create(base_datatype, 2, adims, NULL); + array_datatype = H5Tarray_create2(base_datatype, 2, adims); /* Create memory array datatype */ - mem_array_datatype = H5Tarray_create(mem_base_datatype, 2, adims, NULL); + mem_array_datatype = H5Tarray_create2(mem_base_datatype, 2, adims); /* Create the data space */ if((space = H5Screate_simple(2, size, NULL)) < 0) goto error; @@ -3370,11 +3370,11 @@ test_nbit_compound_2(hid_t file) base_tid = H5Tcopy(H5T_NATIVE_CHAR); if(H5Tset_precision(base_tid,precision[4]) < 0) goto error; if(H5Tset_offset(base_tid,offset[4]) < 0) goto error; - array_tid = H5Tarray_create(base_tid, 2, array_dims, NULL); + array_tid = H5Tarray_create2(base_tid, 2, array_dims); /* Create the complex memory and dataset array datatype */ - array_cmplx_tid = H5Tarray_create(cmpd_tid1, 2, array_dims, NULL); - mem_array_cmplx_tid = H5Tarray_create(mem_cmpd_tid1, 2, array_dims, NULL); + array_cmplx_tid = H5Tarray_create2(cmpd_tid1, 2, array_dims); + mem_array_cmplx_tid = H5Tarray_create2(mem_cmpd_tid1, 2, array_dims); /* Create a memory complex compound datatype before setting the order */ mem_cmpd_tid2 = H5Tcreate(H5T_COMPOUND, sizeof(complex)); diff --git a/test/dtypes.c b/test/dtypes.c index e527757..bf98761 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -327,10 +327,10 @@ test_detect(void) hid_t atom_arr_id; /* Atomic Array datatype */ hid_t atom_vlf_id; /* Atomic VL datatype of float */ hid_t atom_vlc_id; /* Atomic VL datatype of char */ - hid_t atom_vls_id; /* Atomic VL string datatype */ + hid_t atom_vls_id; /* Atomic VL string datatype */ hid_t cplx_cmpd_id; /* Complex Compound datatype */ - unsigned rank = 2; /* Rank for array datatype */ - hsize_t dims[2]={3,3}; /* Dimensions for array datatype */ + unsigned rank = 2; /* Rank for array datatype */ + hsize_t dims[2] = {3,3}; /* Dimensions for array datatype */ TESTING("H5Tdetect_class()"); @@ -367,20 +367,8 @@ test_detect(void) /*-------------------------------------------------------------------------------- * Test class of some complex types. *------------------------------------------------------------------------------*/ - /* Try to create array datatype with a dimension permutation (should fail) */ - H5E_BEGIN_TRY { - int perm[2]={0,1}; /* Dimensions permutations for array datatype */ - - atom_arr_id = H5Tarray_create(H5T_STD_REF_OBJ, rank, dims, perm); - } H5E_END_TRY; - if(atom_arr_id>=0) { - H5_FAILED(); - printf("Dimension permutation accepted?\n"); - goto error; - } /* end if */ - /* Create an array datatype with an atomic base type */ - if((atom_arr_id = H5Tarray_create(H5T_STD_REF_OBJ, rank, dims, NULL)) < 0) TEST_ERROR + if((atom_arr_id = H5Tarray_create2(H5T_STD_REF_OBJ, rank, dims)) < 0) TEST_ERROR /* Make certain that the correct classes can be detected */ if(H5Tdetect_class(atom_arr_id,H5T_ARRAY)!=TRUE) TEST_ERROR @@ -699,8 +687,8 @@ test_compound_2(void) HDmemcpy(buf, orig, nelmts*sizeof(struct st)); /* Build hdf5 datatypes */ - array_dt = H5Tarray_create(H5T_NATIVE_INT,1, &four, NULL); - if ((st=H5Tcreate(H5T_COMPOUND, sizeof(struct st))) < 0 || + array_dt = H5Tarray_create2(H5T_NATIVE_INT,1, &four); + if((st = H5Tcreate(H5T_COMPOUND, sizeof(struct st))) < 0 || H5Tinsert(st, "a", HOFFSET(struct st, a), H5T_NATIVE_INT) < 0 || H5Tinsert(st, "b", HOFFSET(struct st, b), H5T_NATIVE_INT) < 0 || H5Tinsert(st, "c", HOFFSET(struct st, c), array_dt) < 0 || @@ -709,8 +697,8 @@ test_compound_2(void) goto error; H5Tclose(array_dt); - array_dt = H5Tarray_create(H5T_NATIVE_INT, 1, &four, NULL); - if ((dt=H5Tcreate(H5T_COMPOUND, sizeof(struct dt))) < 0 || + array_dt = H5Tarray_create2(H5T_NATIVE_INT, 1, &four); + if((dt = H5Tcreate(H5T_COMPOUND, sizeof(struct dt))) < 0 || H5Tinsert(dt, "a", HOFFSET(struct dt, a), H5T_NATIVE_INT) < 0 || H5Tinsert(dt, "b", HOFFSET(struct dt, b), H5T_NATIVE_INT) < 0 || H5Tinsert(dt, "c", HOFFSET(struct dt, c), array_dt) < 0 || @@ -816,8 +804,8 @@ test_compound_3(void) HDmemcpy(buf, orig, nelmts*sizeof(struct st)); /* Build hdf5 datatypes */ - array_dt = H5Tarray_create(H5T_NATIVE_INT, 1, &four, NULL); - if ((st=H5Tcreate(H5T_COMPOUND, sizeof(struct st))) < 0 || + array_dt = H5Tarray_create2(H5T_NATIVE_INT, 1, &four); + if((st = H5Tcreate(H5T_COMPOUND, sizeof(struct st))) < 0 || H5Tinsert(st, "a", HOFFSET(struct st, a), H5T_NATIVE_INT) < 0 || H5Tinsert(st, "b", HOFFSET(struct st, b), H5T_NATIVE_INT) < 0 || H5Tinsert(st, "c", HOFFSET(struct st, c), array_dt) < 0 || @@ -826,8 +814,8 @@ test_compound_3(void) goto error; H5Tclose(array_dt); - array_dt = H5Tarray_create(H5T_NATIVE_INT, 1, &four, NULL); - if ((dt=H5Tcreate(H5T_COMPOUND, sizeof(struct dt))) < 0 || + array_dt = H5Tarray_create2(H5T_NATIVE_INT, 1, &four); + if((dt = H5Tcreate(H5T_COMPOUND, sizeof(struct dt))) < 0 || H5Tinsert(dt, "a", HOFFSET(struct dt, a), H5T_NATIVE_INT) < 0 || H5Tinsert(dt, "c", HOFFSET(struct dt, c), array_dt) < 0 || H5Tinsert(dt, "e", HOFFSET(struct dt, e), H5T_NATIVE_INT) < 0) @@ -934,8 +922,8 @@ test_compound_4(void) HDmemcpy(buf, orig, nelmts*sizeof(struct st)); /* Build hdf5 datatypes */ - array_dt = H5Tarray_create(H5T_NATIVE_INT, 1, &four, NULL); - if ((st=H5Tcreate(H5T_COMPOUND, sizeof(struct st))) < 0 || + array_dt = H5Tarray_create2(H5T_NATIVE_INT, 1, &four); + if((st = H5Tcreate(H5T_COMPOUND, sizeof(struct st))) < 0 || H5Tinsert(st, "a", HOFFSET(struct st, a), H5T_NATIVE_INT) < 0 || H5Tinsert(st, "b", HOFFSET(struct st, b), H5T_NATIVE_INT) < 0 || H5Tinsert(st, "c", HOFFSET(struct st, c), array_dt) < 0 || @@ -944,8 +932,8 @@ test_compound_4(void) goto error; H5Tclose(array_dt); - array_dt = H5Tarray_create(H5T_NATIVE_INT, 1, &four, NULL); - if ((dt=H5Tcreate(H5T_COMPOUND, sizeof(struct dt))) < 0 || + array_dt = H5Tarray_create2(H5T_NATIVE_INT, 1, &four); + if((dt = H5Tcreate(H5T_COMPOUND, sizeof(struct dt))) < 0 || H5Tinsert(dt, "a", HOFFSET(struct dt, a), H5T_NATIVE_INT) < 0 || H5Tinsert(dt, "b", HOFFSET(struct dt, b), H5T_NATIVE_SHORT) < 0 || H5Tinsert(dt, "c", HOFFSET(struct dt, c), array_dt) < 0 || @@ -1052,12 +1040,12 @@ test_compound_5(void) /* Build datatypes */ short_array = H5Tcreate(H5T_COMPOUND, 4*sizeof(short)); - array_dt = H5Tarray_create(H5T_NATIVE_SHORT, 1, dims, NULL); + array_dt = H5Tarray_create2(H5T_NATIVE_SHORT, 1, dims); H5Tinsert(short_array, "_", 0, array_dt); H5Tclose(array_dt); int_array = H5Tcreate(H5T_COMPOUND, 4*sizeof(int)); - array_dt = H5Tarray_create(H5T_NATIVE_INT, 1, dims, NULL); + array_dt = H5Tarray_create2(H5T_NATIVE_INT, 1, dims); H5Tinsert(int_array, "_", 0, array_dt); H5Tclose(array_dt); @@ -1803,7 +1791,7 @@ test_compound_10(void) } /* end if */ /* Create the array datatype for c_string data */ - if((arr_tid = H5Tarray_create(cmpd_tid, 1, arr_dim, NULL)) < 0) { + if((arr_tid = H5Tarray_create2(cmpd_tid, 1, arr_dim)) < 0) { H5_FAILED(); AT(); printf("Can't create array type\n"); goto error; @@ -4683,7 +4671,7 @@ error: /*------------------------------------------------------------------------- - * Function: test_compat + * Function: test_deprec * * Purpose: Tests deprecated API routines for datatypes. * @@ -4697,15 +4685,63 @@ error: */ #ifndef H5_NO_DEPRECATED_SYMBOLS static int -test_compat(hid_t fapl) +test_deprec(hid_t fapl) { hid_t file = -1; /* File ID */ hid_t type = -1; /* Datatype ID */ + unsigned rank = 2; /* Rank for array datatype */ + hsize_t dims[2] = {3, 3}; /* Dimensions for array datatype */ + int perm[2] = {0, 1}; /* Dimensions permutations for array datatype */ + hsize_t rdims[2]= {0, 0}; /* Dimensions for querying array datatype */ + int rperm[2] = {-2, -2}; /* Dimensions permutations for array datatype */ + hbool_t dim_mismatch; /* Whether any dimensions didn't match */ char filename[1024]; + unsigned u; /* Local index variable */ herr_t status; /* Generic routine value */ TESTING("deprected API routines for datatypes"); + /* Create an array datatype with an atomic base type */ + /* (dimension permutations allowed, but not stored) */ + if((type = H5Tarray_create1(H5T_NATIVE_INT, rank, dims, perm)) < 0) + FAIL_STACK_ERROR + + /* Make certain that the correct classes can be detected */ + if(H5Tdetect_class(type, H5T_ARRAY) != TRUE) + FAIL_STACK_ERROR + if(H5Tdetect_class(type, H5T_INTEGER) != TRUE) + FAIL_STACK_ERROR + + /* Get the array dimensions */ + /* (Query the dimension permutations, which is allowed, but ignored) */ + if(H5Tget_array_dims1(type, rdims, rperm) < 0) + FAIL_STACK_ERROR + + /* Check the array dimensions */ + dim_mismatch = FALSE; + for(u = 0; u < rank; u++) + if(rdims[u] != dims[u]) { + TestErrPrintf("Array dimension information doesn't match!, rdims1[%u]=%d, tdims1[%u]=%d\n", u, (int)rdims[u], u, (int)dims[u]); + dim_mismatch = TRUE; + } /* end if */ + if(dim_mismatch) + FAIL_PUTS_ERROR(" Dimensions didn't match!") + + /* Check the array dimension permutations */ + dim_mismatch = FALSE; + for(u = 0; u < rank; u++) + if(rperm[u] != -2) { + TestErrPrintf("Array dimension permutation information was modified!, rdims1[%u]=%d, tdims1[%u]=%d\n", u, rperm[u], u, perm[u]); + dim_mismatch = TRUE; + } /* end if */ + if(dim_mismatch) + FAIL_PUTS_ERROR(" Dimension permutations modified!") + + /* Close the datatype */ + if(H5Tclose(type) < 0) + FAIL_STACK_ERROR + + h5_fixname(FILENAME[1], fapl, filename, sizeof filename); if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR @@ -4760,7 +4796,7 @@ error: H5Fclose(file); } H5E_END_TRY; return 1; -} /* end test_compat() */ +} /* end test_deprec() */ #endif /* H5_NO_DEPRECATED_SYMBOLS */ @@ -4807,7 +4843,7 @@ main(void) nerrors += test_latest(); nerrors += test_int_float_except(); #ifndef H5_NO_DEPRECATED_SYMBOLS - nerrors += test_compat(fapl); + nerrors += test_deprec(fapl); #endif /* H5_NO_DEPRECATED_SYMBOLS */ h5_cleanup(FILENAME, fapl); /*must happen before first reset*/ reset_hdf5(); diff --git a/test/gen_new_array.c b/test/gen_new_array.c index 3f54e79..c78644d 100644 --- a/test/gen_new_array.c +++ b/test/gen_new_array.c @@ -93,8 +93,8 @@ main(void) printf("field 1 insert<0!\n"); /* Creat the array datatype */ - arr_type=H5Tarray_create(H5T_NATIVE_FLOAT,ARRAY1_RANK,tdims1,NULL); - if(arr_type<0) + arr_type = H5Tarray_create2(H5T_NATIVE_FLOAT, ARRAY1_RANK, tdims1); + if(arr_type < 0) printf("arr_type<0!\n"); /* Insert float array field */ @@ -108,8 +108,8 @@ main(void) printf("field 3 array close<0!\n"); /* Creat the array datatype */ - arr_type=H5Tarray_create(H5T_NATIVE_LONG,ARRAY1_RANK,tdims1,NULL); - if(arr_type<0) + arr_type = H5Tarray_create2(H5T_NATIVE_LONG, ARRAY1_RANK, tdims1); + if(arr_type < 0) printf("arr_type<0!\n"); /* Insert long array field */ @@ -137,8 +137,8 @@ main(void) H5Tclose(type); /* Create the compound datatype with array fields */ - type = H5Tarray_create(H5T_NATIVE_INT, ARRAY1_RANK, tdims1, NULL); - if(type<0) + type = H5Tarray_create2(H5T_NATIVE_INT, ARRAY1_RANK, tdims1); + if(type < 0) printf("type<0!\n"); /* Create the dataset with array datatype */ diff --git a/test/ntypes.c b/test/ntypes.c index 2f5dd5d..4bbbf01 100644 --- a/test/ntypes.c +++ b/test/ntypes.c @@ -747,7 +747,7 @@ test_compound_dtype3(hid_t file) if((space = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR; /* Create array datatype */ - if((tid2 = H5Tarray_create(H5T_STD_I32LE, 1, array_dims, NULL)) < 0) TEST_ERROR; + if((tid2 = H5Tarray_create2(H5T_STD_I32LE, 1, array_dims)) < 0) TEST_ERROR; /* Create compound datatype for disk storage */ if((tid = H5Tcreate(H5T_COMPOUND, 29)) < 0) TEST_ERROR; @@ -762,7 +762,7 @@ test_compound_dtype3(hid_t file) H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; /* Create array datatype */ - if((tid_m2 = H5Tarray_create(H5T_NATIVE_INT, 1, array_dims, NULL)) < 0) TEST_ERROR; + if((tid_m2 = H5Tarray_create2(H5T_NATIVE_INT, 1, array_dims)) < 0) TEST_ERROR; /* Create compound datatype for datatype in memory */ if((tid_m = H5Tcreate(H5T_COMPOUND, sizeof(s1))) < 0) TEST_ERROR; @@ -1268,7 +1268,7 @@ test_array_dtype(hid_t file) if(H5Tinsert(tid2, "l", 5, H5T_STD_I64BE) < 0) TEST_ERROR; /* Create array datatype for disk storage */ - if((tid = H5Tarray_create(tid2, 1, array_dims, NULL)) < 0) TEST_ERROR; + if((tid = H5Tarray_create2(tid2, 1, array_dims)) < 0) TEST_ERROR; /* Create the dataset */ if((dataset = H5Dcreate2(file, DSET_ARRAY_NAME, tid, space, @@ -1281,7 +1281,7 @@ test_array_dtype(hid_t file) if(H5Tinsert(tid3, "l", HOFFSET(s1, l), H5T_NATIVE_LLONG) < 0) TEST_ERROR; /* Create array datatype for memory */ - if((tid_m = H5Tarray_create(tid3, 1, array_dims, NULL)) < 0) TEST_ERROR; + if((tid_m = H5Tarray_create2(tid3, 1, array_dims)) < 0) TEST_ERROR; /* Write the data to the dataset */ if(H5Dwrite(dataset, tid_m, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) @@ -1396,14 +1396,14 @@ test_array_dtype2(hid_t file) if((space = H5Screate_simple(2, space_dims, NULL)) < 0) TEST_ERROR; /* Create array datatype for disk storage */ - if((tid = H5Tarray_create(H5T_STD_I32LE, 1, array_dims, NULL)) < 0) TEST_ERROR; + if((tid = H5Tarray_create2(H5T_STD_I32LE, 1, array_dims)) < 0) TEST_ERROR; /* Create the dataset */ if((dataset = H5Dcreate2(file, DSET_ARRAY2_NAME, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; /* Create array datatype for memory */ - if((tid_m = H5Tarray_create(H5T_NATIVE_INT, 1, array_dims, NULL)) < 0) TEST_ERROR; + if((tid_m = H5Tarray_create2(H5T_NATIVE_INT, 1, array_dims)) < 0) TEST_ERROR; /* Write the data to the dataset */ if(H5Dwrite(dataset, tid_m, H5S_ALL, H5S_ALL, H5P_DEFAULT, ipoints3) < 0) diff --git a/test/tarray.c b/test/tarray.c index b4ec846..8d739b9 100644 --- a/test/tarray.c +++ b/test/tarray.c @@ -93,8 +93,8 @@ test_array_atomic_1d(void) CHECK(sid1, FAIL, "H5Screate_simple"); /* Create a datatype to refer to */ - tid1 = H5Tarray_create(H5T_NATIVE_INT, ARRAY1_RANK, tdims1, NULL); - CHECK(tid1, FAIL, "H5Tarray_create"); + tid1 = H5Tarray_create2(H5T_NATIVE_INT, ARRAY1_RANK, tdims1); + CHECK(tid1, FAIL, "H5Tarray_create2"); /* Create a dataset */ dataset = H5Dcreate2(fid1, "Dataset1", tid1, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); @@ -138,8 +138,8 @@ test_array_atomic_1d(void) VERIFY(ndims, ARRAY1_RANK, "H5Tget_array_ndims"); /* Get the array dimensions */ - ret = H5Tget_array_dims(tid1, rdims1, NULL); - CHECK(ret, FAIL, "H5Tget_array_dims"); + ret = H5Tget_array_dims2(tid1, rdims1); + CHECK(ret, FAIL, "H5Tget_array_dims2"); /* Check the array dimensions */ for(i = 0; i < ndims; i++) @@ -192,8 +192,8 @@ test_array_funcs(void) herr_t ret; /* Generic return value */ /* Create a datatype to refer to */ - type = H5Tarray_create(H5T_IEEE_F32BE, ARRAY1_RANK, tdims1, NULL); - CHECK(type, FAIL, "H5Tarray_create"); + type = H5Tarray_create2(H5T_IEEE_F32BE, ARRAY1_RANK, tdims1); + CHECK(type, FAIL, "H5Tarray_create2"); size=H5Tget_precision(type); CHECK(size, FAIL, "H5Tget_precision"); @@ -272,8 +272,8 @@ test_array_atomic_3d(void) CHECK(sid, FAIL, "H5Screate_simple"); /* Create a datatype to refer to */ - tid = H5Tarray_create(H5T_NATIVE_INT, ARRAY2_RANK, tdims2, NULL); - CHECK(tid, FAIL, "H5Tarray_create"); + tid = H5Tarray_create2(H5T_NATIVE_INT, ARRAY2_RANK, tdims2); + CHECK(tid, FAIL, "H5Tarray_create2"); /* Create a dataset */ dataset = H5Dcreate2(fid, "Dataset1", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); @@ -317,8 +317,8 @@ test_array_atomic_3d(void) VERIFY(ndims, ARRAY2_RANK, "H5Tget_array_ndims"); /* Get the array dimensions */ - ret = H5Tget_array_dims(tid, rdims2, NULL); - CHECK(ret, FAIL, "H5Tget_array_dims"); + ret = H5Tget_array_dims2(tid, rdims2); + CHECK(ret, FAIL, "H5Tget_array_dims2"); /* Check the array dimensions */ for(i = 0; i < ndims; i++) @@ -400,12 +400,12 @@ test_array_array_atomic(void) CHECK(sid, FAIL, "H5Screate_simple"); /* Create a 2-D datatype to refer to */ - tid2 = H5Tarray_create(H5T_NATIVE_INT, ARRAY3_RANK, tdims2, NULL); - CHECK(tid2, FAIL, "H5Tarray_create"); + tid2 = H5Tarray_create2(H5T_NATIVE_INT, ARRAY3_RANK, tdims2); + CHECK(tid2, FAIL, "H5Tarray_create2"); /* Create a 1-D datatype to refer to */ - tid1 = H5Tarray_create(tid2, ARRAY1_RANK, tdims1, NULL); - CHECK(tid1, FAIL, "H5Tarray_create"); + tid1 = H5Tarray_create2(tid2, ARRAY1_RANK, tdims1); + CHECK(tid1, FAIL, "H5Tarray_create2"); /* Create a dataset */ dataset = H5Dcreate2(fid, "Dataset1", tid1, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); @@ -451,8 +451,8 @@ test_array_array_atomic(void) VERIFY(ndims1, ARRAY1_RANK, "H5Tget_array_ndims"); /* Get the 1-D array dimensions */ - ret = H5Tget_array_dims(tid1, rdims1, NULL); - CHECK(ret, FAIL, "H5Tget_array_dims"); + ret = H5Tget_array_dims2(tid1, rdims1); + CHECK(ret, FAIL, "H5Tget_array_dims2"); /* Check the array dimensions */ for(i = 0; i < ndims1; i++) @@ -470,8 +470,8 @@ test_array_array_atomic(void) VERIFY(ndims2, ARRAY3_RANK, "H5Tget_array_ndims"); /* Get the 2-D array dimensions */ - ret = H5Tget_array_dims(tid2, rdims2, NULL); - CHECK(ret, FAIL, "H5Tget_array_dims"); + ret = H5Tget_array_dims2(tid2, rdims2); + CHECK(ret, FAIL, "H5Tget_array_dims2"); /* Check the array dimensions */ for(i = 0; i < ndims2; i++) @@ -571,8 +571,8 @@ test_array_compound_atomic(void) CHECK(ret, FAIL, "H5Tinsert"); /* Create an array datatype to refer to */ - tid1 = H5Tarray_create(tid2, ARRAY1_RANK, tdims1, NULL); - CHECK(tid1, FAIL, "H5Tarray_create"); + tid1 = H5Tarray_create2(tid2, ARRAY1_RANK, tdims1); + CHECK(tid1, FAIL, "H5Tarray_create2"); /* Close compound datatype */ ret = H5Tclose(tid2); @@ -620,8 +620,8 @@ test_array_compound_atomic(void) VERIFY(ndims,ARRAY1_RANK,"H5Tget_array_ndims"); /* Get the array dimensions */ - ret = H5Tget_array_dims(tid1, rdims1, NULL); - CHECK(ret, FAIL, "H5Tget_array_dims"); + ret = H5Tget_array_dims2(tid1, rdims1); + CHECK(ret, FAIL, "H5Tget_array_dims2"); /* Check the array dimensions */ for(i = 0; i < ndims; i++) @@ -771,8 +771,8 @@ test_array_compound_array(void) CHECK(ret, FAIL, "H5Tinsert"); /* Create an array of floats datatype */ - tid3 = H5Tarray_create(H5T_NATIVE_FLOAT, ARRAY1_RANK, tdims1, NULL); - CHECK(tid3, FAIL, "H5Tarray_create"); + tid3 = H5Tarray_create2(H5T_NATIVE_FLOAT, ARRAY1_RANK, tdims1); + CHECK(tid3, FAIL, "H5Tarray_create2"); /* Insert float array field */ ret = H5Tinsert(tid2, "f", HOFFSET(s1_t, f), tid3); @@ -783,8 +783,8 @@ test_array_compound_array(void) CHECK(ret, FAIL, "H5Tclose"); /* Create an array datatype to refer to */ - tid1 = H5Tarray_create(tid2, ARRAY1_RANK, tdims1, NULL); - CHECK(tid1, FAIL, "H5Tarray_create"); + tid1 = H5Tarray_create2(tid2, ARRAY1_RANK, tdims1); + CHECK(tid1, FAIL, "H5Tarray_create2"); /* Close compound datatype */ ret = H5Tclose(tid2); @@ -832,8 +832,8 @@ test_array_compound_array(void) VERIFY(ndims,ARRAY1_RANK,"H5Tget_array_ndims"); /* Get the array dimensions */ - ret = H5Tget_array_dims(tid1, rdims1, NULL); - CHECK(ret, FAIL, "H5Tget_array_dims"); + ret = H5Tget_array_dims2(tid1, rdims1); + CHECK(ret, FAIL, "H5Tget_array_dims2"); /* Check the array dimensions */ for(i=0; i<ndims; i++) @@ -893,8 +893,8 @@ test_array_compound_array(void) VERIFY(ndims,ARRAY1_RANK,"H5Tget_array_ndims"); /* Get the array dimensions */ - ret = H5Tget_array_dims(mtid, rdims1, NULL); - CHECK(ret, FAIL, "H5Tget_array_dims"); + ret = H5Tget_array_dims2(mtid, rdims1); + CHECK(ret, FAIL, "H5Tget_array_dims2"); /* Check the array dimensions */ for(i=0; i<ndims; i++) @@ -1066,8 +1066,8 @@ test_array_vlen_atomic(void) CHECK(tid2, FAIL, "H5Tcreate"); /* Create an array datatype to refer to */ - tid1 = H5Tarray_create(tid2, ARRAY1_RANK, tdims1, NULL); - CHECK(tid1, FAIL, "H5Tarray_create"); + tid1 = H5Tarray_create2(tid2, ARRAY1_RANK, tdims1); + CHECK(tid1, FAIL, "H5Tarray_create2"); /* Close VL datatype */ ret = H5Tclose(tid2); @@ -1119,8 +1119,8 @@ test_array_vlen_atomic(void) VERIFY(ndims,ARRAY1_RANK,"H5Tget_array_ndims"); /* Get the array dimensions */ - ret = H5Tget_array_dims(tid1, rdims1, NULL); - CHECK(ret, FAIL, "H5Tget_array_dims"); + ret = H5Tget_array_dims2(tid1, rdims1); + CHECK(ret, FAIL, "H5Tget_array_dims2"); /* Check the array dimensions */ for(i=0; i<ndims; i++) @@ -1274,8 +1274,8 @@ test_array_vlen_array(void) CHECK(sid1, FAIL, "H5Screate_simple"); /* Create the nested array datatype to refer to */ - tid3 = H5Tarray_create(H5T_NATIVE_UINT, ARRAY1_RANK, tdims1, NULL); - CHECK(tid3, FAIL, "H5Tcreate"); + tid3 = H5Tarray_create2(H5T_NATIVE_UINT, ARRAY1_RANK, tdims1); + CHECK(tid3, FAIL, "H5Tarray_create2"); /* Create a VL datatype of 1-D arrays to refer to */ tid2 = H5Tvlen_create(tid3); @@ -1286,8 +1286,8 @@ test_array_vlen_array(void) CHECK(ret, FAIL, "H5Tclose"); /* Create an array datatype to refer to */ - tid1 = H5Tarray_create(tid2, ARRAY1_RANK, tdims1, NULL); - CHECK(tid1, FAIL, "H5Tarray_create"); + tid1 = H5Tarray_create2(tid2, ARRAY1_RANK, tdims1); + CHECK(tid1, FAIL, "H5Tarray_create2"); /* Close VL datatype */ ret = H5Tclose(tid2); @@ -1339,8 +1339,8 @@ test_array_vlen_array(void) VERIFY(ndims,ARRAY1_RANK,"H5Tget_array_ndims"); /* Get the array dimensions */ - ret = H5Tget_array_dims(tid1, rdims1, NULL); - CHECK(ret, FAIL, "H5Tget_array_dims"); + ret = H5Tget_array_dims2(tid1, rdims1); + CHECK(ret, FAIL, "H5Tget_array_dims2"); /* Check the array dimensions */ for(i=0; i<ndims; i++) @@ -1370,8 +1370,8 @@ test_array_vlen_array(void) VERIFY(ndims,ARRAY1_RANK,"H5Tget_array_ndims"); /* Get the array dimensions */ - ret = H5Tget_array_dims(tid3, rdims1, NULL); - CHECK(ret, FAIL, "H5Tget_array_dims"); + ret = H5Tget_array_dims2(tid3, rdims1); + CHECK(ret, FAIL, "H5Tget_array_dims2"); /* Check the array dimensions */ for(i=0; i<ndims; i++) @@ -1593,8 +1593,8 @@ test_array_bkg(void) /* -------------------------------------- */ for ( i = 0; i < dtsinfo.nsubfields; i++) { - array_dt = H5Tarray_create(dtsinfo.datatype[i], ndims[i], dima, NULL); - CHECK(array_dt, FAIL, "H5Tarray_create"); + array_dt = H5Tarray_create2(dtsinfo.datatype[i], ndims[i], dima); + CHECK(array_dt, FAIL, "H5Tarray_create2"); status = H5Tinsert (type, dtsinfo.name[i], dtsinfo.offset[i], array_dt); CHECK(status, FAIL, "H5Tinsert"); @@ -1670,8 +1670,8 @@ test_array_bkg(void) type = H5Tcreate(H5T_COMPOUND, sizeof(fld_t)); CHECK(type, FAIL, "H5Tcreate"); - array_dt = H5Tarray_create(H5T_NATIVE_FLOAT, 1, dima, NULL); - CHECK(array_dt, FAIL, "H5Tarray_create"); + array_dt = H5Tarray_create2(H5T_NATIVE_FLOAT, 1, dima); + CHECK(array_dt, FAIL, "H5Tarray_create2"); status = H5Tinsert (type, "Two", HOFFSET(fld_t, b), array_dt); CHECK(status, FAIL, "H5Tinsert"); @@ -1992,8 +1992,8 @@ test_compat(void) VERIFY(ndims,ARRAY1_RANK,"H5Tget_array_ndims"); /* Get the array dimensions */ - ret = H5Tget_array_dims(mtid, rdims1, NULL); - CHECK(ret, FAIL, "H5Tget_array_dims"); + ret = H5Tget_array_dims2(mtid, rdims1); + CHECK(ret, FAIL, "H5Tget_array_dims2"); /* Check the array dimensions */ for(i=0; i<ndims; i++) @@ -2037,8 +2037,8 @@ test_compat(void) VERIFY(ndims,ARRAY1_RANK,"H5Tget_array_ndims"); /* Get the array dimensions */ - ret = H5Tget_array_dims(mtid,rdims1, NULL); - CHECK(ret, FAIL, "H5Tget_array_dims"); + ret = H5Tget_array_dims2(mtid, rdims1); + CHECK(ret, FAIL, "H5Tget_array_dims2"); /* Check the array dimensions */ for(i=0; i<ndims; i++) diff --git a/test/tsohm.c b/test/tsohm.c index 94ffe11..bcf0432 100644 --- a/test/tsohm.c +++ b/test/tsohm.c @@ -487,10 +487,10 @@ make_dtype_2(void) } /* Create arrays of arrays of arrays of enums */ - if((dtype2_id = H5Tarray_create(enum_id, 3, dims, NULL)) < 0) TEST_ERROR - if((dtype2_id = H5Tarray_create(dtype2_id, 4, dims, NULL)) < 0) TEST_ERROR - if((dtype2_id = H5Tarray_create(dtype2_id, 2, dims, NULL)) < 0) TEST_ERROR - if((dtype2_id = H5Tarray_create(dtype2_id, 1, dims, NULL)) < 0) TEST_ERROR + if((dtype2_id = H5Tarray_create2(enum_id, 3, dims)) < 0) TEST_ERROR + if((dtype2_id = H5Tarray_create2(dtype2_id, 4, dims)) < 0) TEST_ERROR + if((dtype2_id = H5Tarray_create2(dtype2_id, 2, dims)) < 0) TEST_ERROR + if((dtype2_id = H5Tarray_create2(dtype2_id, 1, dims)) < 0) TEST_ERROR if(H5Tclose(enum_id) < 0) TEST_ERROR if(H5Tclose(int_id) < 0) TEST_ERROR |