Skip to content

Commit

Permalink
Cosmetic changes. (#937)
Browse files Browse the repository at this point in the history
  • Loading branch information
1uc authored Feb 5, 2024
1 parent d047891 commit b0b4455
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
9 changes: 5 additions & 4 deletions include/highfive/bits/H5Inspector_misc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,15 @@ inline std::vector<size_t> squeezeDimensions(const std::vector<size_t>& 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};
}

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) {
Expand All @@ -95,7 +95,8 @@ inline std::vector<size_t> squeezeDimensions(const std::vector<size_t>& 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());
}
}
}
Expand All @@ -106,7 +107,7 @@ inline std::vector<size_t> squeezeDimensions(const std::vector<size_t>& 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());
}
}

Expand Down
8 changes: 4 additions & 4 deletions tests/unit/tests_high_five_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include <type_traits>
#include <vector>


#include <catch2/catch_test_macros.hpp>
#include <catch2/catch_template_test_macros.hpp>
#include <catch2/matchers/catch_matchers_vector.hpp>
Expand Down Expand Up @@ -907,8 +906,9 @@ TEST_CASE("HighFiveReadWriteShortcut") {
const std::string dataset_name("dset");
std::vector<unsigned> 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<std::vector<int>> my_nested = {{1, 2}, {3, 4}};
Expand Down Expand Up @@ -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);

Expand All @@ -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);

Expand Down

0 comments on commit b0b4455

Please sign in to comment.