From b3fdc0a78ec20337ef8e5c0671e04fe1ff492296 Mon Sep 17 00:00:00 2001 From: Tobias Leibner <tobias.leibner@googlemail.com> Date: Sun, 17 Mar 2019 17:19:33 +0100 Subject: [PATCH] [container.matrix-view] fix test --- dune/xt/la/container/matrix-view.hh | 6 +++--- dune/xt/la/test/pattern.cc | 12 ++++++++---- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/dune/xt/la/container/matrix-view.hh b/dune/xt/la/container/matrix-view.hh index b2d0b1a5d..1ff2ce507 100644 --- a/dune/xt/la/container/matrix-view.hh +++ b/dune/xt/la/container/matrix-view.hh @@ -87,7 +87,7 @@ public: , past_last_row_(0) , first_col_(0) , past_last_col_(0) - , pattern_(nullptr) + , pattern_(std::shared_ptr<SparsityPatternDefault>(nullptr)) { DUNE_THROW(XT::Common::Exceptions::you_are_using_this_wrong, "This constructor does not make sense for MatrixView"); } @@ -102,7 +102,7 @@ public: , past_last_row_(0) , first_col_(0) , past_last_col_(0) - , pattern_(nullptr) + , pattern_(std::shared_ptr<SparsityPatternDefault>(nullptr)) { DUNE_THROW(XT::Common::Exceptions::you_are_using_this_wrong, "This constructor does not make sense for MatrixView"); } @@ -118,7 +118,7 @@ public: , past_last_row_(past_last_row) , first_col_(first_col) , past_last_col_(past_last_col) - , pattern_(nullptr) + , pattern_(std::shared_ptr<SparsityPatternDefault>(nullptr)) {} size_t row_index(const size_t ii) const diff --git a/dune/xt/la/test/pattern.cc b/dune/xt/la/test/pattern.cc index fae394745..612063b49 100644 --- a/dune/xt/la/test/pattern.cc +++ b/dune/xt/la/test/pattern.cc @@ -111,15 +111,19 @@ GTEST_TEST(SparsityPatternDefaultTest, test_creation_functions) EXPECT_TRUE(diagonal_patt.size() == ROWS); EXPECT_TRUE(subdiagonal_patt.size() == ROWS); for (size_t ii = 0; ii < ROWS; ++ii) { - if (ii < COLS) + if (ii < COLS) { EXPECT_TRUE(diagonal_patt.contains(ii, ii)); - if (ii > 0) + } + if (ii > 0) { EXPECT_TRUE(subdiagonal_patt.contains(ii, ii - 1)); + } for (size_t jj = 0; jj < COLS; ++jj) { - if (jj != ii) + if (jj != ii) { EXPECT_FALSE(diagonal_patt.contains(ii, jj)); - if (jj != ii - 1) + } + if (jj != ii - 1) { EXPECT_FALSE(subdiagonal_patt.contains(ii, jj)); + } } // jj } // ii -- GitLab