diff --git a/src/algebra/TinyMatrix.hpp b/src/algebra/TinyMatrix.hpp index f4c66232816b33d8ee7e8ac897436507181d5644..e34f98ed8c25df7a77ba90bbd7cd05305b5eb115 100644 --- a/src/algebra/TinyMatrix.hpp +++ b/src/algebra/TinyMatrix.hpp @@ -150,11 +150,14 @@ class [[nodiscard]] TinyMatrix { os << '['; for (size_t i = 0; i < M; ++i) { - os << '(' << NaNHelper(A(i, 0)); + if (i > 0) { + os << ','; + } + os << '[' << NaNHelper(A(i, 0)); for (size_t j = 1; j < N; ++j) { os << ',' << NaNHelper(A(i, j)); } - os << ')'; + os << ']'; } os << ']'; diff --git a/src/algebra/TinyVector.hpp b/src/algebra/TinyVector.hpp index 3ca3d2a38550b5a31bb16843d25a35cebdb10fd0..ae616a4849d0e681bf09e613ad4d19263d0f035a 100644 --- a/src/algebra/TinyVector.hpp +++ b/src/algebra/TinyVector.hpp @@ -100,11 +100,11 @@ class [[nodiscard]] TinyVector PUGS_INLINE constexpr friend std::ostream& operator<<(std::ostream& os, const TinyVector& v) { - os << '(' << NaNHelper(v.m_values[0]); + os << '[' << NaNHelper(v.m_values[0]); for (size_t i = 1; i < N; ++i) { os << ',' << NaNHelper(v.m_values[i]); } - os << ')'; + os << ']'; return os; } diff --git a/tests/test_BinaryExpressionProcessor_shift.cpp b/tests/test_BinaryExpressionProcessor_shift.cpp index 127e90161416444f652c16206ddbd8c4f97d5718..834e86cfe483d3745c483defc14d810809ffcd0b 100644 --- a/tests/test_BinaryExpressionProcessor_shift.cpp +++ b/tests/test_BinaryExpressionProcessor_shift.cpp @@ -130,22 +130,22 @@ fout << createSocketServer(0) << "\n";)"; REQUIRE(std::string_view(line) == "(2.3, 4)"); fin.getline(line, 1023); - REQUIRE(std::string_view(line) == "((2.3), (4))"); + REQUIRE(std::string_view(line) == "([2.3], [4])"); fin.getline(line, 1023); - REQUIRE(std::string_view(line) == "((2.3,4), (3,2))"); + REQUIRE(std::string_view(line) == "([2.3,4], [3,2])"); fin.getline(line, 1023); - REQUIRE(std::string_view(line) == "((2.3,4,-1), (3,2,1))"); + REQUIRE(std::string_view(line) == "([2.3,4,-1], [3,2,1])"); fin.getline(line, 1023); - REQUIRE(std::string_view(line) == "([(2.3)], [(4)])"); + REQUIRE(std::string_view(line) == "([[2.3]], [[4]])"); fin.getline(line, 1023); - REQUIRE(std::string_view(line) == "([(2.3,4)(2,0.3)], [(3,2.3)(1,-4)])"); + REQUIRE(std::string_view(line) == "([[2.3,4],[2,0.3]], [[3,2.3],[1,-4]])"); fin.getline(line, 1023); - REQUIRE(std::string_view(line) == "([(2.3,4,-1)(2,7,2.3)(6,2,8)], [(3,2,1)(1,2,5)(2.1,3,-2.6)])"); + REQUIRE(std::string_view(line) == "([[2.3,4,-1],[2,7,2.3],[6,2,8]], [[3,2,1],[1,2,5],[2.1,3,-2.6]])"); fin.getline(line, 1023); REQUIRE(std::string_view(line) == "(foo, bar)"); diff --git a/tests/test_TinyMatrix.cpp b/tests/test_TinyMatrix.cpp index 81c187dc2f5c7663fb7491cfa5c68fc2fc2d7eb6..2f4c09d4ad9ce1dbb5e3d856d8737d27344459f2 100644 --- a/tests/test_TinyMatrix.cpp +++ b/tests/test_TinyMatrix.cpp @@ -272,8 +272,8 @@ TEST_CASE("TinyMatrix", "[algebra]") SECTION("checking for matrices output") { - REQUIRE(Catch::Detail::stringify(A) == "[(1,2,3,4)(5,6,7,8)(9,10,11,12)]"); - REQUIRE(Catch::Detail::stringify(TinyMatrix<1, 1, int>(7)) == "[(7)]"); + REQUIRE(Catch::Detail::stringify(A) == "[[1,2,3,4],[5,6,7,8],[9,10,11,12]]"); + REQUIRE(Catch::Detail::stringify(TinyMatrix<1, 1, int>(7)) == "[[7]]"); } #ifndef NDEBUG @@ -287,7 +287,7 @@ TEST_CASE("TinyMatrix", "[algebra]") A_ost << A; std::ostringstream ref_ost; - ref_ost << "[(1,nan,3)(2,nan,nan)]"; + ref_ost << "[[1,nan,3],[2,nan,nan]]"; REQUIRE(A_ost.str() == ref_ost.str()); } diff --git a/tests/test_TinyVector.cpp b/tests/test_TinyVector.cpp index 0613e721cbce46386e6b1c86c3bc3e1123fdd1aa..9c4dc2e5a2c4b185904fcf04a706fa70b572a197 100644 --- a/tests/test_TinyVector.cpp +++ b/tests/test_TinyVector.cpp @@ -30,7 +30,7 @@ TEST_CASE("TinyVector", "[algebra]") REQUIRE(((z[0] == 0) and (z[1] == 0) and (z[2] == 0))); v = TinyVector<3, int>(3, 2, 4); - REQUIRE(Catch::Detail::stringify(v) == "(3,2,4)"); + REQUIRE(Catch::Detail::stringify(v) == "[3,2,4]"); TinyVector<3, int> w(1, 2, 6); REQUIRE(dot(v, w) == 31); @@ -96,7 +96,7 @@ TEST_CASE("TinyVector", "[algebra]") x_ost << x; std::ostringstream ref_ost; - ref_ost << "(nan,1,nan)"; + ref_ost << "[nan,1,nan]"; REQUIRE(x_ost.str() == ref_ost.str()); }