diff options
Diffstat (limited to 'cpp/test/Ice/background/AllTests.cpp')
-rw-r--r-- | cpp/test/Ice/background/AllTests.cpp | 72 |
1 files changed, 35 insertions, 37 deletions
diff --git a/cpp/test/Ice/background/AllTests.cpp b/cpp/test/Ice/background/AllTests.cpp index 61cb5b11afe..de2d989f7ed 100644 --- a/cpp/test/Ice/background/AllTests.cpp +++ b/cpp/test/Ice/background/AllTests.cpp @@ -456,8 +456,7 @@ connectTests(const ConfigurationPtr& configuration, const Test::BackgroundPrxPtr } background->ice_getConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait)); - int i; - for(i = 0; i < 4; ++i) + for(int i = 0; i < 4; ++i) { if(i == 0 || i == 2) { @@ -550,7 +549,7 @@ connectTests(const ConfigurationPtr& configuration, const Test::BackgroundPrxPtr OpThreadPtr thread1 = new OpThread(background); OpThreadPtr thread2 = new OpThread(background); - for(i = 0; i < 5; i++) + for(int i = 0; i < 5; i++) { try { @@ -598,8 +597,7 @@ initializeTests(const ConfigurationPtr& configuration, } background->ice_getConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait)); - int i; - for(i = 0; i < 4; i++) + for(int i = 0; i < 4; i++) { if(i == 0 || i == 2) { @@ -760,7 +758,7 @@ initializeTests(const ConfigurationPtr& configuration, OpThreadPtr thread1 = new OpThread(background); OpThreadPtr thread2 = new OpThread(background); - for(i = 0; i < 5; i++) + for(int i = 0; i < 5; i++) { try { @@ -882,8 +880,7 @@ validationTests(const ConfigurationPtr& configuration, test(false); } - int i; - for(i = 0; i < 2; i++) + for(int i = 0; i < 2; i++) { configuration->readException(new Ice::SocketException(__FILE__, __LINE__)); BackgroundPrxPtr prx = i == 0 ? background : background->ice_oneway(); @@ -1228,8 +1225,7 @@ readWriteTests(const ConfigurationPtr& configuration, test(false); } - int i; - for(i = 0; i < 2; i++) + for(int i = 0; i < 2; i++) { BackgroundPrxPtr prx = i == 0 ? background : background->ice_oneway(); @@ -1308,28 +1304,30 @@ readWriteTests(const ConfigurationPtr& configuration, configuration->readReady(false); // Required in C# to make sure beginRead() doesn't throw too soon. configuration->readException(new Ice::SocketException(__FILE__, __LINE__)); #ifdef ICE_CPP11_MAPPING - promise<void> completed; - background->opAsync( - []() - { - test(false); - }, - [&completed](exception_ptr e) - { - try - { - rethrow_exception(e); - } - catch(const Ice::SocketException&) - { - completed.set_value(); - } - catch(...) + { + promise<void> completed; + background->opAsync( + []() { test(false); - } - }); - completed.get_future().get(); + }, + [&completed](exception_ptr e) + { + try + { + rethrow_exception(e); + } + catch(const Ice::SocketException&) + { + completed.set_value(); + } + catch(...) + { + test(false); + } + }); + completed.get_future().get(); + } #else Ice::AsyncResultPtr r = background->begin_op(); try @@ -1390,7 +1388,7 @@ readWriteTests(const ConfigurationPtr& configuration, configuration->writeException(0); } - for(i = 0; i < 2; ++i) + for(int i = 0; i < 2; ++i) { BackgroundPrxPtr prx = i == 0 ? background : background->ice_oneway(); @@ -1427,7 +1425,7 @@ readWriteTests(const ConfigurationPtr& configuration, test(sent.get_future().wait_for(chrono::milliseconds(0)) != future_status::ready); completed.get_future().get(); #else - Ice::AsyncResultPtr r = prx->begin_op(); + r = prx->begin_op(); test(!r->sentSynchronously()); try { @@ -1486,7 +1484,7 @@ readWriteTests(const ConfigurationPtr& configuration, completed.get_future().get(); #else - Ice::AsyncResultPtr r = background->begin_op(); + r = background->begin_op(); try { background->end_op(r); @@ -1530,7 +1528,7 @@ readWriteTests(const ConfigurationPtr& configuration, }); completed.get_future().get(); #else - Ice::AsyncResultPtr r = background->begin_op(); + r = background->begin_op(); // The read exception might propagate before the message send is seen as completed on IOCP. # ifndef ICE_USE_IOCP r->waitForSent(); @@ -1591,7 +1589,7 @@ readWriteTests(const ConfigurationPtr& configuration, { c1.set_value(); }, - [](exception_ptr err) + [](exception_ptr) { test(false); }, @@ -1609,7 +1607,7 @@ readWriteTests(const ConfigurationPtr& configuration, { c2.set_value(); }, - [](exception_ptr err) + [](exception_ptr) { test(false); }, @@ -1775,7 +1773,7 @@ readWriteTests(const ConfigurationPtr& configuration, OpThreadPtr thread1 = new OpThread(background); OpThreadPtr thread2 = new OpThread(background); - for(i = 0; i < 5; i++) + for(int i = 0; i < 5; i++) { try { |