]> git.tdb.fi Git - libs/test.git/blobdiff - source/exceptioncheck.h
Better output for exception tests
[libs/test.git] / source / exceptioncheck.h
index 82115024a87b796704c6083d527167698f7eab94..b7f9d3a6636d8c4f67320febddbb414e88350cba 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef MSP_TEST_EXCEPTIONCHECK_H_
 #define MSP_TEST_EXCEPTIONCHECK_H_
 
+#include <typeinfo>
+
 namespace Msp {
 namespace Test {
 
@@ -8,9 +10,11 @@ class ExceptionCheck
 {
 protected:
        ExceptionCheck() { }
-
 public:
+       virtual ~ExceptionCheck() { }
+
        virtual bool check(const std::exception &) const = 0;
+       virtual const std::type_info &get_type_info() const = 0;
 };
 
 template<typename T>
@@ -19,6 +23,9 @@ class ExceptionTypeCheck: public ExceptionCheck
 public:
        virtual bool check(const std::exception &e) const
        { return dynamic_cast<const T *>(&e); }
+
+       virtual const std::type_info &get_type_info() const
+       { return typeid(T); }
 };
 
 } // namespace Test