diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2005-08-13 20:53:35 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2005-08-13 20:53:35 (GMT) |
commit | 6b45f5172ccb4311e0be9ae15da3758abb6b0e67 (patch) | |
tree | 5a7a112fe7a8a98c6fecb45b513789d15962eb3d /c++/test | |
parent | 6562465a2c2a58cfbc2f47bf60bb538f7a783933 (diff) | |
download | hdf5-6b45f5172ccb4311e0be9ae15da3758abb6b0e67.zip hdf5-6b45f5172ccb4311e0be9ae15da3758abb6b0e67.tar.gz hdf5-6b45f5172ccb4311e0be9ae15da3758abb6b0e67.tar.bz2 |
[svn-r11245] Purpose:
Code cleanup
Description:
Trim trailing whitespace, which is making 'diff'ing the two branches
difficult.
Solution:
Ran this script in each directory:
foreach f (*.[ch] *.cpp)
sed 's/[[:blank:]]*$//' $f > sed.out && mv sed.out $f
end
Platforms tested:
FreeBSD 4.11 (sleipnir)
Too minor to require h5committest
Diffstat (limited to 'c++/test')
-rw-r--r-- | c++/test/dsets.cpp | 116 | ||||
-rw-r--r-- | c++/test/h5cpputil.cpp | 10 | ||||
-rw-r--r-- | c++/test/h5cpputil.h | 4 | ||||
-rw-r--r-- | c++/test/tattr.cpp | 120 | ||||
-rw-r--r-- | c++/test/testhdf5.cpp | 2 | ||||
-rw-r--r-- | c++/test/tfile.cpp | 22 | ||||
-rw-r--r-- | c++/test/th5s.cpp | 54 |
7 files changed, 164 insertions, 164 deletions
diff --git a/c++/test/dsets.cpp b/c++/test/dsets.cpp index f721ea1..c0249c5 100644 --- a/c++/test/dsets.cpp +++ b/c++/test/dsets.cpp @@ -50,7 +50,7 @@ const string DSET_BOGUS_NAME ("bogus"); const int H5Z_FILTER_BOGUS = 305; // Local prototypes -static size_t bogus(unsigned int flags, size_t cd_nelmts, +static size_t bogus(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf); void cleanup_dsets(void); @@ -85,7 +85,7 @@ test_create( H5File& file) dims[1] = 512; DataSpace space (2, dims, NULL); - // Create a dataset using the default dataset creation properties. + // Create a dataset using the default dataset creation properties. // We're not sure what they are, so we won't check. dataset = new DataSet (file.createDataSet (DSET_DEFAULT_NAME, PredType::NATIVE_DOUBLE, space)); @@ -101,7 +101,7 @@ test_create( H5File& file) // dataset can only be created once. If an exception is not thrown for // this action by createDataSet, then throw an invalid action exception. try { - dataset = new DataSet (file.createDataSet + dataset = new DataSet (file.createDataSet (DSET_DEFAULT_NAME, PredType::NATIVE_DOUBLE, space)); // continuation here, that means no exception has been thrown @@ -140,7 +140,7 @@ test_create( H5File& file) csize[1] = 100; create_parms.setChunk( 2, csize ); - dataset = new DataSet (file.createDataSet + dataset = new DataSet (file.createDataSet (DSET_CHUNKED_NAME, PredType::NATIVE_DOUBLE, space, create_parms)); // Note: this one has no error message in C when failure occurs? @@ -176,7 +176,7 @@ test_create( H5File& file) /*------------------------------------------------------------------------- * Function: check_values * - * Purpose: Checks a read value against the written value. If they are + * Purpose: Checks a read value against the written value. If they are * different, the function will print out a message and the * different values. This function is made to reuse the code * segment that is used in various places throughout @@ -195,13 +195,13 @@ test_create( H5File& file) * *------------------------------------------------------------------------- */ -static int +static int check_values (hsize_t i, hsize_t j, int apoint, int acheck) { if (apoint != acheck) { cerr << " Read different values than written.\n" << endl; - cerr << " At index " << (unsigned long)i << "," << + cerr << " At index " << (unsigned long)i << "," << (unsigned long)j << endl; return -1; } @@ -245,7 +245,7 @@ test_simple_io( H5File& file) } char* tconv_buf = new char [1000]; - try + try { // Create the data space hsize_t dims[2]; @@ -322,7 +322,7 @@ test_tconv( H5File& file) //assert (in); TESTING("data type conversion"); - + // Initialize the dataset for (int i = 0; i < 1000000; i++) { out[i*4+0] = 0x11; @@ -352,7 +352,7 @@ test_tconv( H5File& file) if (in[4*i+0]!=out[4*i+3] || in[4*i+1]!=out[4*i+2] || in[4*i+2]!=out[4*i+1] || - in[4*i+3]!=out[4*i+0]) + in[4*i+3]!=out[4*i+0]) { throw Exception("DataSet::read", "Read with byte order conversion failed"); } @@ -455,7 +455,7 @@ test_compression(H5File& file) } char* tconv_buf = new char [1000]; DataSet* dataset = NULL; - try + try { const hsize_t size[2] = {100, 200}; // Create the data space @@ -465,37 +465,37 @@ test_compression(H5File& file) DSetMemXferPropList xfer; xfer.setBuffer (1000, tconv_buf, NULL); - + // Use chunked storage with compression DSetCreatPropList dscreatplist; const hsize_t chunk_size[2] = {2, 25}; dscreatplist.setChunk (2, chunk_size); dscreatplist.setDeflate (6); - + #ifdef H5_HAVE_FILTER_DEFLATE TESTING("compression (setup)"); - + // Create the dataset - dataset = new DataSet (file.createDataSet + dataset = new DataSet (file.createDataSet (DSET_COMPRESS_NAME, PredType::NATIVE_INT, space1, dscreatplist)); - + PASSED(); /*---------------------------------------------------------------------- * STEP 1: Read uninitialized data. It should be zero. - *---------------------------------------------------------------------- + *---------------------------------------------------------------------- */ TESTING("compression (uninitialized read)"); - + dataset->read ((void*) check, PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); - + for (i=0; i<size[0]; i++) { for (j=0; j<size[1]; j++) { if (0!=check[i][j]) { H5_FAILED(); cerr << " Read a non-zero value." << endl; - cerr << " At index " << (unsigned long)i << "," << + cerr << " At index " << (unsigned long)i << "," << (unsigned long)j << endl; throw Exception("test_compression", "Failed in uninitialized read"); } @@ -506,13 +506,13 @@ test_compression(H5File& file) /*---------------------------------------------------------------------- * STEP 2: Test compression by setting up a chunked dataset and writing * to it. - *---------------------------------------------------------------------- + *---------------------------------------------------------------------- */ TESTING("compression (write)"); - + for (i=n=0; i<size[0]; i++) { - for (j=0; j<size[1]; j++) + for (j=0; j<size[1]; j++) { points[i][j] = n++; } @@ -524,7 +524,7 @@ test_compression(H5File& file) /*---------------------------------------------------------------------- * STEP 3: Try to read the data we just wrote. - *---------------------------------------------------------------------- + *---------------------------------------------------------------------- */ TESTING("compression (read)"); @@ -547,13 +547,13 @@ test_compression(H5File& file) * random thus not very compressible, and will cause the chunks to move * around as they grow. We only change values for the left half of the * dataset although we rewrite the whole thing. - *---------------------------------------------------------------------- + *---------------------------------------------------------------------- */ TESTING("compression (modify)"); - + for (i=0; i<size[0]; i++) { - for (j=0; j<size[1]/2; j++) + for (j=0; j<size[1]/2; j++) { points[i][j] = rand (); } @@ -578,13 +578,13 @@ test_compression(H5File& file) * STEP 5: Close the dataset and then open it and read it again. This * insures that the compression message is picked up properly from the * object header. - *---------------------------------------------------------------------- + *---------------------------------------------------------------------- */ TESTING("compression (re-open)"); // close this dataset to reuse the var delete dataset; - + dataset = new DataSet (file.openDataSet (DSET_COMPRESS_NAME)); dataset->read ((void*)check, PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); @@ -598,13 +598,13 @@ test_compression(H5File& file) } PASSED(); - + /*---------------------------------------------------------------------- * STEP 6: Test partial I/O by writing to and then reading from a * hyperslab of the dataset. The hyperslab does not line up on chunk * boundaries (we know that case already works from above tests). - *---------------------------------------------------------------------- + *---------------------------------------------------------------------- */ TESTING("compression (partial I/O)"); @@ -618,7 +618,7 @@ test_compression(H5File& file) space1.selectHyperslab( H5S_SELECT_SET, hs_size, hs_offset ); dataset->write ((void*)points, PredType::NATIVE_INT, space1, space1, xfer); dataset->read ((void*)check, PredType::NATIVE_INT, space1, space1, xfer); - + // Check that the values read are the same as the values written for (i=0; i<hs_size[0]; i++) { for (j=0; j<hs_size[1]; j++) { @@ -626,9 +626,9 @@ test_compression(H5File& file) check[hs_offset[0]+i][hs_offset[1]+j]) { H5_FAILED(); cerr << " Read different values than written.\n" << endl; - cerr << " At index " << (unsigned long)(hs_offset[0]+i) << + cerr << " At index " << (unsigned long)(hs_offset[0]+i) << "," << (unsigned long)(hs_offset[1]+j) << endl; - + cerr << " At original: " << (int)points[hs_offset[0]+i][hs_offset[1]+j] << endl; cerr << " At returned: " << (int)check[hs_offset[0]+i][hs_offset[1]+j] << endl; throw Exception("test_compression", "Failed in partial I/O"); @@ -650,13 +650,13 @@ test_compression(H5File& file) /*---------------------------------------------------------------------- * STEP 7: Register an application-defined compression method and use it * to write and then read the dataset. - *---------------------------------------------------------------------- + *---------------------------------------------------------------------- */ TESTING("compression (app-defined method)"); if (H5Zregister (H5Z_BOGUS)<0) throw Exception("test_compression", "Failed in app-defined method"); - if (H5Pset_filter (dscreatplist.getId(), H5Z_FILTER_BOGUS, 0, 0, NULL)<0) + if (H5Pset_filter (dscreatplist.getId(), H5Z_FILTER_BOGUS, 0, 0, NULL)<0) throw Exception("test_compression", "Failed in app-defined method"); dscreatplist.setFilter (H5Z_FILTER_BOGUS, 0, 0, NULL); @@ -665,21 +665,21 @@ test_compression(H5File& file) dataset->write ((void*)points, PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); dataset->read ((void*)check, PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); - + // Check that the values read are the same as the values written for (i = 0; i < size[0]; i++) for (j = 0; j < size[1]; j++) { int status = check_values (i, j, points[i][j], check[i][j]); - if (status == -1) + if (status == -1) throw Exception("test_compression", "Failed in app-defined method"); } PASSED(); - + /*---------------------------------------------------------------------- * Cleanup - *---------------------------------------------------------------------- + *---------------------------------------------------------------------- */ delete dataset; delete [] tconv_buf; @@ -742,7 +742,7 @@ test_multiopen (H5File& file) // Create first dataset DataSet dset1 = file.createDataSet ("multiopen", PredType::NATIVE_INT, *space, dcpl); - + // Open again the first dataset from the file to another DataSet object. DataSet dset2 = file.openDataSet ("multiopen"); @@ -759,13 +759,13 @@ test_multiopen (H5File& file) hsize_t tmp_size[1]; space->getSimpleExtentDims (tmp_size); - if (cur_size[0]!=tmp_size[0]) + if (cur_size[0]!=tmp_size[0]) { - cerr << " Got " << (int)tmp_size[0] << " instead of " + cerr << " Got " << (int)tmp_size[0] << " instead of " << (int)cur_size[0] << "!" << endl; throw Exception("test_multiopen", "Failed in multi-open with extending"); } - + // clean up and return with success delete space; PASSED(); @@ -846,7 +846,7 @@ test_types(H5File& file) dset = new DataSet(grp.createDataSet("bitfield_1", type, space)); // Fill buffer - for (i=0; i<sizeof buf; i++) + for (i=0; i<sizeof buf; i++) buf[i] = (unsigned char)0xff ^ (unsigned char)i; // Write data from buf using all default dataspaces and property list @@ -857,7 +857,7 @@ test_types(H5File& file) } // end try block of bitfield_1 // catch exceptions thrown in try block of bitfield_1 - catch (Exception E) + catch (Exception E) { cerr << " FAILED" << endl; cerr << " <<< " << "bitfield_1: " << E.getFuncName() @@ -875,7 +875,7 @@ test_types(H5File& file) dset = new DataSet(grp.createDataSet("bitfield_2", type, space)); // Fill buffer - for (i=0; i<sizeof(buf); i++) + for (i=0; i<sizeof(buf); i++) buf[i] = (unsigned char)0xff ^ (unsigned char)i; // Write data from buf using all default dataspaces and property @@ -908,7 +908,7 @@ test_types(H5File& file) dset = new DataSet(grp.createDataSet("opaque_1", *optype, space)); // Fill buffer - for (i=0; i<sizeof buf; i++) + for (i=0; i<sizeof buf; i++) buf[i] = (unsigned char)0xff ^ (unsigned char)i; // Write data from buf using all default dataspaces and property @@ -931,7 +931,7 @@ test_types(H5File& file) delete optype; throw E; // propagate the exception } - + /* opaque_2 */ try { // block opaque_2 nelmts = sizeof(buf)/4; @@ -941,7 +941,7 @@ test_types(H5File& file) dset = new DataSet(grp.createDataSet("opaque_2", *optype, space)); // Fill buffer - for (i=0; i<sizeof(buf); i++) + for (i=0; i<sizeof(buf); i++) buf[i] = (unsigned char)0xff ^ (unsigned char)i; // Write data from buf using all default dataspaces and property @@ -964,7 +964,7 @@ test_types(H5File& file) delete optype; throw E; // propagate the exception } - + PASSED(); return 0; } // end top try block @@ -991,7 +991,7 @@ test_types(H5File& file) * Nov 12, 01: * - moved h5_cleanup to outside of try block because * dataset.h5 cannot be removed until "file" is out of - * scope and dataset.h5 is closed. + * scope and dataset.h5 is closed. * Feb 20, 05: * - cleanup_dsets took care of the cleanup now. * @@ -1004,11 +1004,11 @@ main(void) 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 + try { - // Turn of the auto-printing when failure occurs so that we can + // Turn of the auto-printing when failure occurs so that we can // handle the errors appropriately since sometime failures are // caused deliberately and expected. Exception::dontPrint(); @@ -1018,7 +1018,7 @@ main(void) FileAccPropList fapl(fapl_id); H5File file(FILE1, H5F_ACC_TRUNC, FileCreatPropList::DEFAULT, fapl); - + // Cause the library to emit initial messages Group grp = file.createGroup( "emit diagnostics", 0); grp.setComment( ".", "Causes diagnostic messages to be emitted"); @@ -1030,7 +1030,7 @@ main(void) nerrors += test_multiopen (file)<0 ?1:0; nerrors += test_types(file)<0 ?1:0; } - catch (Exception E) + catch (Exception E) { return(test_report(nerrors, string(" Dataset"))); } @@ -1038,7 +1038,7 @@ main(void) // Clean up data file cleanup_dsets(); - // Print out dsets test results + // Print out dsets test results cerr << endl << endl; return(test_report(nerrors, string(" Dataset"))); } // main diff --git a/c++/test/h5cpputil.cpp b/c++/test/h5cpputil.cpp index 7340ecc..977282d 100644 --- a/c++/test/h5cpputil.cpp +++ b/c++/test/h5cpputil.cpp @@ -40,7 +40,7 @@ using namespace H5; * Function: test_report * * Purpose: Prints out the number of errors for the tests indicated - * by 'testname,' if there were any failures occurred. If + * by 'testname,' if there were any failures occurred. If * no failure, test_report prints out the tests passed message. * * Return: if any failure has occurred: 1 @@ -67,7 +67,7 @@ int test_report( int nerrors, const string& testname ) << " TESTS FAILED! *****" << endl; return 1; } - else + else { cerr << "All" << testname << " tests passed." << endl; return 0; @@ -86,7 +86,7 @@ int test_report( int nerrors, const string& testname ) * *------------------------------------------------------------------------- */ -void issue_fail_msg(const char* where, int line, const char* file_name, +void issue_fail_msg(const char* where, int line, const char* file_name, const char* message) { if (GetTestVerbosity()>=VERBO_HI) @@ -105,11 +105,11 @@ InvalidActionException::InvalidActionException():Exception(){} // Function: InvalidActionException overloaded constructor // // Purpose: Creates an InvalidActionException with the name of the function, -// which the failure should have occurred but didn't, and a +// which the failure should have occurred but didn't, and a // message explaining why it should fail. // Parameters // func_name - IN: Name of the function where failure should occur -// message - IN: Message +// message - IN: Message //-------------------------------------------------------------------------- InvalidActionException::InvalidActionException(const string func_name, const string message) : Exception(func_name, message) {} diff --git a/c++/test/h5cpputil.h b/c++/test/h5cpputil.h index 38ecbcb..5918afb 100644 --- a/c++/test/h5cpputil.h +++ b/c++/test/h5cpputil.h @@ -62,8 +62,8 @@ template <class Type1, class Type2> { if (x != value) { - cerr << "*** UNEXPECTED VALUE: " << file_name << ":line " << line - << ":" << msg << " different: " << x << ", should be " << value + cerr << "*** UNEXPECTED VALUE: " << file_name << ":line " << line + << ":" << msg << " different: " << x << ", should be " << value << endl; IncTestNumErrs(); } diff --git a/c++/test/tattr.cpp b/c++/test/tattr.cpp index ae1d986..64e2ad1 100644 --- a/c++/test/tattr.cpp +++ b/c++/test/tattr.cpp @@ -103,9 +103,9 @@ int attr_data1a[ATTR1_DIM1]={256,11945,-22107}; ** ** test_attr_basic_write(): Test basic write attribute. ** Tests integer attributes on both datasets and groups -** +** ****************************************************************/ -static void +static void test_attr_basic_write(void) { hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; @@ -114,10 +114,10 @@ test_attr_basic_write(void) int read_data1[ATTR1_DIM1]={0}; // Buffer for reading 1st attribute int i; - // Output message about test being performed + // Output message about test being performed MESSAGE(5, ("Testing Basic Attribute Writing Functions\n")); - try { + try { // Create file H5File fid1 (FILENAME, H5F_ACC_TRUNC); @@ -133,12 +133,12 @@ test_attr_basic_write(void) // Create an attribute for the dataset Attribute ds_attr1 = dataset.createAttribute (ATTR1_NAME, PredType::NATIVE_INT, att_space); - // Try creating an attribute that already exists. This should fail - // since two attributes cannot have the same name. If an exception - // is not thrown for this action by createAttribute, then throw an + // Try creating an attribute that already exists. This should fail + // since two attributes cannot have the same name. If an exception + // is not thrown for this action by createAttribute, then throw an // invalid action exception. try { - Attribute invalid_attr = dataset.createAttribute (ATTR1_NAME, PredType::NATIVE_INT, att_space); + Attribute invalid_attr = dataset.createAttribute (ATTR1_NAME, PredType::NATIVE_INT, att_space); // continuation here, that means no exception has been thrown throw InvalidActionException("H5File::createDataSet", "Library allowed overwrite of existing dataset"); @@ -197,7 +197,7 @@ test_attr_basic_write(void) try { Attribute invalid_attr = group.createAttribute (ATTR2_NAME, PredType::NATIVE_INT, sid3); // continuation here, that means no exception has been thrown - throw InvalidActionException("H5Group::createAttribute", + throw InvalidActionException("H5Group::createAttribute", "Attempting to create an existing attribute"); } catch (AttributeIException E) // catching invalid creating attribute @@ -208,7 +208,7 @@ test_attr_basic_write(void) // Check storage size for attribute attr_size = gr_attr.getStorageSize(); - verify_val((long)attr_size, (long)(ATTR2_DIM1*ATTR2_DIM2*sizeof(int)), + verify_val((long)attr_size, (long)(ATTR2_DIM1*ATTR2_DIM2*sizeof(int)), "Attribute::getStorageSize", __LINE__, __FILE__); } // end try block @@ -220,9 +220,9 @@ test_attr_basic_write(void) /**************************************************************** ** ** test_attr_rename(): Test renaming attribute function. -** +** ****************************************************************/ -static void +static void test_attr_rename(void) { int read_data1[ATTR1_DIM1]={0}; // Buffer for reading the attribute @@ -276,7 +276,7 @@ test_attr_rename(void) if(attr_data1a[i]!=read_data1[i]) TestErrPrintf("%d: attribute data different: attr_data1a[%d]=%d,read_data1[%d]=%d\n",__LINE__,i,attr_data1a[i],i,read_data1[i]); - // Close attribute + // Close attribute attr2.close(); // Change first attribute back to the original name @@ -291,9 +291,9 @@ test_attr_rename(void) /******************************************************************** ** ** test_attr_basic_read(): Test basic read attribute. -** +** ********************************************************************/ -static void +static void test_attr_basic_read(void) { int i, j; @@ -301,7 +301,7 @@ test_attr_basic_read(void) // Output message about test being performed MESSAGE(5, ("Testing Basic Attribute Reading Functions\n")); - try { + try { // Open file H5File fid1(FILENAME, H5F_ACC_RDWR); @@ -321,7 +321,7 @@ test_attr_basic_read(void) // Verify values read in for(i=0; i<ATTR1_DIM1; i++) - if(attr_data1[i]!=read_data1[i]) + if(attr_data1[i]!=read_data1[i]) TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d, read_data1[%d]=%d\n",__LINE__,i,attr_data1[i],i,read_data1[i]); /* @@ -358,16 +358,16 @@ test_attr_basic_read(void) /**************************************************************** ** ** test_attr_compound_write(): Tests compound datatype attributes -** +** ****************************************************************/ -static void +static void test_attr_compound_write(void) { // Output message about test being performed MESSAGE(5, ("Testing Multiple Attribute Functions\n")); - try { + try { // Create file H5File fid1(FILENAME.c_str(), H5F_ACC_TRUNC); @@ -378,7 +378,7 @@ test_attr_compound_write(void) // Create a dataset DataSet dataset = fid1.createDataSet(DSET1_NAME, PredType::NATIVE_UCHAR,sid1); - // Create the attribute datatype. + // Create the attribute datatype. CompType comp_type(sizeof(struct attr4_struct)); attr4_field1_off = HOFFSET(struct attr4_struct, i); @@ -416,9 +416,9 @@ test_attr_compound_write(void) /**************************************************************** ** ** test_attr_compound_read(): Test basic H5A (attribute) code. -** +** ****************************************************************/ -static void +static void test_attr_compound_read(void) { hsize_t dims[ATTR_MAX_DIMS]; // Attribute dimensions @@ -430,8 +430,8 @@ test_attr_compound_read(void) // Output message about test being performed MESSAGE(5, ("Testing Basic Attribute Functions\n")); - try { - // Open file + try { + // Open file H5File fid1(FILENAME, H5F_ACC_RDWR); // Open the dataset @@ -441,7 +441,7 @@ test_attr_compound_read(void) int num_attrs = dataset.getNumAttrs(); verify_val(num_attrs, 1, "H5Object::getNumAttrs", __LINE__, __FILE__); - // Open 1st attribute for the dataset + // Open 1st attribute for the dataset Attribute attr = dataset.openAttribute((unsigned)0); /* Verify Dataspace */ @@ -472,12 +472,12 @@ test_attr_compound_read(void) int fields = datatype.getNmembers(); verify_val(fields, 3, "CompType::getNmembers", __LINE__, __FILE__); - // Verify that the fields have the same names as when the type + // Verify that the fields have the same names as when the type // was created - for(i=0; i<fields; i++) + for(i=0; i<fields; i++) { string fieldname = datatype.getMemberName(i); - if(!((fieldname == ATTR4_FIELDNAME1) || + if(!((fieldname == ATTR4_FIELDNAME1) || (fieldname == ATTR4_FIELDNAME2) || (fieldname == ATTR4_FIELDNAME3))) TestErrPrintf("%d:invalid field name for field #%d: %s\n",__LINE__,i,fieldname.c_str()); @@ -550,15 +550,15 @@ test_attr_compound_read(void) /**************************************************************** ** ** test_attr_scalar_write(): Test scalar attribute writing functionality. -** +** ****************************************************************/ -static void +static void test_attr_scalar_write(void) { // Output message about test being performed MESSAGE(5, ("Testing Basic Scalar Attribute Writing Functions\n")); - try { + try { // Create file H5File fid1(FILENAME, H5F_ACC_TRUNC); @@ -578,12 +578,12 @@ test_attr_scalar_write(void) // Create an attribute for the dataset Attribute ds_attr = dataset.createAttribute (ATTR5_NAME, PredType::NATIVE_FLOAT, att_space); - // Try creating an attribute that already exists. This should fail - // since two attributes cannot have the same name. If an exception - // is not thrown for this action by createAttribute, then throw an + // Try creating an attribute that already exists. This should fail + // since two attributes cannot have the same name. If an exception + // is not thrown for this action by createAttribute, then throw an // invalid action exception. try { - Attribute invalid_attr = dataset.createAttribute (ATTR5_NAME, PredType::NATIVE_FLOAT, att_space); + Attribute invalid_attr = dataset.createAttribute (ATTR5_NAME, PredType::NATIVE_FLOAT, att_space); // continuation here, that means no exception has been thrown throw InvalidActionException("H5File::createDataSet", "Library allowed overwrite of existing dataset"); @@ -603,15 +603,15 @@ test_attr_scalar_write(void) /**************************************************************** ** ** test_attr_scalar_read(): Test scalar attribute reading functionality. -** +** ****************************************************************/ -static void +static void test_attr_scalar_read(void) { // Output message about test being performed MESSAGE(5, ("Testing Basic Scalar Attribute Reading Functions\n")); - try { + try { // Open file H5File fid1(FILENAME, H5F_ACC_RDWR); @@ -646,9 +646,9 @@ test_attr_scalar_read(void) /**************************************************************** ** ** test_attr_mult_write(): Test multiple attributes -** +** ****************************************************************/ -static void +static void test_attr_mult_write(void) { // Output message about test being performed @@ -692,12 +692,12 @@ test_attr_mult_write(void) // Create 3rd attribute for the dataset Attribute ds_attr3 = dataset.createAttribute (ATTR3_NAME, PredType::NATIVE_DOUBLE, att3_space); - // Try creating an attribute that already exists. This should fail - // since two attributes cannot have the same name. If an exception - // is not thrown for this action by createAttribute, then throw an + // Try creating an attribute that already exists. This should fail + // since two attributes cannot have the same name. If an exception + // is not thrown for this action by createAttribute, then throw an // invalid action exception. try { - Attribute invalid_attr = dataset.createAttribute (ATTR3_NAME, PredType::NATIVE_DOUBLE, att3_space); + Attribute invalid_attr = dataset.createAttribute (ATTR3_NAME, PredType::NATIVE_DOUBLE, att3_space); // continuation here, that means no exception has been thrown throw InvalidActionException("DataSet::createAttribute", "Attempting to create a duplicate attribute"); @@ -717,9 +717,9 @@ test_attr_mult_write(void) /**************************************************************** ** ** test_attr_mult_read(): Test reading multiple attributes. -** +** ****************************************************************/ -static void +static void test_attr_mult_read(void) { int read_data1[ATTR1_DIM1]={0}; // Buffer for reading 1st attribute @@ -730,8 +730,8 @@ test_attr_mult_read(void) // Output message about test being performed MESSAGE(5, ("Testing Multiple Attribute Reading Functions\n")); - try { - // Open file + try { + // Open file H5File fid1(FILENAME, H5F_ACC_RDWR); // Open the dataset @@ -741,7 +741,7 @@ test_attr_mult_read(void) int num_attrs = dataset.getNumAttrs(); verify_val(num_attrs, 3, "H5Object::getNumAttrs", __LINE__, __FILE__); - // Open 1st attribute for the dataset + // Open 1st attribute for the dataset Attribute attr = dataset.openAttribute((unsigned)0); /* Verify Dataspace */ @@ -793,7 +793,7 @@ test_attr_mult_read(void) attr.close(); space.close(); - // Open 2nd attribute for the dataset + // Open 2nd attribute for the dataset attr = dataset.openAttribute((unsigned)1); /* Verify Dataspace */ @@ -847,7 +847,7 @@ test_attr_mult_read(void) attr.close(); space.close(); - // Open 3rd attribute for the dataset + // Open 3rd attribute for the dataset attr = dataset.openAttribute((unsigned)2); /* Verify Dataspace */ @@ -906,11 +906,11 @@ test_attr_mult_read(void) /**************************************************************** ** -** test_attr_delete(): Test deleting attribute from different +** test_attr_delete(): Test deleting attribute from different ** hdf5 objects. -** +** ****************************************************************/ -static void +static void test_attr_delete(void) { string attr_name; // Buffer for attribute names @@ -918,8 +918,8 @@ test_attr_delete(void) // Output message about test being performed MESSAGE(5, ("Testing Removing Attribute Function\n")); - try { - // Open file + try { + // Open file H5File fid1(FILENAME, H5F_ACC_RDWR); // Open the dataset @@ -950,7 +950,7 @@ test_attr_delete(void) num_attrs = dataset.getNumAttrs(); verify_val(num_attrs, 2, "H5Object::getNumAttrs", __LINE__, __FILE__); - // Open 1st attribute for the dataset + // Open 1st attribute for the dataset Attribute attr = dataset.openAttribute((unsigned)0); // Verify Name @@ -1001,9 +1001,9 @@ test_attr_delete(void) /**************************************************************** ** ** test_attr(): Main attribute testing routine. -** +** ****************************************************************/ -void +void test_attr(void) { // Output message about test being performed diff --git a/c++/test/testhdf5.cpp b/c++/test/testhdf5.cpp index f34ef8f..c59ade9 100644 --- a/c++/test/testhdf5.cpp +++ b/c++/test/testhdf5.cpp @@ -51,7 +51,7 @@ using namespace H5; #endif /* !H5_NO_NAMESPACE */ -int +int main(int argc, char *argv[]) { /* Initialize testing framework */ diff --git a/c++/test/tfile.cpp b/c++/test/tfile.cpp index 5314741..db5b15d 100644 --- a/c++/test/tfile.cpp +++ b/c++/test/tfile.cpp @@ -84,7 +84,7 @@ const string FILE4("tfile4.h5"); * *------------------------------------------------------------------------- */ -static void +static void test_file_create(void) { // Output message about test being performed @@ -114,13 +114,13 @@ test_file_create(void) catch( FileIException E ) // catch truncating existing file {} // do nothing, FAIL expected - // Close file1 + // Close file1 delete file1; file1 = NULL; - // Try again with H5F_ACC_EXCL. This should fail because the file + // Try again with H5F_ACC_EXCL. This should fail because the file // already exists from the previous steps. - try { + try { H5File file2(FILE1, H5F_ACC_EXCL); // should throw E // Should FAIL but didn't, so throw an invalid action exception @@ -291,7 +291,7 @@ test_file_create(void) * *------------------------------------------------------------------------- */ -static void +static void test_file_open(void) { // Output message about test being performed @@ -329,7 +329,7 @@ test_file_open(void) /*------------------------------------------------------------------------- * Function: test_file_size * - * Purpose: Test file size. + * Purpose: Test file size. * * Return: None * @@ -340,7 +340,7 @@ test_file_open(void) * *------------------------------------------------------------------------- */ -static void +static void test_file_size(void) { // Output message about test being performed @@ -376,14 +376,14 @@ test_file_size(void) // use C test utility routine to close property list. H5Pclose(fapl_id); - + } // test_file_size() /*------------------------------------------------------------------------- * Function: test_file_name * - * Purpose: Test getting file's name. + * Purpose: Test getting file's name. * * Return: None * @@ -408,7 +408,7 @@ typedef struct s1_t { float b; } s1_t; -static void +static void test_file_name() { // Output message about test being performed @@ -484,7 +484,7 @@ test_file_name() * *------------------------------------------------------------------------- */ -void +void test_file(void) { // Output message about test being performed diff --git a/c++/test/th5s.cpp b/c++/test/th5s.cpp index a1b0b46..3c16925 100644 --- a/c++/test/th5s.cpp +++ b/c++/test/th5s.cpp @@ -84,7 +84,7 @@ struct space4_struct { int space5_data = 7; /*------------------------------------------------------------------------- - * + * * Function: test_h5s_basic * * Purpose: Test basic H5S (dataspace) code @@ -103,7 +103,7 @@ int space5_data = 7; * with a special routine. *------------------------------------------------------------------------- */ -static void +static void test_h5s_basic(void) { hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; @@ -115,7 +115,7 @@ test_h5s_basic(void) // Output message about test being performed MESSAGE(5, ("Testing Dataspace Manipulation\n")); - try + try { // beginning of first try block // Create simple dataspace sid1 @@ -153,7 +153,7 @@ test_h5s_basic(void) rank = sid2.getSimpleExtentNdims(); verify_val(rank, SPACE2_RANK, "DataSpace::getSimpleExtentNdims", __LINE__, __FILE__); - // Retrieves dimension size and max size of dataspace sid2 and + // Retrieves dimension size and max size of dataspace sid2 and // verify them ndims = sid2.getSimpleExtentDims( tdims, tmax ); verify_val(HDmemcmp(tdims, dims2, SPACE2_RANK * sizeof(unsigned)), 0, @@ -163,7 +163,7 @@ test_h5s_basic(void) // Check to be sure we can't create a simple data space that has too // many dimensions. - try { + try { DataSpace manydims_ds(H5S_MAX_RANK+1, dims3, NULL); // Should FAIL but didn't, so throw an invalid action exception @@ -190,10 +190,10 @@ test_h5s_basic(void) // Create file H5File fid1(testfile, H5F_ACC_RDONLY); - // Try to open the dataset that has higher dimensionality than + // Try to open the dataset that has higher dimensionality than // what the library can handle and this operation should fail. try { - DataSet dset1 = fid1.openDataSet( "dset" ); + DataSet dset1 = fid1.openDataSet( "dset" ); // Should FAIL but didn't, so throw an invalid action exception throw InvalidActionException("H5File::openDataSet", "Opening a dataset with higher dimensionality than what the library can handle"); @@ -207,7 +207,7 @@ test_h5s_basic(void) // Verify that incorrect dimensions don't work dims1[0] = 0; try { - DataSpace wrongdim_ds (SPACE1_RANK, dims1); + DataSpace wrongdim_ds (SPACE1_RANK, dims1); // Should FAIL but didn't, so throw an invalid action exception throw InvalidActionException("DataSpace constructor", "Attempted to use incorrect dimensions"); @@ -233,14 +233,14 @@ test_h5s_basic(void) cerr << " <<< " << E.getDetailMsg() << " >>>" << endl << endl; } // catch all other exceptions - catch (Exception E) + catch (Exception E) { issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg()); } } // test_h5s_basic() /*------------------------------------------------------------------------- - * + * * Function: test_h5s_scalar_write * * Purpose: Test scalar H5S (dataspace) writing code @@ -259,7 +259,7 @@ test_h5s_basic(void) * with a special routine. *------------------------------------------------------------------------- */ -static void +static void test_h5s_scalar_write(void) { // Output message about test being performed @@ -305,7 +305,7 @@ test_h5s_scalar_write(void) } // test_h5s_scalar_write() /*------------------------------------------------------------------------- - * + * * Function: test_h5s_scalar_read * * Purpose: Test scalar H5S (dataspace) reading code @@ -324,7 +324,7 @@ test_h5s_scalar_write(void) * with a special routine. *------------------------------------------------------------------------- */ -static void +static void test_h5s_scalar_read(void) { hsize_t tdims[4]; // Dimension array to test with @@ -362,11 +362,11 @@ test_h5s_scalar_read(void) // all the exceptions caused by negative returned values by C APIs issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg()); } - + } // test_h5s_scalar_read() /*------------------------------------------------------------------------- - * + * * Function: test_h5s_null * * Purpose: Test null H5S (dataspace) code @@ -385,7 +385,7 @@ test_h5s_scalar_read(void) * with a special routine. *------------------------------------------------------------------------- */ -static void +static void test_h5s_null(void) { // Output message about test being performed @@ -403,7 +403,7 @@ test_h5s_null(void) n = sid1.getSimpleExtentNpoints(); verify_val((long)n, 0, "DataSpace::getSimpleExtentNpoints", __LINE__, __FILE__); - // Create a dataset + // Create a dataset DataSet dataset = fid1.createDataSet("Dataset1", PredType::NATIVE_UINT,sid1); // Try to write nothing to the dataset @@ -420,10 +420,10 @@ test_h5s_null(void) } // test_h5s_null() /*------------------------------------------------------------------------- - * + * * Function: test_h5s_compound_scalar_write * - * Purpose: Test scalar H5S (dataspace) writing for compound + * Purpose: Test scalar H5S (dataspace) writing for compound * datatypes * * Return: none @@ -440,7 +440,7 @@ test_h5s_null(void) * with a special routine. *------------------------------------------------------------------------- */ -static void +static void test_h5s_compound_scalar_write(void) { // Output message about test being performed @@ -494,10 +494,10 @@ test_h5s_compound_scalar_write(void) } // test_h5s_compound_scalar_write() /*------------------------------------------------------------------------- - * + * * Function: test_h5s_compound_scalar_read * - * Purpose: Test scalar H5S (dataspace) reading for compound + * Purpose: Test scalar H5S (dataspace) reading for compound * datatypes * * Return: none @@ -514,7 +514,7 @@ test_h5s_compound_scalar_write(void) * with a special routine. *------------------------------------------------------------------------- */ -static void +static void test_h5s_compound_scalar_read(void) { hsize_t tdims[4]; // Dimension array to test with @@ -544,14 +544,14 @@ test_h5s_compound_scalar_read(void) // Get the datatype of this dataset. CompType type(dataset); - + struct space4_struct rdata; // Scalar data read in dataset.read(&rdata, type); // Verify read data if(HDmemcmp(&space4_data,&rdata,sizeof(struct space4_struct))) { - cerr << "scalar data different: space4_data.c1=" + cerr << "scalar data different: space4_data.c1=" << space4_data.c1 << ", read_data4.c1=" << rdata.c1 << endl; cerr << "scalar data different: space4_data.u=" << space4_data.u << ", read_data4.u=" << rdata.u << endl; @@ -569,7 +569,7 @@ test_h5s_compound_scalar_read(void) } // test_h5s_compound_scalar_read() /*------------------------------------------------------------------------- - * + * * Function: test_h5s * * Purpose: Main dataspace testing routine @@ -582,7 +582,7 @@ test_h5s_compound_scalar_read(void) * Modifications: *------------------------------------------------------------------------- */ -void +void test_h5s(void) { // Output message about test being performed |