diff --git a/mrw/stdext_test.cpp b/mrw/stdext_test.cpp index 9af382a..110483a 100644 --- a/mrw/stdext_test.cpp +++ b/mrw/stdext_test.cpp @@ -9,6 +9,9 @@ @license LGPL, see file COPYING $Log$ + Revision 1.3 2004/12/20 13:23:00 marc + new tests for string exceptions + Revision 1.2 2004/10/13 11:19:22 marc remove stdout, print stack trace @@ -50,11 +53,9 @@ public: CPPUNIT_ASSERT(i2==45); CPPUNIT_ASSERT(s==" xx"); s2=""; s3=""; - s>>s2>>s3; + s>>s2; CPPUNIT_ASSERT(s2=="xx"); - CPPUNIT_ASSERT(s3==""); CPPUNIT_ASSERT(s==""); - } void StringAdd() { std::string s; @@ -232,6 +233,15 @@ public: } CPPUNIT_ASSERT(exc); } + void StringException1() { + std::string s("Hello World"); + int hello; + s>>hello; // not an int, exception expected + } + void StringException2() { + std::string s("Hello World"); + mrw::to(s); // not an int, exception expected + } CPPUNIT_TEST_SUITE(StdExtTest); CPPUNIT_TEST(StringConv); CPPUNIT_TEST(StringShift); @@ -243,6 +253,8 @@ public: CPPUNIT_TEST(MapShift); CPPUNIT_TEST(MultisetShift); CPPUNIT_TEST(MultimapShift); + CPPUNIT_TEST_EXCEPTION(StringException1, mrw::invalid_argument); + CPPUNIT_TEST_EXCEPTION(StringException2, mrw::invalid_argument); CPPUNIT_TEST_SUITE_END(); }; CPPUNIT_TEST_SUITE_REGISTRATION(StdExtTest);