summaryrefslogtreecommitdiffstats
path: root/c++/test
diff options
context:
space:
mode:
authorBinh-Minh Ribler <bmribler@hdfgroup.org>2010-05-02 14:25:42 (GMT)
committerBinh-Minh Ribler <bmribler@hdfgroup.org>2010-05-02 14:25:42 (GMT)
commitec68ca2481baa02549f63883cc1537ff804379f4 (patch)
tree285e38befd8b4a4f74ae71e00baec9021c7ba22c /c++/test
parentad4f1dc17df4afa178a971d88a5b2c1ab321f230 (diff)
downloadhdf5-ec68ca2481baa02549f63883cc1537ff804379f4.zip
hdf5-ec68ca2481baa02549f63883cc1537ff804379f4.tar.gz
hdf5-ec68ca2481baa02549f63883cc1537ff804379f4.tar.bz2
[svn-r18682] Description:
Purpose: Fix bugzilla 1857 Added missing overloaded function getObjnameByIdx to take char* for name. Platforms tested: Linux/32 2.6 (jam) FreeBSD/64 6.3 (liberty) SunOS 5.10 (linew)
Diffstat (limited to 'c++/test')
-rw-r--r--c++/test/trefer.cpp26
1 files changed, 22 insertions, 4 deletions
diff --git a/c++/test/trefer.cpp b/c++/test/trefer.cpp
index 16f6628..41ee808 100644
--- a/c++/test/trefer.cpp
+++ b/c++/test/trefer.cpp
@@ -47,6 +47,10 @@ const H5std_string FILE2("trefer2.h5");
const H5std_string FILE3("trefer3.h5");
const H5std_string DSET_DEFAULT_NAME("default");
+// Dataset 1
+const H5std_string DSET1_NAME("Dataset1");
+const int DSET1_LEN = 8;
+
const H5std_string MEMBER1( "a_name" );
const H5std_string MEMBER2( "b_name" );
const H5std_string MEMBER3( "c_name" );
@@ -109,7 +113,7 @@ static void test_reference_obj(void)
group.setComment(".", write_comment);
// Create a dataset (inside /Group1)
- DataSet dataset = group.createDataSet("Dataset1", PredType::NATIVE_UINT, sid1);
+ DataSet dataset = group.createDataSet(DSET1_NAME, PredType::NATIVE_UINT, sid1);
unsigned *tu32; // Temporary pointer to uint32 data
for (tu32=(unsigned *)wbuf, i=0; i<SPACE1_DIM1; i++)
@@ -223,13 +227,27 @@ static void test_reference_obj(void)
catch (Exception E) {} // We expect this to fail
// Test reading the name of an item in the group
+
+ // Test getObjnameByIdx(idx)
H5std_string name;
name = group.getObjnameByIdx(0);
- verify_val(name, "Dataset1", "Group::getObjnameByIdx", __LINE__, __FILE__);
+ verify_val(name, DSET1_NAME, "Group::getObjnameByIdx", __LINE__, __FILE__);
+ // Test getObjnameByIdx(hsize_t idx, H5std_string& name, size_t size)
name.clear();
ssize_t name_size = group.getObjnameByIdx(0, name, 5);
- verify_val(name, "Data", "Group::getObjnameByIdx(index,buf,buf_len)", __LINE__, __FILE__);
- verify_val(name_size, 8, "Group::getObjnameByIdx(index,buf,buf_len)", __LINE__, __FILE__);
+ verify_val(name, "Data", "Group::getObjnameByIdx(index,(std::string)buf,buf_len)", __LINE__, __FILE__);
+ verify_val(name_size, DSET1_LEN, "Group::getObjnameByIdx(index,(std::string)buf,buf_len)", __LINE__, __FILE__);
+
+ name.clear();
+ name_size = group.getObjnameByIdx(0, name, name_size+1);
+ verify_val(name, DSET1_NAME, "Group::getObjnameByIdx(index,(std::string)buf,buf_len)", __LINE__, __FILE__);
+ verify_val(name_size, DSET1_LEN, "Group::getObjnameByIdx(index,(std::string)buf,buf_len)", __LINE__, __FILE__);
+
+ // Test getObjnameByIdx(hsize_t idx, char* name, size_t size)
+ char name_C[DSET1_LEN+1];
+ group.getObjnameByIdx(0, name, name_size+1);
+ verify_val(name, DSET1_NAME, "Group::getObjnameByIdx(index,(char*)buf,buf_len)", __LINE__, __FILE__);
+ verify_val(name_size, DSET1_LEN, "Group::getObjnameByIdx(index,(char*)buf,buf_len)", __LINE__, __FILE__);
// Close group
group.close();