summaryrefslogtreecommitdiff
path: root/cpp/test/Ice/exceptions/AllTests.cpp
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2012-10-26 18:02:49 +0200
committerBenoit Foucher <benoit@zeroc.com>2012-10-26 18:02:49 +0200
commitda840df6a47591d7816e977c7c030f7330a2f098 (patch)
tree88da6faf9424e42a5e8258a4c6969d741914efa5 /cpp/test/Ice/exceptions/AllTests.cpp
parentMinor metrics fixes (diff)
downloadice-da840df6a47591d7816e977c7c030f7330a2f098.tar.bz2
ice-da840df6a47591d7816e977c7c030f7330a2f098.tar.xz
ice-da840df6a47591d7816e977c7c030f7330a2f098.zip
Fixed cross test failure, memory leaks and UMRs
Diffstat (limited to 'cpp/test/Ice/exceptions/AllTests.cpp')
-rw-r--r--cpp/test/Ice/exceptions/AllTests.cpp107
1 files changed, 47 insertions, 60 deletions
diff --git a/cpp/test/Ice/exceptions/AllTests.cpp b/cpp/test/Ice/exceptions/AllTests.cpp
index 6a09297b4d9..d08c104e2db 100644
--- a/cpp/test/Ice/exceptions/AllTests.cpp
+++ b/cpp/test/Ice/exceptions/AllTests.cpp
@@ -871,6 +871,16 @@ private:
typedef IceUtil::Handle<Callback> CallbackPtr;
+bool
+endsWith(const string& s, const string& findme)
+{
+ if(s.length() > findme.length())
+ {
+ return 0 == s.compare(s.length() - findme.length(), findme.length(), findme);
+ }
+ return false;
+}
+
ThrowerPrx
allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
{
@@ -918,6 +928,42 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
test(uleMsg == ule.what());
test(uleMsg == ule.what());
+
+ {
+ E ex("E");
+ ostringstream os;
+ ex.ice_print(os);
+ test(os.str() == "Test::E");
+ test(ex.data == "E");
+ }
+
+ //
+ // Test custom ice_print
+ //
+ {
+ F ex("F");
+ ostringstream os;
+ ex.ice_print(os);
+ test(os.str() == "Test::F data:'F'");
+ test(ex.data == "F");
+ }
+
+ {
+ G ex(__FILE__, __LINE__, "G");
+ ostringstream os;
+ ex.ice_print(os);
+ test(endsWith(os.str(), "Test::G"));
+ test(ex.data == "G");
+ }
+
+ {
+ H ex(__FILE__, __LINE__, "H");
+ ostringstream os;
+ ex.ice_print(os);
+ test(endsWith(os.str(), "Test::H data:'H'"));
+ test(ex.data == "H");
+ }
+
}
cout << "ok" << endl;
@@ -1412,68 +1458,9 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
{
test(false);
}
-
-
- try
- {
- thrower->throwE();
- }
- catch(const E& ex)
- {
- ostringstream os;
- ex.ice_print(os);
- test(os.str() == "Test::E");
- test(ex.data == "E");
- }
- catch(...)
- {
- test(false);
- }
-
- try
- {
- thrower->throwF();
- }
- catch(const F& ex)
- {
- ostringstream os;
- ex.ice_print(os);
- test(os.str() == "Test::F data:'F'");
- test(ex.data == "F");
- }
- catch(...)
- {
- test(false);
- }
-
- try
- {
- thrower->throwG();
- test(false);
- }
- catch(const Ice::UnknownLocalException&)
- {
- }
- catch(...)
- {
- test(false);
- }
-
- try
- {
- thrower->throwH();
- test(false);
- }
- catch(const Ice::UnknownLocalException&)
- {
- }
- catch(...)
- {
- test(false);
- }
cout << "ok" << endl;
-
+
if(!collocated)
{
cout << "catching exact types with AMI... " << flush;