*/
struct tut_error : public std::exception
{
- tut_error(const std::string& msg)
+ explicit tut_error(const std::string& msg)
: err_msg(msg)
{
}
return test_result::ex;
}
+ virtual std::string type() const
+ {
+ return "tut::tut_error";
+ }
+
const char* what() const throw()
{
return err_msg.c_str();
}
private:
+ void operator=(const tut_error &);
- std::string err_msg;
+ const std::string err_msg;
};
/**
*/
struct no_such_group : public tut_error
{
- no_such_group(const std::string& grp)
+ explicit no_such_group(const std::string& grp)
: tut_error(grp)
{
}
+ virtual std::string type() const
+ {
+ return "tut::no_such_group";
+ }
+
~no_such_group() throw()
{
}
};
+/**
+ * Test not found exception.
+ */
+struct no_such_test : public tut_error
+{
+ explicit no_such_test(const std::string& grp)
+ : tut_error(grp)
+ {
+ }
+
+ virtual std::string type() const
+ {
+ return "tut::no_such_test";
+ }
+
+ ~no_such_test() throw()
+ {
+ }
+};
+
/**
* Internal exception to be throwed when
* test constructor has failed.
*/
struct bad_ctor : public tut_error
{
- bad_ctor(const std::string& msg)
+ explicit bad_ctor(const std::string& msg)
: tut_error(msg)
{
}
return test_result::ex_ctor;
}
+ virtual std::string type() const
+ {
+ return "tut::bad_ctor";
+ }
+
~bad_ctor() throw()
{
}
*/
struct failure : public tut_error
{
- failure(const std::string& msg)
+ explicit failure(const std::string& msg)
: tut_error(msg)
{
}
return test_result::fail;
}
+ virtual std::string type() const
+ {
+ return "tut::failure";
+ }
+
~failure() throw()
{
}
*/
struct warning : public tut_error
{
- warning(const std::string& msg)
+ explicit warning(const std::string& msg)
: tut_error(msg)
{
}
return test_result::warn;
}
+ virtual std::string type() const
+ {
+ return "tut::warning";
+ }
+
~warning() throw()
{
}
*/
struct seh : public tut_error
{
- seh(const std::string& msg)
+ explicit seh(const std::string& msg)
: tut_error(msg)
{
}
return test_result::term;
}
+ virtual std::string type() const
+ {
+ return "tut::seh";
+ }
+
~seh() throw()
{
}
return test_result::rethrown;
}
+ virtual std::string type() const
+ {
+ return "tut::rethrown";
+ }
+
~rethrown() throw()
{
}
const test_result tr;
};
+struct skipped : public tut_error
+{
+ explicit skipped(const std::string& msg)
+ : tut_error(msg)
+ {
+ }
+
+ virtual test_result::result_type result() const
+ {
+ return test_result::skipped;
+ }
+
+ virtual std::string type() const
+ {
+ return "tut::skipped";
+ }
+
+ ~skipped() throw()
+ {
+ }
+};
+
}
#endif