summaryrefslogtreecommitdiffstats
path: root/c++/test/tvlstr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'c++/test/tvlstr.cpp')
-rw-r--r--c++/test/tvlstr.cpp396
1 files changed, 222 insertions, 174 deletions
diff --git a/c++/test/tvlstr.cpp b/c++/test/tvlstr.cpp
index b1815a3..469e861 100644
--- a/c++/test/tvlstr.cpp
+++ b/c++/test/tvlstr.cpp
@@ -13,13 +13,14 @@
* access to either file, you may request a copy from help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/***********************************************************
-*
-* Test program: tvlstr
-*
-* Test the variable length string functionality
-*
-*************************************************************/
+/*****************************************************************************
+ FILE
+ tvlstr.cpp - HDF5 C++ testing the Variable-Length String functionality
+
+ EXTERNAL ROUTINES/VARIABLES:
+ These routines are in the test directory of the C library:
+
+ ***************************************************************************/
#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
@@ -44,31 +45,14 @@ using namespace H5;
#include "h5cpputil.h" // C++ utilility header file
-const H5std_string DATAFILE("tvlstr.h5");
-const H5std_string DATAFILE2("tvlstr2.h5");
+// Data file used in most test functions
+const H5std_string FILENAME("tvlstr.h5");
// 1-D dataset with fixed dimensions
const int SPACE1_RANK = 1;
const hsize_t SPACE1_DIM1 = 4;
-// 2-D dataset with fixed dimensions
-const int SPACE2_RANK = 2;
-const hsize_t SPACE2_DIM1 = 10;
-const hsize_t SPACE2_DIM2 = 10;
-
-const H5std_string VLSTR_TYPE("vl_string_type");
-
-// Definitions for the VL re-writing test
-const int REWRITE_NDATASETS = 32;
-
-/***********************************************************
-*
-* Test program: tvlstr
-*
-* Test the Variable-Length String functionality
-*
-*************************************************************/
-
+// Utility functions
void *test_vlstr_alloc_custom(size_t size, void *info);
void test_vlstr_free_custom(void *mem, void *info);
@@ -77,7 +61,9 @@ void test_vlstr_free_custom(void *mem, void *info);
** test_vlstr_alloc_custom(): Test VL datatype custom memory
** allocation routines. This routine just uses malloc to
** allocate the memory and increments the amount of memory
-** allocated.
+** allocated. It is passed into setVlenMemManager.
+**
+** Note: exact copy from the C version.
**
****************************************************************/
void *test_vlstr_alloc_custom(size_t size, void *info)
@@ -106,7 +92,9 @@ void *test_vlstr_alloc_custom(size_t size, void *info)
** test_vlstr_free_custom(): Test VL datatype custom memory
** allocation routines. This routine just uses free to
** release the memory and decrements the amount of memory
-** allocated.
+** allocated. It is passed into setVlenMemManager.
+**
+** Note: exact copy from the C version.
**
****************************************************************/
void test_vlstr_free_custom(void *_mem, void *info)
@@ -129,14 +117,19 @@ void test_vlstr_free_custom(void *_mem, void *info)
} // end if
}
-/****************************************************************
-**
-** test_vlstrings_basic(): Test basic VL string code.
-** Tests simple VL string I/O
-**
-****************************************************************/
-static void
-test_vlstrings_basic(void)
+/*-------------------------------------------------------------------------
+ * Function: test_vlstrings_basic
+ *
+ * Purpose: Test simple VL string I/O.
+ *
+ * Return: None
+ *
+ * Programmer: Binh-Minh Ribler (use C version)
+ * January, 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+static void test_vlstrings_basic()
{
const char *wdata[SPACE1_DIM1]= {
"Four score and seven years ago our forefathers brought forth on this continent a new nation,",
@@ -146,12 +139,12 @@ test_vlstrings_basic(void)
}; // Information to write
// Output message about test being performed
- MESSAGE(5, ("Testing Basic VL String Functionality\n"));
+ SUBTEST("Testing Basic VL String Functionality");
H5File* file1 = NULL;
try {
// Create file.
- file1 = new H5File (DATAFILE, H5F_ACC_TRUNC);
+ file1 = new H5File (FILENAME, H5F_ACC_TRUNC);
// Create dataspace for datasets.
hsize_t dims1[] = {SPACE1_DIM1};
@@ -160,36 +153,35 @@ test_vlstrings_basic(void)
// Create a datatype to refer to.
StrType tid1(0, H5T_VARIABLE);
- // Create a dataset.
+ // Create and write a dataset.
DataSet dataset(file1->createDataSet("Dataset1", tid1, sid1));
-
- // Write dataset to disk.
dataset.write(wdata, tid1);
// Create H5S_SCALAR data space.
- DataSpace dataspace;
-
- DataSet dataset2(file1->createDataSet("Dataset2", tid1, dataspace));
+ DataSpace scalar_space;
+ // Create and write another dataset.
+ DataSet dataset2(file1->createDataSet("Dataset2", tid1, scalar_space));
char *wdata2 = (char*)HDcalloc(65534, sizeof(char));
HDmemset(wdata2, 'A', 65533);
-
dataset2.write(&wdata2, tid1);
- dataspace.close();
+ // Release resources from second dataset operation.
+ scalar_space.close();
dataset2.close();
HDfree(wdata2);
- // Change to the custom memory allocation routines for reading VL string.
+ // Change to the custom memory allocation routines for reading
+ // VL string.
DSetMemXferPropList xfer;
- int mem_used=0; // Memory used during allocation
+ int mem_used = 0; // Memory used during allocation
xfer.setVlenMemManager(test_vlstr_alloc_custom, &mem_used, test_vlstr_free_custom, &mem_used);
// Make certain the correct amount of memory will be used.
hsize_t vlsize = dataset.getVlenBufSize(tid1, sid1);
// Count the actual number of bytes used by the strings.
- int str_used; // String data in memory
+ int str_used; // String data in memory
hsize_t i; // counting variable
for (i=0,str_used=0; i<SPACE1_DIM1; i++)
str_used+=HDstrlen(wdata[i])+1;
@@ -198,20 +190,22 @@ test_vlstrings_basic(void)
verify_val((int)vlsize,str_used,"DataSet::getVlenBufSize", __LINE__, __FILE__);
// Read dataset from disk.
- char *rdata[SPACE1_DIM1]; // Information read in
+ char *rdata[SPACE1_DIM1]; // Data read in
dataset.read(rdata, tid1, DataSpace::ALL, DataSpace::ALL, xfer);
// Make certain the correct amount of memory has been used.
- VERIFY(mem_used, str_used, "H5Dread");
+ verify_val(mem_used, str_used, "DataSet::read", __LINE__, __FILE__);
// Compare data read in.
for (i=0; i<SPACE1_DIM1; i++) {
- if(HDstrlen(wdata[i])!=strlen(rdata[i])) {
- TestErrPrintf("VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n",(int)i,(int)strlen(wdata[i]),(int)i,(int)strlen(rdata[i]));
+ int wlen = HDstrlen(wdata[i]);
+ int rlen = HDstrlen(rdata[i]);
+ if(wlen != rlen) {
+ TestErrPrintf("VL data lengths don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n", (int)i, wlen, (int)i, rlen);
continue;
} // end if
if( HDstrcmp(wdata[i],rdata[i]) != 0 ) {
- TestErrPrintf("VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n",(int)i,wdata[i],(int)i,rdata[i]);
+ TestErrPrintf("VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n", (int)i, wdata[i], (int)i, rdata[i]);
continue;
} // end if
} // end for
@@ -220,7 +214,7 @@ test_vlstrings_basic(void)
DataSet::vlenReclaim((void *)rdata, tid1, sid1, xfer);
// Make certain the VL memory has been freed.
- VERIFY(mem_used, 0, "DataSet::vlenReclaim");
+ verify_val(mem_used, 0, "DataSet::vlenReclaim", __LINE__, __FILE__);
// Close objects and file.
dataset.close();
@@ -228,36 +222,44 @@ test_vlstrings_basic(void)
sid1.close();
xfer.close();
file1->close();
+
+ PASSED();
} // end try
// Catch all exceptions.
catch (Exception E)
{
- issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg());
+ issue_fail_msg("test_vlstrings_basic()", __LINE__, __FILE__, E.getCDetailMsg());
if (file1 != NULL) // clean up
delete file1;
}
} // end test_vlstrings_basic()
-/****************************************************************
-**
-** test_vlstrings_special(): Test VL string code for special
-** string cases, nil and zero-sized.
-**
-****************************************************************/
-static void
-test_vlstrings_special(void)
+/*-------------------------------------------------------------------------
+ * Function: test_vlstrings_special
+ *
+ * Purpose: Test VL string code for special string cases, nil and
+ * zero-sized.
+ *
+ * Return: None
+ *
+ * Programmer: Binh-Minh Ribler (use C version)
+ * January, 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+static void test_vlstrings_special()
{
const char *wdata[SPACE1_DIM1] = {"one", "two", "", "four"};
const char *wdata2[SPACE1_DIM1] = {NULL, NULL, NULL, NULL};
char *rdata[SPACE1_DIM1]; // Information read in
// Output message about test being performed.
- MESSAGE(5, ("Testing Special VL Strings\n"));
+ SUBTEST("Testing Special VL Strings");
try {
// Create file.
- H5File file1(DATAFILE, H5F_ACC_TRUNC);
+ H5File file1(FILENAME, H5F_ACC_TRUNC);
// Create dataspace for datasets.
hsize_t dims1[] = {SPACE1_DIM1};
@@ -269,29 +271,29 @@ test_vlstrings_special(void)
// Create a dataset.
DataSet dataset(file1.createDataSet("Dataset3", tid1, sid1));
- // Read from dataset before writing data.
+ // Read from the dataset before writing data.
dataset.read(rdata, tid1);
// Check data read in.
hsize_t i; // counting variable
for (i=0; i<SPACE1_DIM1; i++)
- if(rdata[i]!=NULL)
+ if(rdata[i] != NULL)
TestErrPrintf("VL doesn't match!, rdata[%d]=%p\n",(int)i,rdata[i]);
- // Write dataset to disk.
+ // Write dataset to disk, then read it back.
dataset.write(wdata, tid1);
-
- // Read dataset from disk.
dataset.read(rdata, tid1);
// Compare data read in.
for (i=0; i<SPACE1_DIM1; i++) {
- if(HDstrlen(wdata[i])!=strlen(rdata[i])) {
- TestErrPrintf("VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n",(int)i,(int)strlen(wdata[i]),(int)i,(int)strlen(rdata[i]));
+ int wlen = HDstrlen(wdata[i]);
+ int rlen = HDstrlen(rdata[i]);
+ if(wlen != rlen) {
+ TestErrPrintf("VL data lengths don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n", (int)i, wlen, (int)i, rlen);
continue;
} // end if
if( HDstrcmp(wdata[i],rdata[i]) != 0 ) {
- TestErrPrintf("VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n",(int)i,wdata[i],(int)i,rdata[i]);
+ TestErrPrintf("VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n", (int)i, wdata[i], (int)i, rdata[i]);
continue;
} // end if
} // end for
@@ -302,13 +304,15 @@ test_vlstrings_special(void)
// Close Dataset.
dataset.close();
- // Create another dataset to test nil strings.
- DSetCreatPropList dcpl;
+ /*
+ * Create another dataset to test nil strings.
+ */
- // Set the fill value for the second dataset.
+ // Create the property list and set the fill value for the second
+ // dataset.
+ DSetCreatPropList dcpl;
char *fill = NULL; // Fill value
dcpl.setFillValue(tid1, &fill);
-
dataset = file1.createDataSet("Dataset4", tid1, sid1, dcpl);
// Close dataset creation property list.
@@ -319,8 +323,8 @@ test_vlstrings_special(void)
// Check data read in.
for (i=0; i<SPACE1_DIM1; i++)
- if(rdata[i]!=NULL)
- TestErrPrintf("VL doesn't match!, rdata[%d]=%p\n",(int)i,rdata[i]);
+ if(rdata[i] != NULL)
+ TestErrPrintf("VL doesn't match!, rdata[%d]=%p\n",(int)i, rdata[i]);
// Try to write nil strings to disk.
dataset.write(wdata2, tid1);
@@ -338,6 +342,8 @@ test_vlstrings_special(void)
tid1.close();
sid1.close();
file1.close();
+
+ PASSED();
} // end try
// Catch all exceptions.
@@ -347,32 +353,35 @@ test_vlstrings_special(void)
}
} // test_vlstrings_special
-/****************************************************************
-**
-** test_vlstring_type(): Test VL string type.
-** Tests if VL string is treated as string.
-**
-****************************************************************/
-static void test_vlstring_type(void)
+/*-------------------------------------------------------------------------
+ * Function: test_vlstring_type
+ *
+ * Purpose: Test if VL string is treated as string.
+ *
+ * Return: None
+ *
+ * Programmer: Binh-Minh Ribler (use C version)
+ * January, 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+const H5std_string VLSTR_TYPE("vl_string_type");
+static void test_vlstring_type()
{
- H5T_cset_t cset;
- H5T_str_t pad;
- herr_t ret;
-
// Output message about test being performed.
- MESSAGE(5, ("Testing VL String type\n"));
+ SUBTEST("Testing VL String type");
H5File* file1 = NULL;
try {
// Open file.
- file1 = new H5File(DATAFILE, H5F_ACC_RDWR);
+ file1 = new H5File(FILENAME, H5F_ACC_RDWR);
// Create a datatype to refer to.
StrType vlstr_type(PredType::C_S1);
// Change padding and verify it.
vlstr_type.setStrpad(H5T_STR_NULLPAD);
- pad = vlstr_type.getStrpad();
+ H5T_str_t pad = vlstr_type.getStrpad();
verify_val(pad, H5T_STR_NULLPAD, "StrType::getStrpad", __LINE__, __FILE__);
// Convert to variable-length string.
@@ -404,52 +413,51 @@ static void test_vlstring_type(void)
file1->close();
// Open file.
- file1 = new H5File(DATAFILE, H5F_ACC_RDWR);
-
- //fid = H5Fopen(DATAFILE.c_str(), H5F_ACC_RDWR, H5P_DEFAULT);
+ file1 = new H5File(FILENAME, H5F_ACC_RDWR);
// Open the variable-length string datatype just created
vlstr_type.setId((file1->openStrType(VLSTR_TYPE)).getId());
- //tid_vlstr = H5Topen(fid, VLSTR_TYPE.c_str());
// Verify character set and padding
cset = vlstr_type.getCset();
verify_val(cset, H5T_CSET_ASCII, "StrType::getCset", __LINE__, __FILE__);
- //cset = H5Tget_cset(tid_vlstr);
pad = vlstr_type.getStrpad();
- //pad = H5Tget_strpad(tid_vlstr);
verify_val(pad, H5T_STR_NULLPAD, "StrType::getStrpad", __LINE__, __FILE__);
// Close datatype and file
vlstr_type.close();
file1->close();
- } // end try
+
+ PASSED();
+ } // end try block
// Catch all exceptions.
catch (Exception E)
{
- issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg());
+ issue_fail_msg("test_vlstring_type()", __LINE__, __FILE__, E.getCDetailMsg());
}
} // end test_vlstring_type()
-/****************************************************************
-**
-** test_compact_vlstring(): Test code for storing VL strings in
-** compact datasets.
-**
-****************************************************************/
-static void
-test_compact_vlstring(void)
+/*-------------------------------------------------------------------------
+ * Function: test_compact_vlstring
+ *
+ * Purpose: Test storing VL strings in compact datasets.
+ *
+ * Return: None
+ *
+ * Programmer: Binh-Minh Ribler (use C version)
+ * January, 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+static void test_compact_vlstring()
{
- const char *wdata[SPACE1_DIM1] = {"one", "two", "three", "four"};
- char *rdata[SPACE1_DIM1]; // Information read in
-
- // Output message about test being performed
- MESSAGE(5, ("Testing VL Strings in compact dataset\n"));
+ // Output message about test being performed
+ SUBTEST("Testing VL Strings in compact dataset");
try {
// Create file
- H5File file1(DATAFILE, H5F_ACC_TRUNC);
+ H5File file1(FILENAME, H5F_ACC_TRUNC);
// Create dataspace for datasets
hsize_t dims1[] = {SPACE1_DIM1};
@@ -466,9 +474,11 @@ test_compact_vlstring(void)
DataSet dataset(file1.createDataSet("Dataset5", tid1, sid1, plist));
// Write dataset to disk
+ const char *wdata[SPACE1_DIM1] = {"one", "two", "three", "four"};
dataset.write(wdata, tid1);
// Read dataset from disk
+ char *rdata[SPACE1_DIM1]; // Information read in
dataset.read(rdata, tid1);
// Compare data read in
@@ -493,21 +503,29 @@ test_compact_vlstring(void)
sid1.close();
plist.close();
file1.close();
+
+ PASSED();
} // end try
// Catch all exceptions.
catch (Exception E)
{
- issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg());
+ issue_fail_msg("test_compact_vlstrings()", __LINE__, __FILE__, E.getCDetailMsg());
}
} // test_compact_vlstrings
-/****************************************************************
-**
-** test_write_vl_string_attribute(): Test basic VL string code.
-** Tests writing VL strings as attributes
-**
-****************************************************************/
+/*-------------------------------------------------------------------------
+ * Function: test_write_vl_string_attribute
+ *
+ * Purpose: Test writing VL strings as attributes.
+ *
+ * Return: None
+ *
+ * Programmer: Binh-Minh Ribler (use C version)
+ * January, 2007
+ *
+ *-------------------------------------------------------------------------
+ */
// String for testing attributes
static const char *string_att = "This is the string for the attribute";
static char *string_att_write=NULL;
@@ -516,15 +534,14 @@ static char *string_att_write=NULL;
const H5std_string ATTRSTR_NAME("String_attr");
const H5std_string ATTRSTR_DATA("String Attribute");
-static void
-test_write_vl_string_attribute(void)
+static void test_write_vl_string_attribute()
{
// Output message about test being performed
- MESSAGE(5, ("Testing writing VL String as attributes\n"));
+ SUBTEST("Testing writing VL String as attributes");
try {
// Open the file
- H5File file1(DATAFILE, H5F_ACC_RDWR);
+ H5File file1(FILENAME, H5F_ACC_RDWR);
// Create a datatype to refer to.
StrType tid1(0, H5T_VARIABLE);
@@ -564,16 +581,17 @@ test_write_vl_string_attribute(void)
string_att_write = (char*)HDcalloc(8192, sizeof(char));
HDmemset(string_att_write, 'A', 8191);
- // Write data to the attribute.
+ // Write data to the attribute, then read it back.
gr_attr.write(tid1, &string_att_write);
-
gr_attr.read(tid1, &string_att_check);
+ // Verify data read.
if(HDstrcmp(string_att_check,string_att_write)!=0)
TestErrPrintf("VL string attributes don't match!, string_att_write=%s, string_att_check=%s\n",string_att_write,string_att_check);
-
HDfree(string_att_check);
+ gr_attr.close();
+ // Open attribute ATTRSTR_NAME again.
gr_attr = root.openAttribute(ATTRSTR_NAME);
// The attribute string written is freed below, in the
@@ -582,54 +600,58 @@ test_write_vl_string_attribute(void)
// Close attribute and file
gr_attr.close();
file1.close();
+
+ PASSED();
} // end try block
// Catch all exceptions.
catch (Exception E) {
- issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg());
+ issue_fail_msg("test_string_attr()", __LINE__, __FILE__, E.getCDetailMsg());
}
} // test_string_attr()
-/****************************************************************
-**
-** test_read_vl_string_attribute(): Test basic VL string code.
-** Tests reading VL strings from attributes
-**
-****************************************************************/
-static void test_read_vl_string_attribute(void)
+/*-------------------------------------------------------------------------
+ * Function: test_read_vl_string_attribute
+ *
+ * Purpose: Test reading VL strings from attributes.
+ *
+ * Return: None
+ *
+ * Programmer: Binh-Minh Ribler (use C version)
+ * January, 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+static void test_read_vl_string_attribute()
{
- herr_t ret;
- char *string_att_check;
+
+ // Output message about test being performed
+ SUBTEST("Testing reading VL String as attributes");
try {
// Open file
- H5File file1(DATAFILE, H5F_ACC_RDONLY);
+ H5File file1(FILENAME, H5F_ACC_RDONLY);
// Create a datatype to refer to.
StrType tid1(0, H5T_VARIABLE);
+ // Open the root group and its attribute named ATTRSTR_NAME.
Group root = file1.openGroup("/");
-
Attribute att = root.openAttribute(ATTRSTR_NAME);
// Test reading "normal" sized string attribute
+ char *string_att_check;
att.read(tid1, &string_att_check);
-
if(HDstrcmp(string_att_check,ATTRSTR_DATA.c_str())!=0)
TestErrPrintf("VL string attributes don't match!, string_att=%s, string_att_check=%s\n",ATTRSTR_DATA.c_str(),string_att_check);
-
HDfree(string_att_check);
-
- // Close this attribute.
att.close();
// Test reading "large" sized string attribute
att = root.openAttribute("test_scalar_large");
att.read(tid1, &string_att_check);
-
if(HDstrcmp(string_att_check,string_att_write)!=0)
TestErrPrintf("VL string attributes don't match!, string_att_write=%s, string_att_check=%s\n",string_att_write,string_att_check);
-
HDfree(string_att_check);
HDfree(string_att_write); // Free string allocated in test_write_vl_string_attribute
@@ -638,16 +660,19 @@ static void test_read_vl_string_attribute(void)
tid1.close();
root.close();
file1.close();
+
+ PASSED();
} // end try
// Catch all exceptions.
catch (Exception E) {
- issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg());
+ issue_fail_msg("test_read_vl_string_attribute()", __LINE__, __FILE__, E.getCDetailMsg());
}
} // test_read_vl_string_attribute
/* Helper routine for test_vl_rewrite() */
-static void write_scalar_dset(H5File& file, DataType& type, DataSpace& space, char *name, char *data)
+static void write_scalar_dset(H5File& file, DataType& type, DataSpace& space,
+ char *name, char *data)
{
DataSet dset;
try {
@@ -664,7 +689,8 @@ static void write_scalar_dset(H5File& file, DataType& type, DataSpace& space, ch
}
/* Helper routine for test_vl_rewrite() */
-static void read_scalar_dset(H5File& file, DataType& type, DataSpace& space, char *name, char *data)
+static void read_scalar_dset(H5File& file, DataType& type, DataSpace& space,
+ char *name, char *data)
{
char *data_read;
DataSet dset;
@@ -686,19 +712,30 @@ static void read_scalar_dset(H5File& file, DataType& type, DataSpace& space, cha
}
}
-/****************************************************************
-**
-** test_vl_rewrite(): Test basic VL string code.
-** Tests I/O on VL strings when lots of objects in the file
-** have been linked/unlinked.
-**
-****************************************************************/
-static void test_vl_rewrite(void)
+/*-------------------------------------------------------------------------
+ * Function: test_vl_rewrite
+ *
+ * Purpose: Test I/O on VL strings when many objects in the file
+ * have been linked/unlinked.
+ *
+ * Return: None
+ *
+ * Programmer: Binh-Minh Ribler (use C version)
+ * January, 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+const H5std_string FILENAME2("tvlstr2.h5");
+const int REWRITE_NDATASETS = 32;
+static void test_vl_rewrite()
{
+ // Output message about test being performed
+ SUBTEST("Testing I/O on VL strings with link/unlink");
+
try {
// Create the files.
- H5File file1(DATAFILE, H5F_ACC_TRUNC);
- H5File file2(DATAFILE2, H5F_ACC_TRUNC);
+ H5File file1(FILENAME, H5F_ACC_TRUNC);
+ H5File file2(FILENAME2, H5F_ACC_TRUNC);
// Create the VL string datatype.
StrType type(0, H5T_VARIABLE);
@@ -745,26 +782,35 @@ static void test_vl_rewrite(void)
space.close();
file1.close();
file2.close();
+
+ PASSED();
} // end try
// Catch all exceptions.
catch (Exception E) {
- issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg());
+ issue_fail_msg("test_vl_rewrite()", __LINE__, __FILE__, E.getCDetailMsg());
}
} // end test_vl_rewrite()
-/****************************************************************
-**
-** test_vlstrings(): Main VL string testing routine.
-**
-****************************************************************/
+/*-------------------------------------------------------------------------
+ * Function: test_vlstrings
+ *
+ * Purpose: VL string testing main routine.
+ *
+ * Return: None
+ *
+ * Programmer: Binh-Minh Ribler
+ * January, 2007
+ *
+ *-------------------------------------------------------------------------
+ */
#ifdef __cplusplus
extern "C"
#endif
-void test_vlstrings(void)
+void test_vlstrings()
{
// Output message about test being performed
- MESSAGE(5, ("Testing Variable-Length Strings\n"));
+ MESSAGE(5, ("Testing Variable-Length Strings"));
// These tests use the same file
// Test basic VL string datatype
@@ -797,10 +843,12 @@ void test_vlstrings(void)
*
*-------------------------------------------------------------------------
*/
-void
-cleanup_vlstrings(void)
+#ifdef __cplusplus
+extern "C"
+#endif
+void cleanup_vlstrings()
{
- HDremove(DATAFILE.c_str());
- HDremove(DATAFILE2.c_str());
+ HDremove(FILENAME.c_str());
+ HDremove(FILENAME2.c_str());
}