summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '3rdParty/CppUnit/src/include/cppunit/Asserter.h')
-rw-r--r--3rdParty/CppUnit/src/include/cppunit/Asserter.h117
1 files changed, 113 insertions, 4 deletions
diff --git a/3rdParty/CppUnit/src/include/cppunit/Asserter.h b/3rdParty/CppUnit/src/include/cppunit/Asserter.h
index 94dadaa..3321b87 100644
--- a/3rdParty/CppUnit/src/include/cppunit/Asserter.h
+++ b/3rdParty/CppUnit/src/include/cppunit/Asserter.h
@@ -42,17 +42,24 @@ class Message;
42 * CPPUNIT_SOURCELINE() ) 42 * CPPUNIT_SOURCELINE() )
43 * \endcode 43 * \endcode
44 */ 44 */
45
46#if defined __GNUC__
47# define NORETURN __attribute__((noreturn))
48#else
49# define NORETURN
50#endif
51
45struct Asserter 52struct Asserter
46{ 53{
47 /*! \brief Throws a Exception with the specified message and location. 54 /*! \brief Throws a Exception with the specified message and location.
48 */ 55 */
49 static void CPPUNIT_API fail( const Message &message, 56 NORETURN static void CPPUNIT_API fail( const Message &message,
50 const SourceLine &sourceLine = SourceLine() ); 57 const SourceLine &sourceLine = SourceLine() );
51 58
52 /*! \brief Throws a Exception with the specified message and location. 59 /*! \brief Throws a Exception with the specified message and location.
53 * \deprecated Use fail( Message, SourceLine ) instead. 60 * \deprecated Use fail( Message, SourceLine ) instead.
54 */ 61 */
55 static void CPPUNIT_API fail( std::string message, 62 NORETURN static void CPPUNIT_API fail( std::string message,
56 const SourceLine &sourceLine = SourceLine() ); 63 const SourceLine &sourceLine = SourceLine() );
57 64
58 /*! \brief Throws a Exception with the specified message and location. 65 /*! \brief Throws a Exception with the specified message and location.
@@ -76,16 +83,55 @@ struct Asserter
76 std::string message, 83 std::string message,
77 const SourceLine &sourceLine = SourceLine() ); 84 const SourceLine &sourceLine = SourceLine() );
78 85
79 /*! \brief Returns a expected value string for a message. 86 /*! \brief Returns a expected value string for a message, case equal than
80 * Typically used to create 'not equal' message, or to check that a message 87 * Typically used to create 'not equal' message, or to check that a message
81 * contains the expected content when writing unit tests for your custom 88 * contains the expected content when writing unit tests for your custom
82 * assertions. 89 * assertions.
83 * 90 *
84 * \param expectedValue String that represents the expected value. 91 * \param expectedValue String that represents the expected value.
85 * \return \a expectedValue prefixed with "Expected: ". 92 * \return \a expectedValue prefixed with "Expected: ".
93 * \deprecated Use makeExpectedEqual instead
86 * \see makeActual(). 94 * \see makeActual().
87 */ 95 */
88 static std::string CPPUNIT_API makeExpected( const std::string &expectedValue ); 96 static std::string CPPUNIT_API makeExpected( const std::string &expectedValue );
97 /*! \brief Returns a expected value string for a message, case equal than
98 * Typically used to create 'not equal' message, or to check that a message
99 * contains the expected content when writing unit tests for your custom
100 * assertions.
101 *
102 * \param expectedValue String that represents the expected value.
103 * \return \a expectedValue prefixed with "Expected: ".
104 * \see makeActual().
105 */
106 static std::string CPPUNIT_API makeExpectedEqual( const std::string &expectedValue );
107 /*! \brief Returns a expected value string for a message, case less than.
108 *
109 * \param expectedValue String that represents the expected value.
110 * \return \a expectedValue prefixed with "Expected less than: ".
111 * \see makeExpectedEqual().
112 */
113 static std::string CPPUNIT_API makeExpectedLess( const std::string &expectedValue );
114 /*! \brief Returns a expected value string for a message, case less or equal than.
115 *
116 * \param expectedValue String that represents the expected value.
117 * \return \a expectedValue prefixed with "Expected: ".
118 * \see makeExpectedEqual().
119 */
120 static std::string CPPUNIT_API makeExpectedLessEqual( const std::string &expectedValue );
121 /*! \brief Returns a expected value string for a message, case greater than.
122 *
123 * \param expectedValue String that represents the expected value.
124 * \return \a expectedValue prefixed with "Expected: ".
125 * \see makeExpectedEqual().
126 */
127 static std::string CPPUNIT_API makeExpectedGreater( const std::string &expectedValue );
128 /*! \brief Returns a expected value string for a message, greater or equal than.
129 *
130 * \param expectedValue String that represents the expected value.
131 * \return \a expectedValue prefixed with "Expected: ".
132 * \see makeExpectedEqual().
133 */
134 static std::string CPPUNIT_API makeExpectedGreaterEqual( const std::string &expectedValue );
89 135
90 /*! \brief Returns an actual value string for a message. 136 /*! \brief Returns an actual value string for a message.
91 * Typically used to create 'not equal' message, or to check that a message 137 * Typically used to create 'not equal' message, or to check that a message
@@ -98,11 +144,19 @@ struct Asserter
98 */ 144 */
99 static std::string CPPUNIT_API makeActual( const std::string &actualValue ); 145 static std::string CPPUNIT_API makeActual( const std::string &actualValue );
100 146
147 /*!
148 * \deprecated Use makeMessage instead
149 */
101 static Message CPPUNIT_API makeNotEqualMessage( const std::string &expectedValue, 150 static Message CPPUNIT_API makeNotEqualMessage( const std::string &expectedValue,
102 const std::string &actualValue, 151 const std::string &actualValue,
103 const AdditionalMessage &additionalMessage = AdditionalMessage(), 152 const AdditionalMessage &additionalMessage = AdditionalMessage(),
104 const std::string &shortDescription = "equality assertion failed"); 153 const std::string &shortDescription = "equality assertion failed");
105 154
155 static Message CPPUNIT_API makeMessage( const std::string &expectedValue,
156 const std::string &actualValue,
157 const std::string &shortDescription,
158 const AdditionalMessage &additionalMessage = AdditionalMessage());
159
106 /*! \brief Throws an Exception with the specified message and location. 160 /*! \brief Throws an Exception with the specified message and location.
107 * \param expected Text describing the expected value. 161 * \param expected Text describing the expected value.
108 * \param actual Text describing the actual value. 162 * \param actual Text describing the actual value.
@@ -111,13 +165,68 @@ struct Asserter
111 * what are the differences between the expected and actual value. 165 * what are the differences between the expected and actual value.
112 * \param shortDescription Short description for the failure message. 166 * \param shortDescription Short description for the failure message.
113 */ 167 */
114 static void CPPUNIT_API failNotEqual( std::string expected, 168 NORETURN static void CPPUNIT_API failNotEqual( std::string expected,
115 std::string actual, 169 std::string actual,
116 const SourceLine &sourceLine, 170 const SourceLine &sourceLine,
117 const AdditionalMessage &additionalMessage = AdditionalMessage(), 171 const AdditionalMessage &additionalMessage = AdditionalMessage(),
118 std::string shortDescription = "equality assertion failed" ); 172 std::string shortDescription = "equality assertion failed" );
119 173
120 /*! \brief Throws an Exception with the specified message and location. 174 /*! \brief Throws an Exception with the specified message and location.
175 * \param expected Text describing the expected value.
176 * \param actual Text describing the actual value.
177 * \param sourceLine Location of the assertion.
178 * \param additionalMessage Additional message. Usually used to report
179 * what are the differences between the expected and actual value.
180 * \param shortDescription Short description for the failure message.
181 */
182 static void CPPUNIT_API failNotLess( std::string expected,
183 std::string actual,
184 const SourceLine &sourceLine,
185 const AdditionalMessage &additionalMessage = AdditionalMessage(),
186 std::string shortDescription = "less assertion failed" );
187
188 /*! \brief Throws an Exception with the specified message and location.
189 * \param expected Text describing the expected value.
190 * \param actual Text describing the actual value.
191 * \param sourceLine Location of the assertion.
192 * \param additionalMessage Additional message. Usually used to report
193 * what are the differences between the expected and actual value.
194 * \param shortDescription Short description for the failure message.
195 */
196 static void CPPUNIT_API failNotGreater( std::string expected,
197 std::string actual,
198 const SourceLine &sourceLine,
199 const AdditionalMessage &additionalMessage = AdditionalMessage(),
200 std::string shortDescription = "greater assertion failed" );
201
202 /*! \brief Throws an Exception with the specified message and location.
203 * \param expected Text describing the expected value.
204 * \param actual Text describing the actual value.
205 * \param sourceLine Location of the assertion.
206 * \param additionalMessage Additional message. Usually used to report
207 * what are the differences between the expected and actual value.
208 * \param shortDescription Short description for the failure message.
209 */
210 static void CPPUNIT_API failNotLessEqual( std::string expected,
211 std::string actual,
212 const SourceLine &sourceLine,
213 const AdditionalMessage &additionalMessage = AdditionalMessage(),
214 std::string shortDescription = "less equal assertion failed" );
215
216 /*! \brief Throws an Exception with the specified message and location.
217 * \param expected Text describing the expected value.
218 * \param actual Text describing the actual value.
219 * \param sourceLine Location of the assertion.
220 * \param additionalMessage Additional message. Usually used to report
221 * what are the differences between the expected and actual value.
222 * \param shortDescription Short description for the failure message.
223 */
224 static void CPPUNIT_API failNotGreaterEqual( std::string expected,
225 std::string actual,
226 const SourceLine &sourceLine,
227 const AdditionalMessage &additionalMessage = AdditionalMessage(),
228 std::string shortDescription = "greater equal assertion failed" ); /*! \brief Throws an Exception with the specified message and location.
229
121 * \param shouldFail if \c true then the exception is thrown. Otherwise 230 * \param shouldFail if \c true then the exception is thrown. Otherwise
122 * nothing happen. 231 * nothing happen.
123 * \param expected Text describing the expected value. 232 * \param expected Text describing the expected value.