From cf1d54135686184d7f18962825a7eafb5a373896 Mon Sep 17 00:00:00 2001 From: Binh-Minh Ribler Date: Mon, 5 Dec 2005 16:05:33 -0500 Subject: [svn-r11763] Purpose: Adding tests Description: Added tests for openFile and new getObjinfo. Platforms tested: Linux 2.4 (heping) SunOS 5.8 64-bit (sol) HPUX 11.00 (kelgia) --- c++/test/tattr.cpp | 171 +++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 154 insertions(+), 17 deletions(-) diff --git a/c++/test/tattr.cpp b/c++/test/tattr.cpp index 34bb6d1..1788f20 100644 --- a/c++/test/tattr.cpp +++ b/c++/test/tattr.cpp @@ -24,6 +24,7 @@ #else #include #endif + #include #ifndef H5_NO_NAMESPACE @@ -42,7 +43,7 @@ using namespace H5; #include "h5cpputil.h" // C++ utilility header file const string FILENAME("tattr.h5"); -const size_t ATTR_MAX_DIMS = 7; +const size_t ATTR_MAX_DIMS = 7; const string ATTR_TMP_NAME("temp_name"); /* 3-D dataset with fixed dimensions */ @@ -59,6 +60,9 @@ const string DSET2_NAME("Dataset2"); /* Group Information */ const string GROUP1_NAME("/Group1"); +/* Named Datatype Information */ +const string TYPE1_NAME("/Type"); + /* Attribute Rank & Dimensions */ const string ATTR1_NAME("Attr1"); const int ATTR1_RANK = 1; @@ -101,7 +105,7 @@ const int ATTR5_RANK = 0; float attr_data5 = (float)-5.123; // Test data for 5th attribute /* Info for another attribute */ -#define ATTR1A_NAME "Attr1_a" +const string ATTR1A_NAME("Attr1_a"); int attr_data1a[ATTR1_DIM1]={256,11945,-22107}; /**************************************************************** @@ -286,8 +290,8 @@ test_attr_rename(void) // Change first attribute back to the original name dataset.renameAttr(ATTR_TMP_NAME, ATTR1_NAME); - } // end try block + catch (Exception E) { issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg()); } @@ -355,6 +359,7 @@ test_attr_basic_read(void) TestErrPrintf("%d: attribute data different: attr_data2[%d][%d]=%d, read_data2[%d][%d]=%d\n",__LINE__, i,j,attr_data2[i][j],i,j,read_data1[i]); } } // end try block + catch (Exception E) { issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg()); } @@ -413,6 +418,7 @@ test_attr_compound_write(void) attr.write(comp_type, attr_data4); } // end try block + catch (Exception E) { issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg()); } @@ -547,6 +553,7 @@ test_attr_compound_read(void) string attr_name = attr.getName(); verify_val(attr_name, ATTR4_NAME, "Attribute::getName", __LINE__, __FILE__); } // end try block + catch (Exception E) { issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg()); } @@ -568,7 +575,7 @@ test_attr_scalar_write(void) H5File fid1(FILENAME, H5F_ACC_TRUNC); // Create dataspace for dataset - hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; + hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; DataSpace sid1(SPACE1_RANK, dims1); // Create a dataset @@ -841,8 +848,8 @@ test_attr_mult_read(void) //attr.read(i_type, read_data2); // Verify values read in - for(i=0; i