diff options
author | Vailin Choi <vchoi@hdfgroup.org> | 2013-04-19 17:24:43 (GMT) |
---|---|---|
committer | Vailin Choi <vchoi@hdfgroup.org> | 2013-04-19 17:24:43 (GMT) |
commit | 0e1e79f0e02606364018806d465d48eed8ffd153 (patch) | |
tree | c7bffe852a3f284a397638536558b2a198a8bfdb /c++/test | |
parent | 14d8e1c2b5ecaf2e298984f269094dd5f2bd735f (diff) | |
download | hdf5-0e1e79f0e02606364018806d465d48eed8ffd153.zip hdf5-0e1e79f0e02606364018806d465d48eed8ffd153.tar.gz hdf5-0e1e79f0e02606364018806d465d48eed8ffd153.tar.bz2 |
[svn-r23601] Bring revisions #23341 - 23597 from trunk to revise_chunks.
h5committtested.
Diffstat (limited to 'c++/test')
-rw-r--r-- | c++/test/dsets.cpp | 6 | ||||
-rw-r--r-- | c++/test/tattr.cpp | 78 | ||||
-rw-r--r-- | c++/test/tcompound.cpp | 1 | ||||
-rw-r--r-- | c++/test/tfile.cpp | 12 | ||||
-rw-r--r-- | c++/test/tfilter.cpp | 4 | ||||
-rw-r--r-- | c++/test/th5s.cpp | 1 | ||||
-rw-r--r-- | c++/test/tlinks.cpp | 3 | ||||
-rw-r--r-- | c++/test/trefer.cpp | 2 | ||||
-rw-r--r-- | c++/test/ttypes.cpp | 4 | ||||
-rw-r--r-- | c++/test/tvlstr.cpp | 5 |
10 files changed, 87 insertions, 29 deletions
diff --git a/c++/test/dsets.cpp b/c++/test/dsets.cpp index e822b36..643762b 100644 --- a/c++/test/dsets.cpp +++ b/c++/test/dsets.cpp @@ -285,13 +285,7 @@ test_simple_io( H5File& file) static herr_t test_datasize() { - SUBTEST("DataSet::getInMemDataSize()"); - - int points[100][200]; - int check[100][200]; - int i, j, n; - try { // Open FILE1. diff --git a/c++/test/tattr.cpp b/c++/test/tattr.cpp index 100e725..7e77e85 100644 --- a/c++/test/tattr.cpp +++ b/c++/test/tattr.cpp @@ -252,14 +252,19 @@ static void test_attr_rename() int read_data1[ATTR1_DIM1]={0}; // Buffer for reading the attribute int i; - // Output message about test being performed - SUBTEST("Rename Attribute Function"); + // Output message about test being performed + SUBTEST("Checking for Existence and Renaming Attribute"); try { // Open file H5File fid1(FILE_BASIC, H5F_ACC_RDWR); - // Check rename of attribute belonging to a file + // Check and rename attribute belonging to a file + + // Check for existence of attribute + bool attr_exists = fid1.attrExists(FATTR1_NAME); + if (attr_exists == false) + throw InvalidActionException("H5File::attrExists", "Attribute should exist but does not"); // Change attribute name fid1.renameAttr(FATTR1_NAME, FATTR_TMP_NAME); @@ -280,7 +285,12 @@ static void test_attr_rename() // Open the dataset DataSet dataset = fid1.openDataSet(DSET1_NAME); - // Check rename of attribute belonging to a dataset + // Check and rename attribute belonging to a dataset + + // Check for existence of attribute + attr_exists = dataset.attrExists(ATTR1_NAME); + if (attr_exists == false) + throw InvalidActionException("H5File::attrExists", "Attribute should exist but does not"); // Change attribute name dataset.renameAttr(ATTR1_NAME, ATTR_TMP_NAME); @@ -303,6 +313,11 @@ static void test_attr_rename() // Close attribute attr1.close(); + // Check for existence of second attribute + attr_exists = dataset.attrExists(ATTR2_NAME); + if (attr_exists == false) + throw InvalidActionException("H5File::attrExists", "Attribute should exist but does not"); + // Open the second attribute Attribute attr2(dataset.openAttribute(ATTR2_NAME)); @@ -324,6 +339,11 @@ static void test_attr_rename() // Change first attribute back to the original name dataset.renameAttr(ATTR_TMP_NAME, ATTR1_NAME); + // Check for existence of attribute after renaming + attr_exists = dataset.attrExists(ATTR1_NAME); + if (attr_exists == false) + throw InvalidActionException("H5File::attrExists", "Attribute should exist but does not"); + PASSED(); } // end try block @@ -964,7 +984,6 @@ static void test_attr_mult_read() static void test_attr_delete() { H5std_string attr_name; // Buffer for attribute names - int ii; // Output message about test being performed SUBTEST("Removing Attribute Function"); @@ -1355,6 +1374,53 @@ static void test_string_attr() /**************************************************************** ** +** test_attr_exists(): Test checking for attribute existence. +** (additional attrExists tests are in test_attr_rename()) +** +****************************************************************/ +static void test_attr_exists() +{ + // Output message about test being performed + SUBTEST("Check Attribute Existence"); + + try { + // Open file. + H5File fid1(FILE_BASIC, H5F_ACC_RDWR); + + // Open the root group. + Group root = fid1.openGroup("/"); + + // Check for existence of attribute + bool attr_exists = fid1.attrExists(ATTR1_FL_STR_NAME); + if (attr_exists == false) + throw InvalidActionException("H5File::attrExists", "fid1, ATTR1_FL_STR_NAMEAttribute should exist but does not"); + + // Check for existence of attribute + attr_exists = fid1.attrExists(FATTR1_NAME); + if (attr_exists == false) + throw InvalidActionException("H5File::attrExists", "fid1,FATTR2_NAMEAttribute should exist but does not"); + + // Open a group. + Group group = fid1.openGroup(GROUP1_NAME); + + // Check for existence of attribute + attr_exists = group.attrExists(ATTR2_NAME); + if (attr_exists == false) + throw InvalidActionException("H5File::attrExists", "group, ATTR2_NAMEAttribute should exist but does not"); + + PASSED(); + } // end try block + + catch (InvalidActionException E) { + issue_fail_msg("test_attr_exists()", __LINE__, __FILE__, E.getCDetailMsg()); + } + catch (Exception E) { + issue_fail_msg("test_attr_exists()", __LINE__, __FILE__, E.getCDetailMsg()); + } +} // test_attr_exists() + +/**************************************************************** +** ** test_attr(): Main attribute testing routine. ** ****************************************************************/ @@ -1364,7 +1430,6 @@ extern "C" void test_attr() { // Output message about test being performed - //MESSAGE("Testing Attributes\n"); MESSAGE(5, ("Testing Attributes\n")); test_attr_basic_write(); // Test basic H5A writing code @@ -1384,6 +1449,7 @@ void test_attr() test_attr_dtype_shared(); // Test using shared datatypes in attributes test_string_attr(); // Test read/write string attribute + test_attr_exists(); // Test H5Location::attrExists } // test_attr() diff --git a/c++/test/tcompound.cpp b/c++/test/tcompound.cpp index fbb1219..28d8a1e 100644 --- a/c++/test/tcompound.cpp +++ b/c++/test/tcompound.cpp @@ -749,7 +749,6 @@ extern "C" void test_compound() { // Output message about test being performed - //MESSAGE("Testing Compound Data Type operations\n"); MESSAGE(5, ("Testing Compound Data Type operations\n")); test_compound_1(); // various things about compound data types diff --git a/c++/test/tfile.cpp b/c++/test/tfile.cpp index ba38d7a..65b8e57 100644 --- a/c++/test/tfile.cpp +++ b/c++/test/tfile.cpp @@ -117,16 +117,16 @@ static void test_file_create() "terminate called without an active exception Command terminated by signal 6" Commenting it out until it's fixed LK 20120626. -#ifndef H5_HAVE_FILE_VERSIONS +*/ try { H5File file2 (FILE1, H5F_ACC_TRUNC); // should throw E + // Should FAIL but didn't, so throw an invalid action exception throw InvalidActionException("H5File constructor", "Attempted to create an existing file."); } catch( FileIException E ) // catch truncating existing file {} // do nothing, FAIL expected -#endif // Close file1 delete file1; file1 = NULL; @@ -144,7 +144,6 @@ static void test_file_create() // Test create with H5F_ACC_TRUNC. This will truncate the existing file. file1 = new H5File (FILE1, H5F_ACC_TRUNC); -#ifndef H5_HAVE_FILE_VERSIONS // Try to truncate first file again. This should fail because file1 // is the same file and is currently open. try { @@ -155,19 +154,17 @@ static void test_file_create() } catch( FileIException E ) // catching truncating opened file {} // do nothing, FAIL expected -#endif + // Try with H5F_ACC_EXCL. This should fail too because the file already // exists. try { -// H5File file3 (FILE1, H5F_ACC_EXCL); // should throw E + H5File file3 (FILE1, H5F_ACC_EXCL); // should throw E // Should FAIL but didn't, so throw an invalid action exception throw InvalidActionException("H5File constructor", "H5F_ACC_EXCL attempt on an existing file."); } catch( FileIException E ) // catching H5F_ACC_EXCL on existing file {} // do nothing, FAIL expected -*/ - std::cerr << "SKIPPED for HDFFV-8067" << std::endl; // Get the file-creation template FileCreatPropList tmpl1 = file1->getCreatePlist(); @@ -627,7 +624,6 @@ void test_file() { // Output message about test being performed MESSAGE(5, ("Testing File I/O operations\n")); - //MESSAGE("Testing File I/O operations\n"); test_file_create(); // Test file creation (also creation templates) test_file_open(); // Test file opening diff --git a/c++/test/tfilter.cpp b/c++/test/tfilter.cpp index 0dbdf00..9e60655 100644 --- a/c++/test/tfilter.cpp +++ b/c++/test/tfilter.cpp @@ -47,12 +47,14 @@ #define FILTER_CHUNK_DIM2 25 // will do this function later or use it as guideline - BMR - 2007/01/26 +#if 0 static herr_t test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, int corrupted, hsize_t *dset_size) { cerr << "do nothing right now" << endl; return(0); } +#endif /* Temporary filter IDs used for testing */ #define H5Z_FILTER_BOGUS 305 @@ -254,13 +256,11 @@ extern "C" void test_filters() { // Output message about test being performed - //MESSAGE("Testing Various Filters\n"); MESSAGE(5, ("Testing Various Filters\n")); hid_t fapl_id; fapl_id = h5_fileaccess(); // in h5test.c, returns a file access template - int nerrors=0; // keep track of number of failures occurr try { // Use the file access template id to create a file access prop. list diff --git a/c++/test/th5s.cpp b/c++/test/th5s.cpp index 32c40d5..7947a9b 100644 --- a/c++/test/th5s.cpp +++ b/c++/test/th5s.cpp @@ -569,7 +569,6 @@ extern "C" void test_h5s() { // Output message about test being performed - //MESSAGE("Testing Dataspaces\n"); MESSAGE(5, ("Testing Dataspaces\n")); test_h5s_basic(); // Test basic H5S code diff --git a/c++/test/tlinks.cpp b/c++/test/tlinks.cpp index e4e691a..fca5918 100644 --- a/c++/test/tlinks.cpp +++ b/c++/test/tlinks.cpp @@ -226,6 +226,7 @@ typedef struct { hbool_t *visited; /* Pointer to array of "visited link" flags */ } link_iter_info_t; +#if 0 /* Link visit structs */ typedef struct { const char *path; /* Path to link */ @@ -374,6 +375,7 @@ typedef struct { unsigned idx; /* Index in object visit structure */ const obj_visit_t *info; /* Pointer to the object visit structure to use */ } ovisit_ud_t; +#endif static const char *FILENAME[] = { "link0", @@ -529,7 +531,6 @@ void test_links() fapl_id = h5_fileaccess(); // Output message about test being performed - //MESSAGE("Testing Various Links\n"); MESSAGE(5, ("Testing Various Links\n")); try { diff --git a/c++/test/trefer.cpp b/c++/test/trefer.cpp index 4eb5b21..ce18e58 100644 --- a/c++/test/trefer.cpp +++ b/c++/test/trefer.cpp @@ -235,7 +235,6 @@ static void test_reference_obj(void) 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__); @@ -345,7 +344,6 @@ extern "C" void test_reference(void) { // Output message about test being performed - //MESSAGE("Testing References\n"); MESSAGE(5, ("Testing References\n")); test_reference_obj(); // Test basic object reference functionality diff --git a/c++/test/ttypes.cpp b/c++/test/ttypes.cpp index b1baa29..c10cf6d 100644 --- a/c++/test/ttypes.cpp +++ b/c++/test/ttypes.cpp @@ -52,6 +52,7 @@ * normally require alignment. When set, all native datatypes must be aligned * on a byte boundary equal to the data size. */ +#if 0 #define TEST_ALIGNMENT /* Alignment test stuff */ @@ -61,6 +62,9 @@ #endif #define SET_ALIGNMENT(TYPE,VAL) \ H5T_NATIVE_##TYPE##_ALIGN_g=MAX(H5T_NATIVE_##TYPE##_ALIGN_g, VAL) +#endif + /* #include "H5Tpkg.h" + */ const char *FILENAME[] = { "dtypes1.h5", diff --git a/c++/test/tvlstr.cpp b/c++/test/tvlstr.cpp index 73e54e0..89f24f2 100644 --- a/c++/test/tvlstr.cpp +++ b/c++/test/tvlstr.cpp @@ -129,7 +129,7 @@ void test_vlstr_free_custom(void *_mem, void *info) *------------------------------------------------------------------------- */ // String for testing datasets -static char stastring_ds_write[1]={'A'}; +// static char stastring_ds_write[1]={'A'}; // Info for a string dataset const H5std_string DSET1_NAME("String_ds"); @@ -687,6 +687,7 @@ static void test_vlstring_attribute() } } // test_vlstring_attribute() +#if 0 /*------------------------------------------------------------------------- * Function: test_read_vl_string_attribute * @@ -746,6 +747,7 @@ static void test_read_vl_string_attribute() issue_fail_msg("test_read_vl_string_attribute()", __LINE__, __FILE__, E.getCDetailMsg()); } } // test_read_vl_string_attribute +#endif // 2013: need to verify before adding to test /*------------------------------------------------------------------------- * Function: test_vlstring_array_attribute @@ -957,7 +959,6 @@ extern "C" void test_vlstrings() { // Output message about test being performed - //MESSAGE("Testing Variable-Length Strings"); MESSAGE(5, ("Testing Variable-Length Strings")); // These tests use the same file |