diff --git a/src/libnptm/outputs.cpp b/src/libnptm/outputs.cpp index bc0c7fdcc44916376fd8f146cf3017bcdb5abee6..1f50f1a06954763593390f29cb65b96e34c64caf 100644 --- a/src/libnptm/outputs.cpp +++ b/src/libnptm/outputs.cpp @@ -692,6 +692,8 @@ ClusterOutputInfo::ClusterOutputInfo(const std::string &hdf5_file_name) { status = hdf_file->read("VEC_DIR_MULC", str_type, vec_dir_mulc); vec_dir_mulclr = new double[16 * ndirs * xi_block_size]; status = hdf_file->read("VEC_DIR_MULCLR", str_type, vec_dir_mulclr); + status = hdf_file->close(); + delete hdf_file; } else { if (hdf_file != NULL) delete hdf_file; UnrecognizedFormatException ex("Error: " + hdf5_file_name + " not recognized as a valid HDF5 file!"); diff --git a/src/testing/test_outputs.cpp b/src/testing/test_outputs.cpp index 1cacbca89dddc400457a01d0610f5ec44e970148..63f5a3ef24289ef037b1b424535e0437613bbe98 100644 --- a/src/testing/test_outputs.cpp +++ b/src/testing/test_outputs.cpp @@ -22,17 +22,31 @@ using namespace std; +int test_cluster_hdf5_output(); int test_cluster_case_3(); int main() { int result = 0; - // result += test_sphere(); // 1 if failed + result += test_cluster_hdf5_output(); // 1 if failed // result += test_cluster_devel(); // 10 if failed result += test_cluster_case_3(); // 100 if failed // result += test_inclusion(); // 1000 if failed return result; } +int test_cluster_hdf5_output() { + int result = 0; + try { + const string hdf5_file = "../../test_data/cluster/c_OCLU_24.hd5"; + ClusterOutputInfo *oi = new ClusterOutputInfo(hdf5_file); + oi->write("c_OCLU_24", "LEGACY"); + delete oi; + } catch (const exception& ex) { + result = 1; + } + return result; +} + int test_cluster_case_3() { int result = 0; try {