summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolan.mcnamara@collabora.com>2024-01-06 19:33:23 +0000
committerCaolán McNamara <caolan.mcnamara@collabora.com>2024-01-06 20:35:02 +0100
commitd0bf35d30f0662189f646a5c67d89715b725f12c (patch)
tree00733265f6f0b4b75dea99507753bc4c08070a39
parenta60124f6dbca67e01bd09047545a0eb767565383 (diff)
make these similar ones consistent
Change-Id: If1da3c7c255d9db83e2dc6181d283b9d82c147bb Reviewed-on: https://gerrit.libreoffice.org/c/cppunit/+/161719 Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com> Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
-rw-r--r--include/cppunit/Asserter.h28
-rw-r--r--src/cppunit/Asserter.cpp50
2 files changed, 39 insertions, 39 deletions
diff --git a/include/cppunit/Asserter.h b/include/cppunit/Asserter.h
index 2010739..15f5c21 100644
--- a/include/cppunit/Asserter.h
+++ b/include/cppunit/Asserter.h
@@ -53,7 +53,7 @@ struct Asserter
/*! \brief Throws a Exception with the specified message and location.
* \deprecated Use fail( Message, SourceLine ) instead.
*/
- [[noreturn]] static void CPPUNIT_API fail( std::string message,
+ [[noreturn]] static void CPPUNIT_API fail( const std::string& message,
const SourceLine &sourceLine = SourceLine() );
/*! \brief Throws a Exception with the specified message and location.
@@ -74,7 +74,7 @@ struct Asserter
* \param sourceLine Location of the assertion.
*/
static void CPPUNIT_API failIf( bool shouldFail,
- std::string message,
+ const std::string& message,
const SourceLine &sourceLine = SourceLine() );
/*! \brief Returns a expected value string for a message, case equal than
@@ -173,11 +173,11 @@ struct Asserter
* what are the differences between the expected and actual value.
* \param shortDescription Short description for the failure message.
*/
- [[noreturn]] static void CPPUNIT_API failNotLess( std::string expected,
- std::string actual,
+ [[noreturn]] static void CPPUNIT_API failNotLess( const std::string& expected,
+ const std::string& actual,
const SourceLine &sourceLine,
const AdditionalMessage &additionalMessage = AdditionalMessage(),
- std::string shortDescription = "less assertion failed" );
+ const std::string& shortDescription = "less assertion failed" );
/*! \brief Throws an Exception with the specified message and location.
* \param expected Text describing the expected value.
@@ -187,11 +187,11 @@ struct Asserter
* what are the differences between the expected and actual value.
* \param shortDescription Short description for the failure message.
*/
- [[noreturn]] static void CPPUNIT_API failNotGreater( std::string expected,
- std::string actual,
+ [[noreturn]] static void CPPUNIT_API failNotGreater( const std::string& expected,
+ const std::string& actual,
const SourceLine &sourceLine,
const AdditionalMessage &additionalMessage = AdditionalMessage(),
- std::string shortDescription = "greater assertion failed" );
+ const std::string& shortDescription = "greater assertion failed" );
/*! \brief Throws an Exception with the specified message and location.
* \param expected Text describing the expected value.
@@ -201,11 +201,11 @@ struct Asserter
* what are the differences between the expected and actual value.
* \param shortDescription Short description for the failure message.
*/
- [[noreturn]] static void CPPUNIT_API failNotLessEqual( std::string expected,
- std::string actual,
+ [[noreturn]] static void CPPUNIT_API failNotLessEqual( const std::string& expected,
+ const std::string& actual,
const SourceLine &sourceLine,
const AdditionalMessage &additionalMessage = AdditionalMessage(),
- std::string shortDescription = "less equal assertion failed" );
+ const std::string& shortDescription = "less equal assertion failed" );
/*! \brief Throws an Exception with the specified message and location.
* \param expected Text describing the expected value.
@@ -215,11 +215,11 @@ struct Asserter
* what are the differences between the expected and actual value.
* \param shortDescription Short description for the failure message.
*/
- [[noreturn]] static void CPPUNIT_API failNotGreaterEqual( std::string expected,
- std::string actual,
+ [[noreturn]] static void CPPUNIT_API failNotGreaterEqual( const std::string& expected,
+ const std::string& actual,
const SourceLine &sourceLine,
const AdditionalMessage &additionalMessage = AdditionalMessage(),
- std::string shortDescription = "greater equal assertion failed" ); /*! \brief Throws an Exception with the specified message and location.
+ const std::string& shortDescription = "greater equal assertion failed" ); /*! \brief Throws an Exception with the specified message and location.
* \param shouldFail if \c true then the exception is thrown. Otherwise
* nothing happen.
diff --git a/src/cppunit/Asserter.cpp b/src/cppunit/Asserter.cpp
index fe2097e..29588a6 100644
--- a/src/cppunit/Asserter.cpp
+++ b/src/cppunit/Asserter.cpp
@@ -8,7 +8,7 @@ CPPUNIT_NS_BEGIN
// coverity[+kill]
[[noreturn]] void
-Asserter::fail( std::string message,
+Asserter::fail( const std::string& message,
const SourceLine &sourceLine )
{
fail( Message( "assertion failed", message ), sourceLine );
@@ -24,8 +24,8 @@ Asserter::fail( const Message &message,
void
-Asserter::failIf( bool shouldFail,
- const Message &message,
+Asserter::failIf( bool shouldFail,
+ const Message &message,
const SourceLine &sourceLine )
{
if ( shouldFail )
@@ -34,8 +34,8 @@ Asserter::failIf( bool shouldFail,
void
-Asserter::failIf( bool shouldFail,
- std::string message,
+Asserter::failIf( bool shouldFail,
+ const std::string& message,
const SourceLine &sourceLine )
{
failIf( shouldFail, Message( "assertion failed", message ), sourceLine );
@@ -125,11 +125,11 @@ Asserter::failNotEqual( const std::string& expected,
[[noreturn]] void
-Asserter::failNotLess( std::string expected,
- std::string actual,
- const SourceLine &sourceLine,
- const AdditionalMessage &additionalMessage,
- std::string shortDescription )
+Asserter::failNotLess( const std::string& expected,
+ const std::string& actual,
+ const SourceLine &sourceLine,
+ const AdditionalMessage &additionalMessage,
+ const std::string& shortDescription )
{
fail( makeMessage( makeExpectedLess(expected),
makeActual(actual),
@@ -140,11 +140,11 @@ Asserter::failNotLess( std::string expected,
[[noreturn]] void
-Asserter::failNotGreater( std::string expected,
- std::string actual,
- const SourceLine &sourceLine,
- const AdditionalMessage &additionalMessage,
- std::string shortDescription )
+Asserter::failNotGreater( const std::string& expected,
+ const std::string& actual,
+ const SourceLine &sourceLine,
+ const AdditionalMessage &additionalMessage,
+ const std::string& shortDescription )
{
fail( makeMessage( makeExpectedGreater(expected),
makeActual(actual),
@@ -154,30 +154,30 @@ Asserter::failNotGreater( std::string expected,
}
[[noreturn]] void
-Asserter::failNotLessEqual( std::string expected,
- std::string actual,
+Asserter::failNotLessEqual( const std::string& expected,
+ const std::string& actual,
const SourceLine &sourceLine,
const AdditionalMessage &additionalMessage,
- std::string shortDescription )
+ const std::string& shortDescription )
{
fail( makeMessage( makeExpectedLessEqual(expected),
makeActual(actual),
shortDescription,
- additionalMessage ),
+ additionalMessage ),
sourceLine );
}
[[noreturn]] void
-Asserter::failNotGreaterEqual( std::string expected,
- std::string actual,
- const SourceLine &sourceLine,
- const AdditionalMessage &additionalMessage,
- std::string shortDescription )
+Asserter::failNotGreaterEqual( const std::string& expected,
+ const std::string& actual,
+ const SourceLine &sourceLine,
+ const AdditionalMessage &additionalMessage,
+ const std::string& shortDescription )
{
fail( makeMessage( makeExpectedGreaterEqual(expected),
makeActual(actual),
shortDescription,
- additionalMessage ),
+ additionalMessage ),
sourceLine );
}
void