summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--editeng/qa/items/borderline_test.cxx23
-rw-r--r--include/test/cppunitasserthelper.hxx79
-rw-r--r--o3tl/qa/test-string_view.cxx14
-rw-r--r--sal/qa/rtl/math/test-rtl-math.cxx23
-rw-r--r--sal/qa/rtl/strings/test_ostring_concat.cxx12
-rw-r--r--sal/qa/rtl/strings/test_oustring_concat.cxx12
-rw-r--r--test/source/sheet/xsubtotalfield.cxx33
-rw-r--r--tools/qa/cppunit/test_urlobj.cxx23
8 files changed, 68 insertions, 151 deletions
diff --git a/editeng/qa/items/borderline_test.cxx b/editeng/qa/items/borderline_test.cxx
index 0499c7087984..a72ac14f4c78 100644
--- a/editeng/qa/items/borderline_test.cxx
+++ b/editeng/qa/items/borderline_test.cxx
@@ -28,24 +28,13 @@ using namespace ::com::sun::star::table::BorderLineStyle;
using namespace editeng;
-CPPUNIT_NS_BEGIN
-
-template<> struct assertion_traits<SvxBorderLineStyle>
+template<> inline std::string CPPUNIT_NS::assertion_traits<SvxBorderLineStyle>::toString(
+ SvxBorderLineStyle const & x )
{
- static bool equal( SvxBorderLineStyle x, SvxBorderLineStyle y )
- {
- return x == y;
- }
-
- static std::string toString( SvxBorderLineStyle x )
- {
- OStringStream ost;
- ost << static_cast<unsigned int>(x);
- return ost.str();
- }
-};
-
-CPPUNIT_NS_END
+ OStringStream ost;
+ ost << static_cast<unsigned int>(x);
+ return ost.str();
+}
namespace {
diff --git a/include/test/cppunitasserthelper.hxx b/include/test/cppunitasserthelper.hxx
index b6703e255ce0..0fd3806b65fe 100644
--- a/include/test/cppunitasserthelper.hxx
+++ b/include/test/cppunitasserthelper.hxx
@@ -19,85 +19,60 @@
#include <cppunit/TestAssert.h>
-CPPUNIT_NS_BEGIN
-
/** @brief Trait used by CPPUNIT_ASSERT* macros to compare com::sun::star:awt::Point.
*
* This specialization from @c struct @c assertion_traits<> helps to compare
* @see com::sun::star::awt::Point.
*/
-template <> struct assertion_traits<css::awt::Point>
+template <>
+inline std::string CPPUNIT_NS::assertion_traits<css::awt::Point>::toString(const css::awt::Point& x)
{
- static bool equal(const css::awt::Point& x, const css::awt::Point& y) { return x == y; }
-
- static std::string toString(const css::awt::Point& x)
- {
- OStringStream ost;
- ost << "Point: " << x.X << "." << x.Y << " (coordinate: X.Y)";
- return ost.str();
- }
-};
+ OStringStream ost;
+ ost << "Point: " << x.X << "." << x.Y << " (coordinate: X.Y)";
+ return ost.str();
+}
/** @brief Trait used by CPPUNIT_ASSERT* macros to compare com::sun::star:awt::Size.
*
* This specialization from @c struct @c assertion_traits<> helps to compare
* @see com::sun::star::awt::Size.
*/
-template <> struct assertion_traits<css::awt::Size>
+template <>
+inline std::string CPPUNIT_NS::assertion_traits<css::awt::Size>::toString(const css::awt::Size& x)
{
- static bool equal(const css::awt::Size& x, const css::awt::Size& y) { return x == y; }
-
- static std::string toString(const css::awt::Size& x)
- {
- OStringStream ost;
- ost << "Size: " << x.Width << " x " << x.Height << " (Width x Height)";
- return ost.str();
- }
-};
+ OStringStream ost;
+ ost << "Size: " << x.Width << " x " << x.Height << " (Width x Height)";
+ return ost.str();
+}
/** @brief Trait used by CPPUNIT_ASSERT* macros to compare com::sun::star::table::CellAddress.
*
* This specialization from @c struct @c assertion_traits<> helps to compare
* @see com::sun::star::table::CellAddress.
*/
-template <> struct assertion_traits<css::table::CellAddress>
+template <>
+inline std::string
+CPPUNIT_NS::assertion_traits<css::table::CellAddress>::toString(const css::table::CellAddress& x)
{
- static bool equal(const css::table::CellAddress& x, const css::table::CellAddress& y)
- {
- return x == y;
- }
-
- static std::string toString(const css::table::CellAddress& x)
- {
- OStringStream ost;
- ost << "Sheet: " << x.Sheet << " Column: " << x.Column << " Row: " << x.Row;
- return ost.str();
- }
-};
+ OStringStream ost;
+ ost << "Sheet: " << x.Sheet << " Column: " << x.Column << " Row: " << x.Row;
+ return ost.str();
+}
/** @brief Trait used by CPPUNIT_ASSERT* macros to compare com::sun::star::table::CellRangeAddress.
*
* This specialization from @c struct @c assertion_traits<> helps to compare
* @see com::sun::star::table::CellRangeAddress.
*/
-template <> struct assertion_traits<css::table::CellRangeAddress>
+template <>
+inline std::string CPPUNIT_NS::assertion_traits<css::table::CellRangeAddress>::toString(
+ const css::table::CellRangeAddress& x)
{
- static bool equal(const css::table::CellRangeAddress& x, const css::table::CellRangeAddress& y)
- {
- return x == y;
- }
-
- static std::string toString(const css::table::CellRangeAddress& x)
- {
- OStringStream ost;
- ost << "Sheet: " << x.Sheet << " StartColumn: " << x.StartColumn
- << " StartRow: " << x.StartRow << " EndColumn: " << x.EndColumn
- << " EndRow: " << x.EndRow;
- return ost.str();
- }
-};
-
-CPPUNIT_NS_END
+ OStringStream ost;
+ ost << "Sheet: " << x.Sheet << " StartColumn: " << x.StartColumn << " StartRow: " << x.StartRow
+ << " EndColumn: " << x.EndColumn << " EndRow: " << x.EndRow;
+ return ost.str();
+}
#endif // INCLUDED_TEST_CPPUNITASSERTHELPER_HXX
diff --git a/o3tl/qa/test-string_view.cxx b/o3tl/qa/test-string_view.cxx
index 0cc753795df2..37cb4118a8e2 100644
--- a/o3tl/qa/test-string_view.cxx
+++ b/o3tl/qa/test-string_view.cxx
@@ -23,17 +23,11 @@
// gcc 11.2.0 triggers a spurious -Werror=stringop-overread
#if !(defined __GNUC__ && __GNUC__ == 11 && __GNUC_MINOR__ == 2)
-namespace CppUnit
+template <>
+inline std::string
+CppUnit::assertion_traits<std::u16string_view>::toString(std::u16string_view const& x)
{
-template <> struct assertion_traits<std::u16string_view>
-{
- static bool equal(std::u16string_view x, std::u16string_view y) { return x == y; }
-
- static std::string toString(std::u16string_view x)
- {
- return OUStringToOString(x, RTL_TEXTENCODING_UTF8).getStr();
- }
-};
+ return OUStringToOString(x, RTL_TEXTENCODING_UTF8).getStr();
}
namespace
diff --git a/sal/qa/rtl/math/test-rtl-math.cxx b/sal/qa/rtl/math/test-rtl-math.cxx
index ee4ae55a1a4b..f0288fd50e0e 100644
--- a/sal/qa/rtl/math/test-rtl-math.cxx
+++ b/sal/qa/rtl/math/test-rtl-math.cxx
@@ -27,24 +27,13 @@
#include <rtl/ustring.hxx>
#include <limits>
-CPPUNIT_NS_BEGIN
-
-template<> struct assertion_traits<rtl_math_ConversionStatus>
+template<> inline std::string CPPUNIT_NS::assertion_traits<rtl_math_ConversionStatus>::toString(
+ const rtl_math_ConversionStatus& x )
{
- static bool equal( const rtl_math_ConversionStatus& x, const rtl_math_ConversionStatus& y )
- {
- return x == y;
- }
-
- static std::string toString( const rtl_math_ConversionStatus& x )
- {
- OStringStream ost;
- ost << static_cast<unsigned int>(x);
- return ost.str();
- }
-};
-
-CPPUNIT_NS_END
+ OStringStream ost;
+ ost << static_cast<unsigned int>(x);
+ return ost.str();
+}
namespace {
diff --git a/sal/qa/rtl/strings/test_ostring_concat.cxx b/sal/qa/rtl/strings/test_ostring_concat.cxx
index 853f97564897..4dfe945db295 100644
--- a/sal/qa/rtl/strings/test_ostring_concat.cxx
+++ b/sal/qa/rtl/strings/test_ostring_concat.cxx
@@ -27,15 +27,11 @@ bool rtl_string_unittest_invalid_concat = false;
using namespace rtl;
-namespace CppUnit
+template<> inline std::string CppUnit::assertion_traits<std::type_info>::toString(
+ std::type_info const & x)
{
-template<> struct assertion_traits<std::type_info>
-{
- static bool equal(std::type_info const & x, std::type_info const & y) { return x == y; }
-
- static std::string toString(std::type_info const & x) { return x.name(); }
-};
-} // namespace
+ return x.name();
+}
namespace test::ostring {
diff --git a/sal/qa/rtl/strings/test_oustring_concat.cxx b/sal/qa/rtl/strings/test_oustring_concat.cxx
index 5a11da892d3a..104814fd865d 100644
--- a/sal/qa/rtl/strings/test_oustring_concat.cxx
+++ b/sal/qa/rtl/strings/test_oustring_concat.cxx
@@ -26,15 +26,11 @@ extern bool rtl_string_unittest_invalid_concat;
using namespace rtl;
-namespace CppUnit
+template<> inline std::string CppUnit::assertion_traits<std::type_info>::toString(
+ std::type_info const & x)
{
-template<> struct assertion_traits<std::type_info>
-{
- static bool equal(std::type_info const & x, std::type_info const & y) { return x == y; }
-
- static std::string toString(std::type_info const & x) { return x.name(); }
-};
-} // namespace
+ return x.name();
+}
namespace test::oustring {
diff --git a/test/source/sheet/xsubtotalfield.cxx b/test/source/sheet/xsubtotalfield.cxx
index dd022af10f14..45588d193c81 100644
--- a/test/source/sheet/xsubtotalfield.cxx
+++ b/test/source/sheet/xsubtotalfield.cxx
@@ -21,29 +21,18 @@
using namespace com::sun::star;
using namespace com::sun::star::uno;
-CPPUNIT_NS_BEGIN
-
-template<> struct assertion_traits<uno::Sequence< sheet::SubTotalColumn > >
+template<> inline std::string
+CPPUNIT_NS::assertion_traits<uno::Sequence< sheet::SubTotalColumn > >::toString(
+ const uno::Sequence< sheet::SubTotalColumn >& x)
{
- static bool equal(const uno::Sequence< sheet::SubTotalColumn >& x,
- const uno::Sequence< sheet::SubTotalColumn >& y)
- {
- return x == y;
- }
-
- static std::string toString(const uno::Sequence< sheet::SubTotalColumn >& x)
- {
- OStringStream ost;
- ost << "Sequence: Length: " << x.getLength() << "\n";
- for (const auto& rElement : x)
- ost << "Column: " << rElement.Column << " Function:\n";
- // FIXME: Find a way to print Function
- //ost << "Column: " << element->Column << " Function: " << element->Function << "\n";
- return ost.str();
- }
-};
-
-CPPUNIT_NS_END
+ OStringStream ost;
+ ost << "Sequence: Length: " << x.getLength() << "\n";
+ for (const auto& rElement : x)
+ ost << "Column: " << rElement.Column << " Function:\n";
+ // FIXME: Find a way to print Function
+ //ost << "Column: " << element->Column << " Function: " << element->Function << "\n";
+ return ost.str();
+}
namespace apitest {
diff --git a/tools/qa/cppunit/test_urlobj.cxx b/tools/qa/cppunit/test_urlobj.cxx
index 8402fae5ed55..404f5c5a6ed1 100644
--- a/tools/qa/cppunit/test_urlobj.cxx
+++ b/tools/qa/cppunit/test_urlobj.cxx
@@ -18,24 +18,13 @@
#define OUSTR_TO_STDSTR( oustr ) std::string( OUStringToOString( oustr, RTL_TEXTENCODING_ASCII_US ).getStr() )
-CPPUNIT_NS_BEGIN
-
-template<> struct assertion_traits<INetProtocol>
+template<> inline std::string CPPUNIT_NS::assertion_traits<INetProtocol>::toString(
+ const INetProtocol& x )
{
- static bool equal( const INetProtocol& x, const INetProtocol& y )
- {
- return x == y;
- }
-
- static std::string toString( const INetProtocol& x )
- {
- OStringStream ost;
- ost << static_cast<unsigned int>(x);
- return ost.str();
- }
-};
-
-CPPUNIT_NS_END
+ OStringStream ost;
+ ost << static_cast<unsigned int>(x);
+ return ost.str();
+}
namespace tools_urlobj
{