From: Daniel Arndt Date: Wed, 26 Jul 2023 13:18:13 +0000 (-0400) Subject: Fix [complex_]block_vector_vector_assign X-Git-Tag: relicensing~641^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e89ffbb759cdc5a53b2e515933be99f3b0135873;p=dealii.git Fix [complex_]block_vector_vector_assign --- diff --git a/tests/lac/block_vector_vector_assign.cc b/tests/lac/block_vector_vector_assign.cc index e27174fe8f..532d6a84f3 100644 --- a/tests/lac/block_vector_vector_assign.cc +++ b/tests/lac/block_vector_vector_assign.cc @@ -25,22 +25,27 @@ #include "../tests.h" -template -bool -operator==(const Vector1 &v1, const Vector2 &v2) +namespace dealii::Testing { - if (v1.size() != v2.size()) - return false; - for (unsigned int i = 0; i < v1.size(); ++i) - if (v1(i) != v2(i)) + template + bool + compare_equal(const Vector1 &v1, const Vector2 &v2) + { + if (v1.size() != v2.size()) return false; - return true; -} + for (unsigned int i = 0; i < v1.size(); ++i) + if (v1(i) != v2(i)) + return false; + return true; + } +} // namespace dealii::Testing void test() { + using namespace dealii::Testing; + std::vector ivector(4); ivector[0] = 2; ivector[1] = 4; @@ -54,12 +59,12 @@ test() v1(i) = 1 + i * i; v2 = v1; - AssertThrow(v1 == v2, ExcInternalError()); + AssertThrow(compare_equal(v1, v2), ExcInternalError()); BlockVector v3(ivector); v3 = v2; - AssertThrow(v3 == v2, ExcInternalError()); - AssertThrow(v3 == v1, ExcInternalError()); + AssertThrow(compare_equal(v3, v2), ExcInternalError()); + AssertThrow(compare_equal(v3, v1), ExcInternalError()); deallog << "OK" << std::endl; } diff --git a/tests/lac/complex_block_vector_vector_assign.cc b/tests/lac/complex_block_vector_vector_assign.cc index edd49d11dc..9b14b3babe 100644 --- a/tests/lac/complex_block_vector_vector_assign.cc +++ b/tests/lac/complex_block_vector_vector_assign.cc @@ -25,22 +25,27 @@ #include "../tests.h" -template -bool -operator==(const Vector1 &v1, const Vector2 &v2) +namespace dealii::Testing { - if (v1.size() != v2.size()) - return false; - for (unsigned int i = 0; i < v1.size(); ++i) - if (v1(i) != v2(i)) + template + bool + compare_equal(const Vector1 &v1, const Vector2 &v2) + { + if (v1.size() != v2.size()) return false; - return true; -} + for (unsigned int i = 0; i < v1.size(); ++i) + if (v1(i) != v2(i)) + return false; + return true; + } +} // namespace dealii::Testing void test() { + using namespace dealii::Testing; + std::vector ivector(4); ivector[0] = 2; ivector[1] = 4; @@ -54,12 +59,12 @@ test() v1(i) = 1 + i * i; v2 = v1; - AssertThrow(v1 == v2, ExcInternalError()); + AssertThrow(compare_equal(v1, v2), ExcInternalError()); BlockVector> v3(ivector); v3 = v2; - AssertThrow(v3 == v2, ExcInternalError()); - AssertThrow(v3 == v1, ExcInternalError()); + AssertThrow(compare_equal(v3, v2), ExcInternalError()); + AssertThrow(compare_equal(v3, v1), ExcInternalError()); deallog << "OK" << std::endl; }