7#if defined (STLPORT) && defined (_STLP_USE_NAMESPACES)
19class ExceptionTest :
public CPPUNIT_NS::TestCase
22#if defined (STLPORT) && !defined (_STLP_USE_EXCEPTIONS)
26#if defined (STLPORT) && defined (_STLP_NO_UNEXPECTED_EXCEPT_SUPPORT)
30#if defined (STLPORT) && defined (_STLP_USE_EXCEPTIONS)
33#if defined (STLPORT) && defined (_STLP_NO_UNCAUGHT_EXCEPT_SUPPORT)
37#if defined (STLPORT) && defined (_STLP_USE_EXCEPTIONS)
45 void unexpected_except();
46 void uncaught_except();
47 void exception_emission();
52#if !defined (STLPORT) || !defined (_STLP_NO_UNEXPECTED_EXCEPT_SUPPORT)
53bool g_unexpected_called =
false;
54void unexpected_hdl() {
55 g_unexpected_called =
true;
56 throw std::bad_exception();
59struct special_except {};
61 throw special_except();
69void ExceptionTest::what()
72 throw std::runtime_error( std::string(
"message" ) );
74 catch ( std::runtime_error&
err ) {
79void ExceptionTest::unexpected_except()
81#if !defined (STLPORT) || !defined (_STLP_NO_UNEXPECTED_EXCEPT_SUPPORT)
82 std::unexpected_handler hdl = &unexpected_hdl;
83 std::set_unexpected(hdl);
88 catch (std::bad_exception
const&) {
91 catch (special_except) {
98#if !defined (STLPORT) || !defined (_STLP_NO_UNCAUGHT_EXCEPT_SUPPORT)
99struct UncaughtClassTest
101 UncaughtClassTest(
int &
res) : _res(
res)
104 ~UncaughtClassTest() {
105 _res = std::uncaught_exception()?1:0;
112void ExceptionTest::uncaught_except()
114#if !defined (STLPORT) || !defined (_STLP_NO_UNCAUGHT_EXCEPT_SUPPORT)
115 int uncaught_result = -1;
117 UncaughtClassTest test_inst(uncaught_result);
124 uncaught_result = -1;
125 UncaughtClassTest test_inst(uncaught_result);
135void ExceptionTest::exception_emission()
137#if !defined (STLPORT) || defined (_STLP_USE_EXCEPTIONS)
138 std::string
foo =
"foo";
140 throw std::runtime_error(
foo);
142 catch (std::runtime_error
const&
e) {
144 std::runtime_error clone(
"");
153 throw std::runtime_error(
foo);
155 catch (std::runtime_error
e) {
157 std::runtime_error clone(
"");
165 std::string
msg(512,
'a');
167 throw std::runtime_error(
msg);
169 catch (std::runtime_error
const&
e) {
171 std::runtime_error clone(
"");
180 throw std::runtime_error(
msg);
182 catch (std::runtime_error
e) {
184 std::runtime_error clone(
"");
int strcmp(const char *String1, const char *String2)
#define CPPUNIT_TEST_SUITE_END()
#define CPPUNIT_STOP_IGNORE
#define CPPUNIT_TEST_SUITE_REGISTRATION(X)
#define CPPUNIT_ASSERT(X)
#define CPPUNIT_TEST_SUITE(X)