diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2011-02-22 19:37:06 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2011-02-22 19:37:06 (GMT) |
commit | 727b687ae6c80c9854cb53814fa1c12f27c2994c (patch) | |
tree | fabe359aaddbe3b4d1e2bb58ceb3b94311d66a1c /c++/test/tfilter.cpp | |
parent | 25486d50895fa4a30809d289b9aff4de583a9b84 (diff) | |
download | hdf5-727b687ae6c80c9854cb53814fa1c12f27c2994c.zip hdf5-727b687ae6c80c9854cb53814fa1c12f27c2994c.tar.gz hdf5-727b687ae6c80c9854cb53814fa1c12f27c2994c.tar.bz2 |
[svn-r20146] Description:
Bring r19714:20145 from trunk to revise_chunks branch.
Tested on:
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x,
w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-amd64 2.6 (amani) w/Intel compilers, w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, w/threadsafe, in production mode
Linux/PPC 2.6 (heiwa) w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in debug mode
Mac OS X/32 10.6.6 (amazon) in debug mode
Mac OS X/32 10.6.6 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
Diffstat (limited to 'c++/test/tfilter.cpp')
-rw-r--r-- | c++/test/tfilter.cpp | 87 |
1 files changed, 45 insertions, 42 deletions
diff --git a/c++/test/tfilter.cpp b/c++/test/tfilter.cpp index e59707a..0dbdf00 100644 --- a/c++/test/tfilter.cpp +++ b/c++/test/tfilter.cpp @@ -174,58 +174,61 @@ void test_szip_filter(H5File& file1) SUBTEST("szip filter (with encoder)"); if ( h5_szip_can_encode() == 1) { - char* tconv_buf = new char [1000]; - try { - const hsize_t size[2] = {DSET_DIM1, DSET_DIM2}; - - // Create the data space - DataSpace space1(2, size, NULL); + char* tconv_buf = new char [1000]; - // Create a small conversion buffer to test strip mining (?) - DSetMemXferPropList xfer; - xfer.setBuffer (1000, tconv_buf, NULL); + try { + const hsize_t size[2] = {DSET_DIM1, DSET_DIM2}; - // Prepare dataset create property list - DSetCreatPropList dsplist; - dsplist.setChunk(2, chunk_size); + // Create the data space + DataSpace space1(2, size, NULL); - // Set up for szip compression - dsplist.setSzip(szip_options_mask, szip_pixels_per_block); + // Create a small conversion buffer to test strip mining (?) + DSetMemXferPropList xfer; + xfer.setBuffer (1000, tconv_buf, NULL); - // Create a dataset with szip compression - DataSpace space2 (2, size, NULL); - DataSet dataset(file1.createDataSet (DSET_SZIP_NAME, PredType::NATIVE_INT, space2, dsplist)); + // Prepare dataset create property list + DSetCreatPropList dsplist; + dsplist.setChunk(2, chunk_size); - hsize_t i, j, n; - for (i=n=0; i<size[0]; i++) - { - for (j=0; j<size[1]; j++) - { - points[i][j] = (int)n++; - } - } + // Set up for szip compression + dsplist.setSzip(szip_options_mask, szip_pixels_per_block); - // Write to the dataset then read back the values - dataset.write ((void*)points, PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); - dataset.read ((void*)check, PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); + // Create a dataset with szip compression + DataSpace space2 (2, size, NULL); + DataSet dataset(file1.createDataSet (DSET_SZIP_NAME, PredType::NATIVE_INT, space2, dsplist)); - // 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++) + hsize_t i, j, n; + for (i=n=0; i<size[0]; i++) { - int status = check_values (i, j, points[i][j], check[i][j]); - if (status == -1) - throw Exception("test_szip_filter", "Failed in testing szip method"); + for (j=0; j<size[1]; j++) + { + points[i][j] = (int)n++; + } } - dsplist.close(); - PASSED(); - } // end of try - // catch all other exceptions - catch (Exception E) - { - issue_fail_msg("test_szip_filter()", __LINE__, __FILE__, E.getCDetailMsg()); - } + // Write to the dataset then read back the values + 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) + throw Exception("test_szip_filter", "Failed in testing szip method"); + } + dsplist.close(); + PASSED(); + } // end of try + + // catch all other exceptions + catch (Exception E) + { + issue_fail_msg("test_szip_filter()", __LINE__, __FILE__, E.getCDetailMsg()); + } + + delete tconv_buf; } // if szip presents else { SKIPPED(); |