17 #ifndef AGXUNIT_ASSERT_H
18 #define AGXUNIT_ASSERT_H
20 #include <agx/config.h>
21 #include <agx/config/AGX_USE_UNIT_TESTS.h>
23 #if AGX_USE_UNIT_TESTS()
36 # pragma warning(push)
37 # pragma warning(disable: 4251)
38 # pragma warning(disable: 4275)
50 AssertMessage(
const agx::String& brief,
const agx::String& msg1) : m_brief(brief) { m_msg.push_back(msg1); }
52 const agx::String& msg2) : m_brief(brief) { m_msg.push_back(msg1); m_msg.push_back(msg2); }
55 const agx::String& msg3) : m_brief(brief) { m_msg.push_back(msg1); m_msg.push_back(msg2); m_msg.push_back(msg3); }
57 agx::String getMessage(
size_t n)
const {
if (n >= m_msg.size())
return "";
return m_msg[n]; }
58 size_t numMessages()
const {
return m_msg.size(); }
59 void clear() { m_msg.clear(); }
63 void addMessage(
const agx::String& msg ) { m_msg.push_back( msg ); }
64 void addMessage(
const SourceCodeInfo &info )
66 m_msg.push_back(
agx::String(
"File: ")+ info.filename());
67 std::ostringstream str;
68 str <<
"Line: " << info.line();
69 m_msg.push_back(str.str());
70 m_msg.push_back(
agx::String(
"Function: ")+ info.function());
72 void addMessage(
const AssertMessage &message )
74 m_msg.insert( m_msg.end(),
75 message.m_msg.begin(),
76 message.m_msg.end() );
82 typedef std::vector<agx::String> DetailedVector;
95 AdditionalMessage(
const char *detail1 );
97 AdditionalMessage(
const AssertMessage &other );
99 AdditionalMessage &operator =(
const AssertMessage &other );
106 Exception(
const AssertMessage& msg,
const SourceCodeInfo &info=SourceCodeInfo() );
108 virtual ~Exception() throw();
110 Exception( const Exception © );
113 Exception &operator =( const Exception © );
116 const
char *what() const throw();
117 const SourceCodeInfo& info()
const {
return m_info; }
118 const AssertMessage& message()
const {
return m_message; }
121 AssertMessage m_message;
122 SourceCodeInfo m_info;
129 Error(
const AssertMessage& msg,
const SourceCodeInfo &info=SourceCodeInfo() );
131 virtual ~
Error() throw();
145 const SourceCodeInfo &sourceLine = SourceCodeInfo() );
155 const AssertMessage &message,
156 const SourceCodeInfo &sourceLine = SourceCodeInfo() );
184 const AdditionalMessage &additionalMessage = AdditionalMessage(),
185 const agx::String &shortDescription =
"equality agxAssertion failed");
197 const SourceCodeInfo &sourceLine,
198 const AdditionalMessage &additionalMessage = AdditionalMessage(),
199 agx::String shortDescription =
"equality agxAssertion failed" );
214 const SourceCodeInfo &sourceLine,
215 const AdditionalMessage &additionalMessage = AdditionalMessage(),
216 agx::String shortDescription =
"equality agxAssertion failed" );
224 # pragma warning(pop)
#define AGXPHYSICS_EXPORT
#define DOXYGEN_END_INTERNAL_BLOCK()
#define DOXYGEN_START_INTERNAL_BLOCK()
AGXTERRAIN_EXPORT void clear()