[svn-r18665] Description:

Bring r18664 from trunk to 1.8 branch:

    Add a few H5Tequal() calls to make certain that the native datatype
constructed with H5Tget_native_type() is identical to the memory datatype
created from the struct in memory.

Tested on:
    Mac OS X/32 10.6.3 (amazon) in debug mode
    Mac OS X/32 10.6.3 (amazon) w/C++ & FORTRAN, w/threadsafe,
        in production mode
    (h5committested on trunk)
This commit is contained in:
Quincey Koziol
2010-04-29 08:04:33 -05:00
parent d0a1730ad8
commit ca02b2da58

View File

@@ -412,6 +412,9 @@ test_compound_dtype2(hid_t file)
if((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0) if((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0)
TEST_ERROR; TEST_ERROR;
if(H5Tequal(native_type, tid_m) != TRUE)
TEST_ERROR;
/* Verify the datatype of each field retrieved and converted */ /* Verify the datatype of each field retrieved and converted */
/* check the char member */ /* check the char member */
if((mem_id = H5Tget_member_type(native_type, 0)) < 0) if((mem_id = H5Tget_member_type(native_type, 0)) < 0)
@@ -666,6 +669,9 @@ test_compound_dtype(hid_t file)
if((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0) if((native_type = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0)
TEST_ERROR; TEST_ERROR;
if(H5Tequal(native_type, tid2) != TRUE)
TEST_ERROR;
/* Verify the datatype of each field retrieved and converted */ /* Verify the datatype of each field retrieved and converted */
if((mem_id = H5Tget_member_type(native_type, 0)) < 0) if((mem_id = H5Tget_member_type(native_type, 0)) < 0)
TEST_ERROR; TEST_ERROR;
@@ -2572,7 +2578,7 @@ test_bitfield_dtype(hid_t file)
H5P_DEFAULT)) < 0) TEST_ERROR; H5P_DEFAULT)) < 0) TEST_ERROR;
for(i = 0; i < BITFIELD_ENUMB*sizeof(int); i++) for(i = 0; i < BITFIELD_ENUMB*sizeof(int); i++)
wbuf[i] = (unsigned int)0xff ^ (unsigned int)i; wbuf[i] = (unsigned char)((unsigned int)0xff ^ (unsigned int)i);
if(H5Dwrite(dset1, H5T_NATIVE_B32, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0) TEST_ERROR; if(H5Dwrite(dset1, H5T_NATIVE_B32, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0) TEST_ERROR;
if(H5Dclose(dset1) < 0) TEST_ERROR; if(H5Dclose(dset1) < 0) TEST_ERROR;
@@ -2603,12 +2609,12 @@ test_bitfield_dtype(hid_t file)
/* Read the data and compare them */ /* Read the data and compare them */
if(H5Dread(dataset1, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) TEST_ERROR; if(H5Dread(dataset1, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) TEST_ERROR;
p = (unsigned int*)rbuf; p = (unsigned char *)rbuf;
for(i = 0; i < BITFIELD_ENUMB*4; i++) { for(i = 0; i < BITFIELD_ENUMB*4; i++) {
if(*p != wbuf[i]) { if(*p != wbuf[i]) {
H5_FAILED(); H5_FAILED();
printf(" Read different values than written.\n"); printf(" Read different values than written.\n");
printf(" At index %d\n", i); printf(" At index %zu\n", i);
TEST_ERROR; TEST_ERROR;
} }
p++; p++;
@@ -2633,7 +2639,7 @@ test_bitfield_dtype(hid_t file)
if(intr[i] != intw[i]) { if(intr[i] != intw[i]) {
H5_FAILED(); H5_FAILED();
printf(" Read different values than written.\n"); printf(" Read different values than written.\n");
printf(" At index %d\n", i); printf(" At index %zu\n", i);
TEST_ERROR; TEST_ERROR;
} }
} }