From 07b0dc99da4cab6b1e8040bdf6cedc884046936d Mon Sep 17 00:00:00 2001 From: Luc Grosheintz Date: Sat, 3 Feb 2024 14:12:31 +0100 Subject: [PATCH] Cosmetic changes. --- include/highfive/bits/H5Inspector_misc.hpp | 9 +++++---- tests/unit/tests_high_five_base.cpp | 8 ++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/include/highfive/bits/H5Inspector_misc.hpp b/include/highfive/bits/H5Inspector_misc.hpp index 7ae90d84f..ac3872dda 100644 --- a/include/highfive/bits/H5Inspector_misc.hpp +++ b/include/highfive/bits/H5Inspector_misc.hpp @@ -77,7 +77,7 @@ inline std::vector squeezeDimensions(const std::vector& dims, if (n_dim_requested == 0) { if (!checkDimensions(dims, n_dim_requested)) { - throw std::invalid_argument(format_error_message()); + throw std::invalid_argument("Failed dimensions check: " + format_error_message()); } return {1ul}; @@ -85,7 +85,7 @@ inline std::vector squeezeDimensions(const std::vector& dims, auto n_dim = dims.size(); if (n_dim < n_dim_requested) { - throw std::invalid_argument(format_error_message()); + throw std::invalid_argument("Failed 'n_dim < n_dim_requested: " + format_error_message()); } if (n_dim_requested == 1ul) { @@ -95,7 +95,8 @@ inline std::vector squeezeDimensions(const std::vector& dims, if (non_singleton_dim == size_t(-1)) { non_singleton_dim = i; } else { - throw std::invalid_argument(format_error_message()); + throw std::invalid_argument("Failed one-dimensional: " + + format_error_message()); } } } @@ -106,7 +107,7 @@ inline std::vector squeezeDimensions(const std::vector& dims, size_t n_dim_excess = dims.size() - n_dim_requested; for (size_t i = 1; i <= n_dim_excess; ++i) { if (dims[n_dim - i] != 1) { - throw std::invalid_argument(format_error_message()); + throw std::invalid_argument("Failed stripping from back:" + format_error_message()); } } diff --git a/tests/unit/tests_high_five_base.cpp b/tests/unit/tests_high_five_base.cpp index fefdcdd55..c320f58c5 100644 --- a/tests/unit/tests_high_five_base.cpp +++ b/tests/unit/tests_high_five_base.cpp @@ -20,7 +20,6 @@ #include #include - #include #include #include @@ -907,8 +906,9 @@ TEST_CASE("HighFiveReadWriteShortcut") { const std::string dataset_name("dset"); std::vector vec; vec.resize(x_size); - for (unsigned i = 0; i < x_size; i++) + for (unsigned i = 0; i < x_size; i++) { vec[i] = i * 2; + } std::string at_contents("Contents of string"); int my_int = 3; std::vector> my_nested = {{1, 2}, {3, 4}}; @@ -945,7 +945,7 @@ TEST_CASE("HighFiveReadWriteShortcut") { } // Plain c arrays. 1D - { + SECTION("int-c-array") { int int_c_array[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; DataSet ds_int2 = file.createDataSet("/TmpCArrayInt", int_c_array); @@ -957,7 +957,7 @@ TEST_CASE("HighFiveReadWriteShortcut") { } // Plain c arrays. 2D - { + SECTION("char-c-array") { char char_c_2darray[][3] = {"aa", "bb", "cc", "12"}; DataSet ds_char2 = file.createDataSet("/TmpCArray2dchar", char_c_2darray);