summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2023-02-16 19:07:56 +0100
committerStephan Bergmann <sbergman@redhat.com>2023-02-16 21:16:12 +0000
commitdf5995b0bf9db2a68dc64f0dda1cc74ab222a1f2 (patch)
tree23d62b841c330ffe73c71b14b210005607c4f1d3 /include
parent5884a122dc2a2c73865efdbdd861c281475a681e (diff)
Only specialize CppUnit::assetion_traits<T>::toString member functions
...not the whole CppUnit::assetion_traits<T> classes (where applicable). That avoids spelling out the (identical) equals member functions, and also leaves around the less and lessEqual member functions, in case they want to be used after all. Change-Id: I18f8d6cff0353921ced4952b33a0c85ff8292923 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147165 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/test/cppunitasserthelper.hxx79
1 files changed, 27 insertions, 52 deletions
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