1 #ifndef TUT_RESULT_H_GUARD
2 #define TUT_RESULT_H_GUARD
3 #include <tut/tut_config.hpp>
7 #if defined(TUT_USE_RTTI)
8 #if (defined(_MSC_VER) && !defined(_CPPRTTI)) || (defined(__GNUC__) && !defined(__GXX_RTTI))
13 #if defined(TUT_USE_RTTI)
20 #if defined(TUT_USE_RTTI)
22 inline std::string type_name(const T& t)
24 return typeid(t).name();
28 inline std::string type_name(const T& t)
30 return "Unknown type, RTTI disabled";
33 inline std::string type_name(const std::exception&)
35 return "Unknown std::exception, RTTI disabled";
40 #if defined(TUT_USE_POSIX)
41 struct test_result_posix
48 virtual ~test_result_posix()
55 struct test_result_posix
57 virtual ~test_result_posix()
64 * Return type of runned test/test group.
66 * For test: contains result of test and, possible, message
67 * for failure or exception.
69 struct test_result : public test_result_posix
77 * Test number in group.
82 * Test name (optional)
91 ok, ///< test finished successfully
92 fail, ///< test failed with ensure() or fail() methods
93 ex, ///< test throwed an exceptions
94 warn, ///< test finished successfully, but test destructor throwed
95 term, ///< test forced test application to terminate abnormally
105 * Exception message for failed test.
108 std::string exception_typeid;
111 * Default constructor.
126 test_result(const std::string& grp, int pos,
127 const std::string& test_name, result_type res)
138 * Constructor with exception.
140 test_result(const std::string& grp,int pos,
141 const std::string& test_name, result_type res,
142 const std::exception& ex)
148 exception_typeid(type_name(ex))
152 /** Constructor with typeid.
154 test_result(const std::string& grp,int pos,
155 const std::string& test_name, result_type res,
156 const std::string& ex_typeid,
157 const std::string& msg)
163 exception_typeid(ex_typeid)
167 virtual ~test_result()