diff options
author | Raymond Lu <songyulu@hdfgroup.org> | 2002-12-02 19:47:57 (GMT) |
---|---|---|
committer | Raymond Lu <songyulu@hdfgroup.org> | 2002-12-02 19:47:57 (GMT) |
commit | 437dd9be23c86f8228bcb8b7090189a911cc00ef (patch) | |
tree | 759809852985607289214f74b7f827fccad4e746 /test/tvlstr.c | |
parent | 4c546d9e6ee7bae685476df6cd4e627eaab5de12 (diff) | |
download | hdf5-437dd9be23c86f8228bcb8b7090189a911cc00ef.zip hdf5-437dd9be23c86f8228bcb8b7090189a911cc00ef.tar.gz hdf5-437dd9be23c86f8228bcb8b7090189a911cc00ef.tar.bz2 |
[svn-r6145]
Purpose:
New feature to H5Dget_offset
Description:
If user block is set, H5Dget_offset should be able to return the absolute
offset from the beginning of file.
Platforms tested:
eirene, arabica
Diffstat (limited to 'test/tvlstr.c')
-rw-r--r-- | test/tvlstr.c | 40 |
1 files changed, 32 insertions, 8 deletions
diff --git a/test/tvlstr.c b/test/tvlstr.c index af809d6..702c920 100644 --- a/test/tvlstr.c +++ b/test/tvlstr.c @@ -120,6 +120,8 @@ test_vlstrings_basic(void) "testing whether that nation or any nation so conceived and so dedicated can long endure." }; /* Information to write */ char *rdata[SPACE1_DIM1]; /* Information read in */ + char *wdata2; + hid_t dataspace, dataset2; hid_t fid1; /* HDF5 File IDs */ hid_t dataset; /* Dataset ID */ hid_t sid1; /* Dataspace ID */ @@ -158,6 +160,21 @@ test_vlstrings_basic(void) ret=H5Dwrite(dataset,tid1,H5S_ALL,H5S_ALL,H5P_DEFAULT,wdata); CHECK(ret, FAIL, "H5Dwrite"); + dataspace = H5Screate(H5S_SCALAR); + + dataset2=H5Dcreate(fid1,"Dataset2",tid1,dataspace,H5P_DEFAULT); + CHECK(dataset, FAIL, "H5Dcreate"); + + wdata2 = (char*)HDcalloc(65534, sizeof(char)); + memset(wdata2, 65, 65534); + + ret=H5Dwrite(dataset2,tid1,H5S_ALL,H5S_ALL,H5P_DEFAULT,&wdata2); + CHECK(ret, FAIL, "H5Dwrite"); + + H5Sclose(dataspace); + H5Dclose(dataset2); + HDfree(wdata2); + /* Change to the custom memory allocation routines for reading VL string */ xfer_pid=H5Pcreate(H5P_DATASET_XFER); CHECK(xfer_pid, FAIL, "H5Pcreate"); @@ -327,8 +344,10 @@ static void test_write_vl_string_attribute(void) hid_t type; herr_t ret; char *string_att_check; + char *string_att_write; - file = H5Fopen(DATAFILE, H5F_ACC_RDWR, H5P_DEFAULT); + /*file = H5Fopen(DATAFILE, H5F_ACC_RDWR, H5P_DEFAULT);*/ + file = H5Fcreate(DATAFILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); CHECK(file, FAIL, "H5Fopen"); /* Create a datatype to refer to. */ @@ -347,18 +366,23 @@ static void test_write_vl_string_attribute(void) att = H5Acreate(root, "test_scalar", type, dataspace, H5P_DEFAULT); CHECK(att, FAIL, "H5Acreate"); - ret = H5Awrite(att, type, &string_att); + string_att_write = (char*)HDcalloc(8192, sizeof(char)); + memset(string_att_write, 65, 8192); +printf("string_att_write=%s\n", string_att_write); + + ret = H5Awrite(att, type, &string_att_write); CHECK(ret, FAIL, "H5Awrite"); ret = H5Aread(att, type, &string_att_check); CHECK(ret, FAIL, "H5Aread"); - if(HDstrcmp(string_att_check,string_att)!=0) { + if(HDstrcmp(string_att_check,string_att_write)!=0) { num_errs++; - printf("VL string attributes don't match!, string_att=%s, string_att_check=%s\n",string_att,string_att_check); + printf("VL string attributes don't match!, string_att=%s, string_att_check=%s\n",string_att_write,string_att_check); } /* end if */ free(string_att_check); + free(string_att_write); ret = H5Aclose(att); CHECK(ret, FAIL, "HAclose"); @@ -446,11 +470,11 @@ test_vlstrings(void) /* These next tests use the same file */ /* Test basic VL string datatype */ test_vlstrings_basic(); - test_vlstring_type(); - + /* test_vlstring_type(); + */ /*Test using VL strings in attributes */ - test_write_vl_string_attribute(); - test_read_vl_string_attribute(); + /* test_write_vl_string_attribute(); + test_read_vl_string_attribute();*/ } /* test_vlstrings() */ |