diff options
author | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2017-03-16 23:19:32 (GMT) |
---|---|---|
committer | Binh-Minh Ribler <bmribler@hdfgroup.org> | 2017-03-16 23:19:32 (GMT) |
commit | f7711df680f2ccd07f23223deccb217440ec3788 (patch) | |
tree | 4ad4633af3ce182c14aecd4430135298d0a95371 /c++/test/dsets.cpp | |
parent | 368089572a079f0801ab7177aab2719d4cbd4e48 (diff) | |
parent | 98090fe3b08a0ff85ae9bc93218a14017a6f37fe (diff) | |
download | hdf5-f7711df680f2ccd07f23223deccb217440ec3788.zip hdf5-f7711df680f2ccd07f23223deccb217440ec3788.tar.gz hdf5-f7711df680f2ccd07f23223deccb217440ec3788.tar.bz2 |
Merge pull request #334 in HDFFV/hdf5 from ~BMRIBLER/hdf5_bmr_cpp2:develop to develop
* commit '98090fe3b08a0ff85ae9bc93218a14017a6f37fe':
Purpose: Add new C++ wrappers Description: Added wrappers for H5Iis_valid, H5Ps/get_nlinks, H5Tget_create_plist, H5Oopen, H5Oclose and H5Pset_virtual
Diffstat (limited to 'c++/test/dsets.cpp')
-rw-r--r-- | c++/test/dsets.cpp | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/c++/test/dsets.cpp b/c++/test/dsets.cpp index 48a0c4d..970f210 100644 --- a/c++/test/dsets.cpp +++ b/c++/test/dsets.cpp @@ -1148,6 +1148,87 @@ test_types(H5File& file) /*------------------------------------------------------------------------- + * Function: test_virtual + * + * Purpose: Tests fixed, unlimited, and printf selections in the same + * VDS + * + * Return: Success: 0 + * + * Failure: number of errors + * + * Programmer: Binh-Minh Ribler + * Friday, March 10, 2017 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +const int RANK = 2; +static herr_t +test_virtual() +{ + SUBTEST("DSetCreatPropList::setVirtual"); + + try { + // Create DCPLs + DSetCreatPropList dcpl; + DSetCreatPropList srcdcpl; + + // Set fill value + char *fill = NULL; + dcpl.setFillValue(PredType::NATIVE_INT, &fill); + + // Set chunk dimensions + hsize_t cdims[RANK]; + cdims[0] = 2; + cdims[1] = 2; + srcdcpl.setChunk(RANK, cdims); + + // Create memory space + hsize_t mdims[RANK]; + mdims[0] = 10; + mdims[1] = 10; + DataSpace memspace(RANK, mdims); + + // Get the current layout, should be default, H5D_CONTIGUOUS + H5D_layout_t layout = dcpl.getLayout(); + verify_val(layout, H5D_CONTIGUOUS, "DSetCreatPropList::getLayout", __LINE__, __FILE__); + + // Create fixed mapping + hsize_t dims[RANK]; + dims[0] = 6; + dims[1] = 6; + DataSpace vspace(RANK, dims, mdims); + + hsize_t start[RANK]; // Hyperslab start + hsize_t count[RANK]; // Hyperslab count + start[0] = start[1] = 3; + count[0] = count[1] = 3; + vspace.selectHyperslab(H5S_SELECT_SET, count, start); + + DataSpace srcspace(RANK, count); + + H5std_string src_file = "src_file_map.h5"; + H5std_string src_dset = "src_dset_fixed"; + dcpl.setVirtual(vspace, src_file, src_dset, srcspace); + + // Get and verify the new layout + layout = dcpl.getLayout(); + verify_val(layout, H5D_VIRTUAL, "DSetCreatPropList::getLayout", __LINE__, __FILE__); + + PASSED(); + return 0; + } // end top try block + + catch (Exception& E) + { + return -1; + } +} // test_virtual + + +/*------------------------------------------------------------------------- * Function: test_dset * * Purpose Tests the dataset interface (H5D) @@ -1195,6 +1276,7 @@ void test_dset() nerrors += test_nbit_compression(file) < 0 ? 1:0; nerrors += test_multiopen (file) < 0 ? 1:0; nerrors += test_types(file) < 0 ? 1:0; + nerrors += test_virtual() < 0 ? 1:0; // Close group "emit diagnostics". grp.close(); |